diff options
author | Robert Speicher <robert@gitlab.com> | 2016-09-29 12:31:57 +0300 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2016-09-29 12:31:57 +0300 |
commit | f78c86bbd5c0220e9b408501550a0bfe8f1b5245 (patch) | |
tree | 75b2eb49e26eea2dedc81ab678ee40af01cb3487 | |
parent | 4754123e2e5f8260debc3de0ed2f2b1248360504 (diff) | |
parent | eb4d3eef90770aa14c804f9d186afc0bcc55c0a0 (diff) |
Merge branch 'rs-remove-duplicate-versioninfo' into 'master'
Remove duplicate VersionInfo class
This was brought over during the CI merge and already exists at
`lib/gitlab/version_info.rb`.
See merge request !6586
-rw-r--r-- | lib/ci/version_info.rb | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/lib/ci/version_info.rb b/lib/ci/version_info.rb deleted file mode 100644 index 2a87c91db5e..00000000000 --- a/lib/ci/version_info.rb +++ /dev/null @@ -1,52 +0,0 @@ -class VersionInfo - include Comparable - - attr_reader :major, :minor, :patch - - def self.parse(str) - if str && m = str.match(/(\d+)\.(\d+)\.(\d+)/) - VersionInfo.new(m[1].to_i, m[2].to_i, m[3].to_i) - else - VersionInfo.new - end - end - - def initialize(major = 0, minor = 0, patch = 0) - @major = major - @minor = minor - @patch = patch - end - - def <=>(other) - return unless other.is_a? VersionInfo - return unless valid? && other.valid? - - if other.major < @major - 1 - elsif @major < other.major - -1 - elsif other.minor < @minor - 1 - elsif @minor < other.minor - -1 - elsif other.patch < @patch - 1 - elsif @patch < other.patch - -1 - else - 0 - end - end - - def to_s - if valid? - "%d.%d.%d" % [@major, @minor, @patch] - else - "Unknown" - end - end - - def valid? - @major >= 0 && @minor >= 0 && @patch >= 0 && @major + @minor + @patch > 0 - end -end |