bosh_common 1.2579.0 → 1.2583.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/common/version.rb +1 -1
- data/lib/common/version_number.rb +22 -38
- metadata +22 -6
data/lib/common/version.rb
CHANGED
@@ -1,53 +1,37 @@
|
|
1
|
+
require 'semi_semantic/version'
|
2
|
+
|
1
3
|
module Bosh::Common
|
2
4
|
class VersionNumber
|
3
|
-
|
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
|
10
|
-
|
11
|
-
|
12
|
-
|
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
|
-
|
15
|
-
|
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
|
-
|
18
|
-
|
19
|
-
|
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
|
-
|
23
|
-
|
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
|
-
|
42
|
-
!@version.end_with?('-dev')
|
24
|
+
SemiSemantic::Version.parse(version)
|
43
25
|
end
|
44
26
|
|
45
|
-
|
46
|
-
|
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
|
-
|
50
|
-
|
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.
|
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-
|
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
|
-
|
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:
|
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
|