mixlib-versioning 1.0.0 → 1.1.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.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/.rubocop.yml +22 -0
- data/.travis.yml +24 -0
- data/CHANGELOG.md +16 -1
- data/Gemfile +3 -4
- data/README.md +9 -15
- data/Rakefile +15 -3
- data/lib/mixlib/versioning.rb +32 -29
- data/lib/mixlib/versioning/exceptions.rb +1 -1
- data/lib/mixlib/versioning/format.rb +33 -31
- data/lib/mixlib/versioning/format/git_describe.rb +5 -7
- data/lib/mixlib/versioning/format/opscode_semver.rb +6 -17
- data/lib/mixlib/versioning/format/rubygems.rb +6 -8
- data/lib/mixlib/versioning/format/semver.rb +9 -11
- data/lib/mixlib/versioning/version.rb +2 -2
- data/mixlib-versioning.gemspec +20 -14
- data/spec/mixlib/versioning/format/git_describe_spec.rb +143 -131
- data/spec/mixlib/versioning/format/opscode_semver_spec.rb +106 -81
- data/spec/mixlib/versioning/format/rubygems_spec.rb +119 -104
- data/spec/mixlib/versioning/format/semver_spec.rb +98 -77
- data/spec/mixlib/versioning/format_spec.rb +17 -25
- data/spec/mixlib/versioning/versioning_spec.rb +163 -141
- data/spec/spec_helper.rb +2 -2
- data/spec/support/shared_examples/basic_semver.rb +19 -21
- data/spec/support/shared_examples/behaviors/comparable.rb +80 -0
- data/spec/support/shared_examples/behaviors/filterable.rb +19 -31
- data/spec/support/shared_examples/behaviors/parses_valid_version_strings.rb +4 -7
- data/spec/support/shared_examples/behaviors/rejects_invalid_version_strings.rb +3 -6
- data/spec/support/shared_examples/behaviors/serializable.rb +5 -7
- data/spec/support/shared_examples/behaviors/sortable.rb +7 -9
- data/spec/support/shared_examples/semver.rb +81 -69
- metadata +51 -26
- data/.yardopts +0 -7
- data/CONTRIBUTING.md +0 -188
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Author:: Seth Chisamore (<schisamo@
|
2
|
+
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
3
3
|
# Copyright:: Copyright (c) 2013 Opscode, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
@@ -19,89 +19,110 @@
|
|
19
19
|
require 'spec_helper'
|
20
20
|
|
21
21
|
describe Mixlib::Versioning::Format::SemVer do
|
22
|
-
|
23
|
-
subject{ described_class.new(version_string) }
|
22
|
+
subject { described_class.new(version_string) }
|
24
23
|
|
25
24
|
it_should_behave_like Mixlib::Versioning::Format::SemVer
|
26
25
|
|
27
|
-
it_has_behavior
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
26
|
+
it_has_behavior 'serializable', [
|
27
|
+
'1.0.0',
|
28
|
+
'1.0.0-alpha.1',
|
29
|
+
'1.0.0-alpha.1+some.build.version',
|
30
|
+
'1.0.0+build.build.build',
|
32
31
|
]
|
33
32
|
|
34
|
-
it_has_behavior
|
35
|
-
let(:unsorted_version_strings)
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
33
|
+
it_has_behavior 'sortable' do
|
34
|
+
let(:unsorted_version_strings) do
|
35
|
+
%w(
|
36
|
+
1.0.0-beta.2
|
37
|
+
1.0.0-alpha
|
38
|
+
1.0.0-alpha.july
|
39
|
+
1.0.0-rc.1+build.1
|
40
|
+
1.0.0
|
41
|
+
1.0.0-beta.11
|
42
|
+
1.0.0+0.3.7
|
43
|
+
1.0.0-rc.1
|
44
|
+
1.0.0-alpha.1
|
45
|
+
1.3.7+build.2.b8f12d7
|
46
|
+
1.3.7+build.11.e0f985a
|
47
|
+
1.3.7+build
|
48
|
+
)
|
49
|
+
end
|
50
|
+
let(:sorted_version_strings) do
|
51
|
+
%w(
|
52
|
+
1.0.0-alpha
|
53
|
+
1.0.0-alpha.1
|
54
|
+
1.0.0-alpha.july
|
55
|
+
1.0.0-beta.2
|
56
|
+
1.0.0-beta.11
|
57
|
+
1.0.0-rc.1
|
58
|
+
1.0.0-rc.1+build.1
|
59
|
+
1.0.0
|
60
|
+
1.0.0+0.3.7
|
61
|
+
1.3.7+build
|
62
|
+
1.3.7+build.2.b8f12d7
|
63
|
+
1.3.7+build.11.e0f985a
|
64
|
+
)
|
65
|
+
end
|
66
|
+
let(:min) { '1.0.0-alpha' }
|
67
|
+
let(:max) { '1.3.7+build.11.e0f985a' }
|
63
68
|
end # it_has_behavior
|
64
69
|
|
65
|
-
it_has_behavior
|
66
|
-
let(:unsorted_version_strings)
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
70
|
+
it_has_behavior 'filterable' do
|
71
|
+
let(:unsorted_version_strings) do
|
72
|
+
%w(
|
73
|
+
1.0.0-beta.2
|
74
|
+
1.0.0-alpha
|
75
|
+
1.0.0-rc.1+build.1
|
76
|
+
1.0.0
|
77
|
+
1.0.0-beta.11
|
78
|
+
1.0.0+0.3.7
|
79
|
+
1.0.0-rc.1
|
80
|
+
1.0.0-alpha.1
|
81
|
+
1.3.7+build.2.b8f12d7
|
82
|
+
1.3.7+build.11.e0f985a
|
83
|
+
1.3.7+build
|
84
|
+
)
|
85
|
+
end
|
86
|
+
let(:release_versions) do
|
87
|
+
%w(
|
88
|
+
1.0.0 )
|
89
|
+
end
|
90
|
+
let(:prerelease_versions) do
|
91
|
+
%w(
|
92
|
+
1.0.0-beta.2
|
93
|
+
1.0.0-alpha
|
94
|
+
1.0.0-beta.11
|
95
|
+
1.0.0-rc.1
|
96
|
+
1.0.0-alpha.1
|
97
|
+
)
|
98
|
+
end
|
99
|
+
let(:build_versions) do
|
100
|
+
%w(
|
101
|
+
1.0.0-rc.1+build.1
|
102
|
+
1.0.0+0.3.7
|
103
|
+
1.3.7+build.2.b8f12d7
|
104
|
+
1.3.7+build.11.e0f985a
|
105
|
+
1.3.7+build
|
106
|
+
)
|
107
|
+
end
|
108
|
+
let(:release_build_versions) do
|
109
|
+
%w(
|
110
|
+
1.0.0+0.3.7
|
111
|
+
1.3.7+build.2.b8f12d7
|
112
|
+
1.3.7+build.11.e0f985a
|
113
|
+
1.3.7+build
|
114
|
+
)
|
115
|
+
end
|
116
|
+
let(:prerelease_build_versions) do
|
117
|
+
%w(
|
118
|
+
1.0.0-rc.1+build.1 )
|
119
|
+
end
|
105
120
|
end # it_has_behavior
|
106
121
|
|
122
|
+
it_has_behavior 'comparable', [
|
123
|
+
'0.1.0', '0.2.0',
|
124
|
+
'1.0.0-alpha.1', '1.0.0',
|
125
|
+
'1.2.3', '1.2.3+build.123',
|
126
|
+
'2.0.0-beta.1', '2.0.0-beta.1+build.123'
|
127
|
+
]
|
107
128
|
end # describe
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Author:: Seth Chisamore (<schisamo@
|
2
|
+
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
3
3
|
# Copyright:: Copyright (c) 2013 Opscode, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
@@ -19,51 +19,43 @@
|
|
19
19
|
require 'spec_helper'
|
20
20
|
|
21
21
|
describe Mixlib::Versioning::Format do
|
22
|
+
describe '#initialize' do
|
23
|
+
subject { described_class.new(version_string) }
|
24
|
+
let(:version_string) { '11.0.0' }
|
22
25
|
|
23
|
-
|
24
|
-
subject{ described_class.new(version_string) }
|
25
|
-
let(:version_string) { "11.0.0" }
|
26
|
-
|
27
|
-
it "descendants must override #parse" do
|
26
|
+
it 'descendants must override #parse' do
|
28
27
|
expect { subject }.to raise_error
|
29
28
|
end
|
30
29
|
end
|
31
30
|
|
32
|
-
describe
|
33
|
-
|
34
|
-
subject{ described_class }
|
31
|
+
describe '.for' do
|
32
|
+
subject { described_class }
|
35
33
|
|
36
34
|
[
|
37
35
|
:rubygems,
|
38
|
-
|
39
|
-
Mixlib::Versioning::Format::Rubygems
|
36
|
+
'rubygems',
|
37
|
+
Mixlib::Versioning::Format::Rubygems,
|
40
38
|
].each do |format_type|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
it "returns the correct format class" do
|
39
|
+
context 'format_type is a: #{format_type.class}' do
|
40
|
+
let(:format_type) { format_type }
|
41
|
+
it 'returns the correct format class' do
|
45
42
|
subject.for(format_type).should eq Mixlib::Versioning::Format::Rubygems
|
46
43
|
end # it
|
47
44
|
end # context
|
48
|
-
|
49
45
|
end # each
|
50
46
|
|
51
|
-
describe
|
47
|
+
describe 'unknown format_type' do
|
52
48
|
[
|
53
49
|
:poop,
|
54
|
-
|
55
|
-
Mixlib::Versioning
|
50
|
+
'poop',
|
51
|
+
Mixlib::Versioning,
|
56
52
|
].each do |invalid_format_type|
|
57
|
-
|
58
|
-
|
59
|
-
it "raises a Mixlib::Versioning::UnknownFormatError" do
|
53
|
+
context 'format_type is a: #{invalid_format_type.class}' do
|
54
|
+
it 'raises a Mixlib::Versioning::UnknownFormatError' do
|
60
55
|
expect { subject.for(invalid_format_type) }.to raise_error(Mixlib::Versioning::UnknownFormatError)
|
61
56
|
end # it
|
62
57
|
end # context
|
63
|
-
|
64
58
|
end # each
|
65
59
|
end # describe
|
66
|
-
|
67
60
|
end # describe ".for"
|
68
|
-
|
69
61
|
end # describe Mixlib::Versioning::Format
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Author:: Seth Chisamore (<schisamo@
|
2
|
+
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
3
3
|
# Copyright:: Copyright (c) 2013 Opscode, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
@@ -19,241 +19,263 @@
|
|
19
19
|
require 'spec_helper'
|
20
20
|
|
21
21
|
describe Mixlib::Versioning do
|
22
|
+
subject { described_class }
|
22
23
|
|
23
|
-
|
24
|
+
let(:version_string) { '11.0.0' }
|
24
25
|
|
25
|
-
|
26
|
-
|
27
|
-
describe ".parse" do
|
28
|
-
|
29
|
-
describe "parsing when format type is specified" do
|
26
|
+
describe '.parse' do
|
27
|
+
describe 'parsing when format type is specified' do
|
30
28
|
{
|
31
|
-
|
32
|
-
:
|
33
|
-
:
|
29
|
+
'11.0.8' => {
|
30
|
+
format_type: :semver,
|
31
|
+
expected_format: Mixlib::Versioning::Format::SemVer,
|
32
|
+
},
|
33
|
+
'11.1.1' => {
|
34
|
+
format_type: :rubygems,
|
35
|
+
expected_format: Mixlib::Versioning::Format::Rubygems,
|
34
36
|
},
|
35
|
-
|
36
|
-
:
|
37
|
-
:
|
37
|
+
'11.1.1.alpha.1' => {
|
38
|
+
format_type: :rubygems,
|
39
|
+
expected_format: Mixlib::Versioning::Format::Rubygems,
|
38
40
|
},
|
39
|
-
|
40
|
-
:
|
41
|
-
:
|
41
|
+
'11.1.1-alpha.1' => {
|
42
|
+
format_type: :opscode_semver,
|
43
|
+
expected_format: Mixlib::Versioning::Format::OpscodeSemVer,
|
42
44
|
},
|
43
|
-
|
44
|
-
:
|
45
|
-
:
|
45
|
+
'11.1.1-rc.2' => {
|
46
|
+
format_type: :opscode_semver,
|
47
|
+
expected_format: Mixlib::Versioning::Format::SemVer,
|
46
48
|
},
|
47
|
-
"11.1.1-rc.2" => {
|
48
|
-
:format_type => :opscode_semver,
|
49
|
-
:expected_format => Mixlib::Versioning::Format::SemVer
|
50
|
-
}
|
51
49
|
}.each_pair do |version_string, options|
|
52
|
-
|
53
50
|
context "#{version_string} as #{options[:expected_format]}" do
|
54
|
-
let(:version_string){ version_string }
|
55
|
-
let(:expected_format){ options[:expected_format] }
|
51
|
+
let(:version_string) { version_string }
|
52
|
+
let(:expected_format) { options[:expected_format] }
|
56
53
|
|
57
54
|
[
|
58
55
|
options[:format_type],
|
59
56
|
options[:format_type].to_s,
|
60
|
-
options[:expected_format]
|
57
|
+
options[:expected_format],
|
61
58
|
].each do |format_type|
|
62
|
-
|
63
59
|
context "format type as a: #{format_type.class}" do
|
64
60
|
it "parses version string as: #{options[:expected_format]}" do
|
65
61
|
result = subject.parse(version_string, format_type)
|
66
62
|
result.should be_a(expected_format)
|
67
63
|
end # it
|
68
64
|
end # context
|
69
|
-
|
70
65
|
end # each
|
71
66
|
end # context
|
72
67
|
end # each_pair
|
73
68
|
|
74
|
-
|
75
|
-
describe "invalid format type specified" do
|
69
|
+
describe 'invalid format type specified' do
|
76
70
|
[
|
77
71
|
:poop,
|
78
|
-
|
79
|
-
Mixlib::Versioning
|
72
|
+
'poop',
|
73
|
+
Mixlib::Versioning,
|
80
74
|
].each do |invalid_format_type|
|
81
|
-
|
82
75
|
context "invalid format as a: #{invalid_format_type.class}" do
|
83
|
-
it
|
76
|
+
it 'raises a Mixlib::Versioning::UnknownFormatError' do
|
84
77
|
expect { subject.parse(version_string, invalid_format_type) }.to raise_error(Mixlib::Versioning::UnknownFormatError)
|
85
78
|
end # it
|
86
79
|
end # context
|
87
|
-
|
88
80
|
end # each
|
89
|
-
|
90
81
|
end # describe
|
91
82
|
end # describe
|
92
83
|
|
93
|
-
describe
|
84
|
+
describe 'parsing with automatic format detection' do
|
94
85
|
{
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
86
|
+
'11.0.8' => Mixlib::Versioning::Format::SemVer,
|
87
|
+
'11.0.8-1' => Mixlib::Versioning::Format::SemVer,
|
88
|
+
'11.0.8.rc.1' => Mixlib::Versioning::Format::Rubygems,
|
89
|
+
'11.0.8.rc.1-1' => Mixlib::Versioning::Format::Rubygems,
|
90
|
+
'11.0.8-rc.1' => Mixlib::Versioning::Format::OpscodeSemVer,
|
91
|
+
|
92
|
+
'10.18.2' => Mixlib::Versioning::Format::SemVer,
|
93
|
+
'10.18.2-poop' => Mixlib::Versioning::Format::SemVer,
|
94
|
+
'10.18.2.poop' => Mixlib::Versioning::Format::Rubygems,
|
95
|
+
'10.18.2.poop-1' => Mixlib::Versioning::Format::Rubygems,
|
96
|
+
|
97
|
+
'12.1.1+20130311134422' => Mixlib::Versioning::Format::OpscodeSemVer,
|
98
|
+
'12.1.1-rc.3+20130311134422' => Mixlib::Versioning::Format::OpscodeSemVer,
|
99
|
+
'12.1.1+20130308110833.git.2.94a1dde' => Mixlib::Versioning::Format::OpscodeSemVer,
|
100
|
+
|
101
|
+
'10.16.2-49-g21353f0' => Mixlib::Versioning::Format::GitDescribe,
|
102
|
+
'10.16.2-49-g21353f0-1' => Mixlib::Versioning::Format::GitDescribe,
|
103
|
+
'10.16.2.rc.2-49-g21353f0' => Mixlib::Versioning::Format::GitDescribe,
|
104
|
+
'10.16.2-rc.2-49-g21353f0' => Mixlib::Versioning::Format::GitDescribe,
|
114
105
|
}.each_pair do |version_string, expected_format|
|
115
|
-
|
116
106
|
context version_string do
|
117
|
-
let(:version_string){ version_string }
|
107
|
+
let(:version_string) { version_string }
|
118
108
|
it "parses version string as: #{expected_format}" do
|
119
109
|
subject.parse(version_string).should be_a(expected_format)
|
120
110
|
end # it
|
121
111
|
end # context
|
122
|
-
|
123
112
|
end # each_pair
|
124
113
|
|
125
|
-
describe
|
126
|
-
let(:version_string){
|
127
|
-
it
|
114
|
+
describe 'version_string cannot be parsed' do
|
115
|
+
let(:version_string) { 'A.B.C' }
|
116
|
+
it 'returns nil' do
|
128
117
|
subject.parse(version_string).should be_nil
|
129
118
|
end
|
130
119
|
end
|
131
|
-
|
132
120
|
end # describe "parsing with automatic format detection"
|
133
121
|
|
134
|
-
describe
|
135
|
-
it
|
122
|
+
describe 'parsing an Mixlib::Versioning::Format object' do
|
123
|
+
it 'returns the same object' do
|
136
124
|
v = Mixlib::Versioning.parse(version_string)
|
137
125
|
result = subject.parse(v)
|
138
126
|
v.should be result
|
139
127
|
end
|
140
128
|
end
|
141
129
|
|
130
|
+
describe 'when formats are given' do
|
131
|
+
context 'when the format is not in the list' do
|
132
|
+
let(:version_string) { '10.16.2-rc.2-49-g21353f0' }
|
133
|
+
it 'returns nil when the array contains a Mixlib::Versioning::Format' do
|
134
|
+
subject.parse(version_string, [Mixlib::Versioning::Format::Rubygems]).should be_nil
|
135
|
+
end
|
136
|
+
|
137
|
+
it 'returns nil when the array contains a string' do
|
138
|
+
subject.parse(version_string, ['rubygems']).should be_nil
|
139
|
+
end
|
140
|
+
|
141
|
+
it 'returns nil when the array contains a symbol' do
|
142
|
+
subject.parse(version_string, [:rubygems]).should be_nil
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
context 'when the format is in the list' do
|
147
|
+
let(:version_string) { '10.16.2-rc.2-49-g21353f0' }
|
148
|
+
let(:expected_format) { Mixlib::Versioning::Format::GitDescribe }
|
149
|
+
it 'returns nil when the array contains a Mixlib::Versioning::Format' do
|
150
|
+
subject.parse(version_string, [expected_format]).should be_a(expected_format)
|
151
|
+
end
|
152
|
+
|
153
|
+
it 'returns nil when the array contains a string' do
|
154
|
+
subject.parse(version_string, ['git_describe']).should be_a(expected_format)
|
155
|
+
end
|
156
|
+
|
157
|
+
it 'returns nil when the array contains a symbol' do
|
158
|
+
subject.parse(version_string, [:git_describe]).should be_a(expected_format)
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
142
162
|
end # describe .parse
|
143
163
|
|
144
|
-
describe
|
145
|
-
let(:all_versions)
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
let(:
|
164
|
+
describe '.find_target_version' do
|
165
|
+
let(:all_versions) do
|
166
|
+
%w(
|
167
|
+
11.0.0-beta.1
|
168
|
+
11.0.0-rc.1
|
169
|
+
11.0.0
|
170
|
+
11.0.1
|
171
|
+
11.0.1+2013031116332
|
172
|
+
11.0.2-alpha.0
|
173
|
+
11.0.2-alpha.0+2013041116332
|
174
|
+
11.0.2
|
175
|
+
)
|
176
|
+
end
|
177
|
+
let(:filter_version) { nil }
|
178
|
+
let(:use_prerelease_versions) { false }
|
179
|
+
let(:use_build_versions) { false }
|
158
180
|
let(:subject_find) do
|
159
|
-
subject.find_target_version(
|
160
|
-
|
161
|
-
|
162
|
-
|
181
|
+
subject.find_target_version(
|
182
|
+
all_versions,
|
183
|
+
filter_version,
|
184
|
+
use_prerelease_versions,
|
185
|
+
use_build_versions,
|
186
|
+
)
|
163
187
|
end
|
164
188
|
|
165
189
|
{
|
166
190
|
nil => {
|
167
|
-
:
|
168
|
-
:
|
169
|
-
:
|
170
|
-
:
|
191
|
+
releases_only: '11.0.2',
|
192
|
+
prerelease_versions: '11.0.2-alpha.0',
|
193
|
+
build_versions: '11.0.1+2013031116332',
|
194
|
+
prerelease_and_build_versions: '11.0.2-alpha.0+2013041116332',
|
195
|
+
},
|
196
|
+
'11.0.0' => {
|
197
|
+
releases_only: '11.0.0',
|
198
|
+
prerelease_versions: '11.0.0-rc.1',
|
199
|
+
build_versions: nil,
|
200
|
+
prerelease_and_build_versions: nil,
|
171
201
|
},
|
172
|
-
|
173
|
-
:
|
174
|
-
:
|
175
|
-
:
|
176
|
-
:
|
202
|
+
'11.0.2' => {
|
203
|
+
releases_only: '11.0.2',
|
204
|
+
prerelease_versions: '11.0.2-alpha.0',
|
205
|
+
build_versions: nil,
|
206
|
+
prerelease_and_build_versions: '11.0.2-alpha.0+2013041116332',
|
177
207
|
},
|
178
|
-
|
179
|
-
:
|
180
|
-
:
|
181
|
-
:
|
182
|
-
:
|
208
|
+
'11.0.2' => {
|
209
|
+
releases_only: '11.0.2',
|
210
|
+
prerelease_versions: '11.0.2-alpha.0',
|
211
|
+
build_versions: nil,
|
212
|
+
prerelease_and_build_versions: '11.0.2-alpha.0+2013041116332',
|
183
213
|
},
|
184
|
-
|
185
|
-
:
|
186
|
-
:
|
187
|
-
:
|
188
|
-
:
|
214
|
+
'11.0.2-alpha.0' => {
|
215
|
+
releases_only: '11.0.2-alpha.0',
|
216
|
+
prerelease_versions: '11.0.2-alpha.0',
|
217
|
+
build_versions: '11.0.2-alpha.0+2013041116332',
|
218
|
+
prerelease_and_build_versions: '11.0.2-alpha.0+2013041116332',
|
189
219
|
},
|
190
|
-
"11.0.2-alpha.0" => {
|
191
|
-
:releases_only => "11.0.2-alpha.0",
|
192
|
-
:prerelease_versions => "11.0.2-alpha.0",
|
193
|
-
:build_versions => "11.0.2-alpha.0+2013041116332",
|
194
|
-
:prerelease_and_build_versions => "11.0.2-alpha.0+2013041116332"
|
195
|
-
}
|
196
220
|
}.each_pair do |filter_version, options|
|
197
|
-
|
198
221
|
context "filter version of: #{filter_version}" do
|
199
|
-
let(:filter_version){ filter_version }
|
200
|
-
let(:expected_version){ options[:releases_only] }
|
222
|
+
let(:filter_version) { filter_version }
|
223
|
+
let(:expected_version) { options[:releases_only] }
|
201
224
|
|
202
|
-
it
|
225
|
+
it 'finds the most recent release version' do
|
203
226
|
subject_find.should eq Mixlib::Versioning.parse(expected_version)
|
204
227
|
end
|
205
228
|
|
206
|
-
context
|
207
|
-
let(:use_prerelease_versions){ true }
|
208
|
-
let(:expected_version){ options[:prerelease_versions] }
|
229
|
+
context 'include pre-release versions' do
|
230
|
+
let(:use_prerelease_versions) { true }
|
231
|
+
let(:expected_version) { options[:prerelease_versions] }
|
209
232
|
|
210
|
-
it
|
233
|
+
it 'finds the most recent pre-release version' do
|
211
234
|
subject_find.should eq Mixlib::Versioning.parse(expected_version)
|
212
235
|
end # it
|
213
236
|
end # context
|
214
237
|
|
215
|
-
context
|
216
|
-
let(:use_build_versions){ true }
|
217
|
-
let(:expected_version){ options[:build_versions] }
|
238
|
+
context 'include build versions' do
|
239
|
+
let(:use_build_versions) { true }
|
240
|
+
let(:expected_version) { options[:build_versions] }
|
218
241
|
|
219
|
-
it
|
242
|
+
it 'finds the most recent build version' do
|
220
243
|
subject_find.should eq Mixlib::Versioning.parse(expected_version)
|
221
244
|
end # it
|
222
245
|
end # context
|
223
246
|
|
224
|
-
context
|
225
|
-
let(:use_prerelease_versions){ true }
|
226
|
-
let(:use_build_versions){ true }
|
227
|
-
let(:expected_version){ options[:prerelease_and_build_versions] }
|
247
|
+
context 'include pre-release and build versions' do
|
248
|
+
let(:use_prerelease_versions) { true }
|
249
|
+
let(:use_build_versions) { true }
|
250
|
+
let(:expected_version) { options[:prerelease_and_build_versions] }
|
228
251
|
|
229
|
-
it
|
252
|
+
it 'finds the most recent pre-release build version' do
|
230
253
|
subject_find.should eq Mixlib::Versioning.parse(expected_version)
|
231
254
|
end # it
|
232
255
|
end # context
|
233
|
-
|
234
256
|
end # context
|
235
257
|
end # each_pair
|
236
258
|
|
237
|
-
describe
|
238
|
-
let(:all_versions)
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
259
|
+
describe 'all_versions argument is a mix of String and Mixlib::Versioning::Format instances' do
|
260
|
+
let(:all_versions) do
|
261
|
+
[
|
262
|
+
'11.0.0-beta.1',
|
263
|
+
'11.0.0-rc.1',
|
264
|
+
Mixlib::Versioning.parse('11.0.0'),
|
265
|
+
]
|
266
|
+
end
|
243
267
|
|
244
|
-
it
|
245
|
-
subject_find.should eq Mixlib::Versioning.parse(
|
268
|
+
it 'correctly parses the array' do
|
269
|
+
subject_find.should eq Mixlib::Versioning.parse('11.0.0')
|
246
270
|
end
|
247
271
|
end # describe
|
248
272
|
|
249
|
-
describe
|
250
|
-
let(:filter_version){ Mixlib::Versioning::Format::SemVer.new(
|
273
|
+
describe 'filter_version argument is an instance of Mixlib::Versioning::Format' do
|
274
|
+
let(:filter_version) { Mixlib::Versioning::Format::SemVer.new('11.0.0') }
|
251
275
|
|
252
|
-
it
|
253
|
-
subject_find.should eq Mixlib::Versioning.parse(
|
276
|
+
it 'finds the correct version' do
|
277
|
+
subject_find.should eq Mixlib::Versioning.parse('11.0.0')
|
254
278
|
end
|
255
279
|
end
|
256
|
-
|
257
280
|
end # describe
|
258
|
-
|
259
281
|
end # describe Mixlib::Versioning
|