mixlib-versioning 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,95 +19,120 @@
|
|
19
19
|
require 'spec_helper'
|
20
20
|
|
21
21
|
describe Mixlib::Versioning::Format::OpscodeSemVer 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
|
-
|
32
|
-
|
26
|
+
it_has_behavior 'rejects invalid version strings', {
|
27
|
+
'1.0.0-poop.0' => 'non-valid pre-release type',
|
28
|
+
'1.0.0+2010AA08010101' => 'a malformed timestamp',
|
29
|
+
'1.0.0+cvs.33.e0f985a' => 'a malformed git describe: no git string',
|
30
|
+
'1.0.0+git.AA.e0f985a' => 'a malformed git describe: non-numeric COMMITS_SINCE',
|
31
|
+
'1.0.0+git.33.z0f985a' => 'a malformed git describe: invalid SHA1',
|
32
|
+
'11.0.08-rc.1+20130308110833' => 'leading zero invalid',
|
33
|
+
'01.0.8-alpha.2+20130308110833.git.2.94a1dde' => 'leading zero invalid',
|
34
|
+
'11.02.8-rc.1+20130308110833' => 'leading zero invalid',
|
35
|
+
'0008.1.4' => 'leading zero invalid',
|
36
|
+
'11.00000000002.8-rc.1+20130308110833' => 'leading zero invalid',
|
37
|
+
'4.67.00012+build.20131219' => 'leading zero invalid',
|
38
|
+
'3.6.7-rc.007' => 'leading zero invalid',
|
33
39
|
}
|
34
40
|
|
35
|
-
it_has_behavior
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
41
|
+
it_has_behavior 'serializable', [
|
42
|
+
'1.0.0',
|
43
|
+
'1.0.0-alpha.1',
|
44
|
+
'1.0.0-alpha.1+20130308110833',
|
45
|
+
'1.0.0+20130308110833.git.2.94a1dde',
|
40
46
|
]
|
41
47
|
|
42
|
-
it_has_behavior
|
43
|
-
let(:unsorted_version_strings)
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
48
|
+
it_has_behavior 'sortable' do
|
49
|
+
let(:unsorted_version_strings) do
|
50
|
+
%w(
|
51
|
+
1.0.0-beta.2
|
52
|
+
1.0.0-alpha
|
53
|
+
1.0.0-rc.1+20130309074433
|
54
|
+
1.0.0
|
55
|
+
1.0.0-beta.11
|
56
|
+
1.0.0+20121009074433
|
57
|
+
1.0.0-rc.1
|
58
|
+
1.0.0-alpha.1
|
59
|
+
1.3.7+20131009104433.git.2.94a1dde
|
60
|
+
1.3.7+20131009104433
|
61
|
+
1.3.7+20131009074433
|
62
|
+
)
|
63
|
+
end
|
64
|
+
let(:sorted_version_strings) do
|
65
|
+
%w(
|
66
|
+
1.0.0-alpha
|
67
|
+
1.0.0-alpha.1
|
68
|
+
1.0.0-beta.2
|
69
|
+
1.0.0-beta.11
|
70
|
+
1.0.0-rc.1
|
71
|
+
1.0.0-rc.1+20130309074433
|
72
|
+
1.0.0
|
73
|
+
1.0.0+20121009074433
|
74
|
+
1.3.7+20131009074433
|
75
|
+
1.3.7+20131009104433
|
76
|
+
1.3.7+20131009104433.git.2.94a1dde
|
77
|
+
)
|
78
|
+
end
|
79
|
+
let(:min) { '1.0.0-alpha' }
|
80
|
+
let(:max) { '1.3.7+20131009104433.git.2.94a1dde' }
|
71
81
|
end # it_has_behavior
|
72
82
|
|
73
|
-
it_has_behavior
|
74
|
-
let(:unsorted_version_strings)
|
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
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
let(:
|
109
|
-
|
110
|
-
|
83
|
+
it_has_behavior 'filterable' do
|
84
|
+
let(:unsorted_version_strings) do
|
85
|
+
%w(
|
86
|
+
1.0.0-beta.2
|
87
|
+
1.0.0-alpha
|
88
|
+
1.0.0-rc.1+20130309074433
|
89
|
+
1.0.0
|
90
|
+
1.0.0-beta.11
|
91
|
+
1.0.0+20121009074433
|
92
|
+
1.0.0-rc.1
|
93
|
+
1.0.0-alpha.1
|
94
|
+
1.3.7+20131009104433.git.2.94a1dde
|
95
|
+
1.3.7+20131009104433
|
96
|
+
1.3.7+20131009074433
|
97
|
+
)
|
98
|
+
end
|
99
|
+
let(:release_versions) { %w(1.0.0) }
|
100
|
+
let(:prerelease_versions) do
|
101
|
+
%w(
|
102
|
+
1.0.0-beta.2
|
103
|
+
1.0.0-alpha
|
104
|
+
1.0.0-beta.11
|
105
|
+
1.0.0-rc.1
|
106
|
+
1.0.0-alpha.1
|
107
|
+
)
|
108
|
+
end
|
109
|
+
let(:build_versions) do
|
110
|
+
%w(
|
111
|
+
1.0.0-rc.1+20130309074433
|
112
|
+
1.0.0+20121009074433
|
113
|
+
1.3.7+20131009104433.git.2.94a1dde
|
114
|
+
1.3.7+20131009104433
|
115
|
+
1.3.7+20131009074433
|
116
|
+
)
|
117
|
+
end
|
118
|
+
let(:release_build_versions) do
|
119
|
+
%w(
|
120
|
+
1.0.0+20121009074433
|
121
|
+
1.3.7+20131009104433.git.2.94a1dde
|
122
|
+
1.3.7+20131009104433
|
123
|
+
1.3.7+20131009074433
|
124
|
+
)
|
125
|
+
end
|
126
|
+
let(:prerelease_build_versions) do
|
127
|
+
%w(
|
128
|
+
1.0.0-rc.1+20130309074433 )
|
129
|
+
end
|
111
130
|
end # it_has_behavior
|
112
131
|
|
132
|
+
it_has_behavior 'comparable', [
|
133
|
+
'0.1.0', '0.2.0',
|
134
|
+
'1.0.0-alpha.1', '1.0.0',
|
135
|
+
'1.2.3', '1.2.3+20121009074433',
|
136
|
+
'2.0.0-beta.1', '2.0.0+20131009104433.git.2.94a1dde'
|
137
|
+
]
|
113
138
|
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,124 +19,139 @@
|
|
19
19
|
require 'spec_helper'
|
20
20
|
|
21
21
|
describe Mixlib::Versioning::Format::Rubygems do
|
22
|
+
subject { described_class.new(version_string) }
|
22
23
|
|
23
|
-
|
24
|
+
it_should_behave_like 'Basic SemVer'
|
24
25
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
:
|
30
|
-
:
|
31
|
-
:
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
:
|
38
|
-
|
39
|
-
|
26
|
+
it_has_behavior 'parses valid version strings', {
|
27
|
+
'10.1.1' => {
|
28
|
+
major: 10,
|
29
|
+
minor: 1,
|
30
|
+
patch: 1,
|
31
|
+
prerelease: nil,
|
32
|
+
build: nil,
|
33
|
+
release?: true,
|
34
|
+
prerelease?: false,
|
35
|
+
build?: false,
|
36
|
+
release_build?: false,
|
37
|
+
prerelease_build?: false,
|
38
|
+
iteration: 0,
|
39
|
+
},
|
40
|
+
'10.1.1.alpha.1' => {
|
41
|
+
major: 10,
|
42
|
+
minor: 1,
|
43
|
+
patch: 1,
|
44
|
+
prerelease: 'alpha.1',
|
45
|
+
build: nil,
|
46
|
+
release?: false,
|
47
|
+
prerelease?: true,
|
48
|
+
build?: false,
|
49
|
+
release_build?: false,
|
50
|
+
prerelease_build?: false,
|
51
|
+
iteration: 0,
|
40
52
|
},
|
41
|
-
|
42
|
-
:
|
43
|
-
:
|
44
|
-
:
|
45
|
-
:
|
46
|
-
:
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
:
|
53
|
+
'11.0.8.rc.3' => {
|
54
|
+
major: 11,
|
55
|
+
minor: 0,
|
56
|
+
patch: 8,
|
57
|
+
prerelease: 'rc.3',
|
58
|
+
build: nil,
|
59
|
+
release?: false,
|
60
|
+
prerelease?: true,
|
61
|
+
build?: false,
|
62
|
+
release_build?: false,
|
63
|
+
prerelease_build?: false,
|
64
|
+
iteration: 0,
|
53
65
|
},
|
54
|
-
|
55
|
-
:
|
56
|
-
:
|
57
|
-
:
|
58
|
-
:
|
59
|
-
:
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
:
|
66
|
+
'11.0.8-33' => {
|
67
|
+
major: 11,
|
68
|
+
minor: 0,
|
69
|
+
patch: 8,
|
70
|
+
prerelease: nil,
|
71
|
+
build: nil,
|
72
|
+
release?: true,
|
73
|
+
prerelease?: false,
|
74
|
+
build?: false,
|
75
|
+
release_build?: false,
|
76
|
+
prerelease_build?: false,
|
77
|
+
iteration: 33,
|
66
78
|
},
|
67
|
-
|
68
|
-
:
|
69
|
-
:
|
70
|
-
:
|
71
|
-
:
|
72
|
-
:
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
:
|
79
|
+
'11.0.8.rc.3-1' => {
|
80
|
+
major: 11,
|
81
|
+
minor: 0,
|
82
|
+
patch: 8,
|
83
|
+
prerelease: 'rc.3',
|
84
|
+
build: nil,
|
85
|
+
release?: false,
|
86
|
+
prerelease?: true,
|
87
|
+
build?: false,
|
88
|
+
release_build?: false,
|
89
|
+
prerelease_build?: false,
|
90
|
+
iteration: 1,
|
79
91
|
},
|
80
|
-
"11.0.8.rc.3-1" => {
|
81
|
-
:major => 11,
|
82
|
-
:minor => 0,
|
83
|
-
:patch => 8,
|
84
|
-
:prerelease => "rc.3",
|
85
|
-
:build => nil,
|
86
|
-
:release? => false,
|
87
|
-
:prerelease? => true,
|
88
|
-
:build? => false,
|
89
|
-
:release_build? => false,
|
90
|
-
:prerelease_build? => false,
|
91
|
-
:iteration => 1
|
92
|
-
}
|
93
92
|
}
|
94
93
|
|
95
|
-
it_has_behavior
|
96
|
-
|
94
|
+
it_has_behavior 'rejects invalid version strings', {
|
95
|
+
'1.1.1-rutro' => 'dash for pre-release delimeter',
|
97
96
|
}
|
98
97
|
|
99
|
-
it_has_behavior
|
100
|
-
|
101
|
-
|
102
|
-
|
98
|
+
it_has_behavior 'serializable', [
|
99
|
+
'1.0.0',
|
100
|
+
'1.0.0.alpha.1',
|
101
|
+
'1.0.0.beta',
|
103
102
|
]
|
104
103
|
|
105
|
-
it_has_behavior
|
106
|
-
let(:unsorted_version_strings)
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
104
|
+
it_has_behavior 'sortable' do
|
105
|
+
let(:unsorted_version_strings) do
|
106
|
+
%w(
|
107
|
+
1.0.0.beta.2
|
108
|
+
1.3.7.alpha.0
|
109
|
+
1.0.0.alpha
|
110
|
+
1.0.0.rc.1
|
111
|
+
1.0.0
|
112
|
+
)
|
113
|
+
end
|
114
|
+
let(:sorted_version_strings) do
|
115
|
+
%w(
|
116
|
+
1.0.0.alpha
|
117
|
+
1.0.0.beta.2
|
118
|
+
1.0.0.rc.1
|
119
|
+
1.0.0
|
120
|
+
1.3.7.alpha.0
|
121
|
+
)
|
122
|
+
end
|
123
|
+
let(:min) { '1.0.0.alpha' }
|
124
|
+
let(:max) { '1.3.7.alpha.0' }
|
122
125
|
end
|
123
126
|
|
124
127
|
# The +Rubygems+ format only produces release and prerelease versions.
|
125
|
-
it_has_behavior
|
126
|
-
let(:unsorted_version_strings)
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
128
|
+
it_has_behavior 'filterable' do
|
129
|
+
let(:unsorted_version_strings) do
|
130
|
+
%w(
|
131
|
+
1.0.0.beta.2
|
132
|
+
1.3.7.alpha.0
|
133
|
+
1.0.0.alpha
|
134
|
+
1.0.0.rc.1
|
135
|
+
1.0.0
|
136
|
+
)
|
137
|
+
end
|
138
|
+
let(:release_versions) { %w(1.0.0) }
|
139
|
+
let(:prerelease_versions) do
|
140
|
+
%w(
|
141
|
+
1.0.0.beta.2
|
142
|
+
1.3.7.alpha.0
|
143
|
+
1.0.0.alpha
|
144
|
+
1.0.0.rc.1
|
145
|
+
)
|
146
|
+
end
|
140
147
|
end
|
141
148
|
|
149
|
+
it_has_behavior 'comparable', [
|
150
|
+
'0.1.0', '0.2.0',
|
151
|
+
'1.0.0.alpha.1', '1.0.0',
|
152
|
+
'1.2.3.alpha', '1.2.3.alpha.1',
|
153
|
+
'2.4.5.alpha', '2.4.5.beta',
|
154
|
+
'3.0.0.beta.1', '3.0.0.rc.1',
|
155
|
+
'3.1.2.rc.42', '3.1.2'
|
156
|
+
]
|
142
157
|
end
|