bosh_common 1.2579.0 → 1.2583.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module Bosh
2
2
  module Common
3
- VERSION = '1.2579.0'
3
+ VERSION = '1.2583.0'
4
4
  end
5
5
  end
@@ -1,53 +1,37 @@
1
+ require 'semi_semantic/version'
2
+
1
3
  module Bosh::Common
2
4
  class VersionNumber
3
- include Comparable
4
-
5
- def initialize(version_value)
6
- @version = version_value.to_s
7
- end
5
+ DEFAULT_DEV_RELEASE_SEGMENT = SemiSemantic::VersionSegment.parse('dev.1')
8
6
 
9
- def <=>(other)
10
- v1 = @version
11
- v2 = other.to_s
12
- return v1 <=> v2 if [v1, v2].all? { |v| v.to_s.match(/^\d{4}-\d{2}-\d{2}_\d{2}-\d{2}-\d{2}$/) }
7
+ def self.parse(version)
8
+ raise ArgumentError, 'Invalid Version: nil' if version.nil?
9
+ #raise ArgumentError, "Invalid Version Type: #{version.class}" if version.is_a?(String)
10
+ version = version.to_s
13
11
 
14
- vp1 = components
15
- vp2 = other.components
12
+ #discard anything after a space, including the space, to support compound bosh versions
13
+ version = version.split(' ', 2)[0] if version =~ / /
16
14
 
17
- [vp1.size, vp2.size].max.times do |i|
18
- result = vp1[i].to_i <=> vp2[i].to_i
19
- return result unless result == 0
15
+ #convert old-style dev version suffix to new dev post-release segment
16
+ matches = /\A(?<release>.*)(\.(?<dev>[0-9]+)-dev)\z/.match(version)
17
+ unless matches.nil?
18
+ version = matches[:release] + "+dev." + matches[:dev]
20
19
  end
21
20
 
22
- 0
23
- end
24
-
25
- def major
26
- components[0].to_i
27
- end
28
-
29
- def minor
30
- components[1].to_i
31
- end
32
-
33
- def components
34
- @version.split('.')
35
- end
36
-
37
- def to_s
38
- @version
39
- end
21
+ #replace underscores with periods to maintain reverse compatibility with stemcell versions
22
+ version = version.gsub('_', '.')
40
23
 
41
- def final?
42
- !@version.end_with?('-dev')
24
+ SemiSemantic::Version.parse(version)
43
25
  end
44
26
 
45
- def next_minor
46
- self.class.new("#{major}.#{minor + 1}")
27
+ # @param [Array<#version>] Collection of version strings
28
+ def self.parse_list(versions)
29
+ versions.map { |v| self.parse(v) }
47
30
  end
48
31
 
49
- def dev
50
- final? ? self.class.new("#{@version}-dev") : self
32
+ # @param [Array<#version>] Collection of version strings
33
+ def self.latest(versions)
34
+ versions.max
51
35
  end
52
36
  end
53
37
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bosh_common
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2579.0
4
+ version: 1.2583.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,27 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-05-24 00:00:00.000000000 Z
13
- dependencies: []
12
+ date: 2014-05-30 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: semi_semantic
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 1.1.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 1.1.0
14
30
  description: ! 'BOSH common
15
31
 
16
- 4fef83'
32
+ b96a92'
17
33
  email: support@cloudfoundry.com
18
34
  executables: []
19
35
  extensions: []
@@ -57,10 +73,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
57
73
  version: '0'
58
74
  segments:
59
75
  - 0
60
- hash: -1323781589771077570
76
+ hash: 2863706142254409003
61
77
  requirements: []
62
78
  rubyforge_project:
63
- rubygems_version: 1.8.23
79
+ rubygems_version: 1.8.23.2
64
80
  signing_key:
65
81
  specification_version: 3
66
82
  summary: BOSH common