mixlib-versioning 1.2.2 → 1.2.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +5 -5
  2. data/lib/mixlib/versioning.rb +1 -2
  3. data/lib/mixlib/versioning/exceptions.rb +1 -1
  4. data/lib/mixlib/versioning/format.rb +2 -3
  5. data/lib/mixlib/versioning/format/git_describe.rb +1 -1
  6. data/lib/mixlib/versioning/format/opscode_semver.rb +1 -1
  7. data/lib/mixlib/versioning/format/partial_semver.rb +1 -1
  8. data/lib/mixlib/versioning/format/rubygems.rb +1 -1
  9. data/lib/mixlib/versioning/format/semver.rb +1 -1
  10. data/lib/mixlib/versioning/version.rb +2 -2
  11. metadata +6 -53
  12. data/.expeditor/config.yml +0 -14
  13. data/.expeditor/update_version.sh +0 -9
  14. data/.github/CODEOWNERS +0 -3
  15. data/.gitignore +0 -21
  16. data/.travis.yml +0 -28
  17. data/CHANGELOG.md +0 -30
  18. data/Gemfile +0 -26
  19. data/README.md +0 -377
  20. data/Rakefile +0 -24
  21. data/VERSION +0 -1
  22. data/mixlib-versioning.gemspec +0 -20
  23. data/spec/mixlib/versioning/format/git_describe_spec.rb +0 -190
  24. data/spec/mixlib/versioning/format/opscode_semver_spec.rb +0 -138
  25. data/spec/mixlib/versioning/format/partial_semver_spec.rb +0 -121
  26. data/spec/mixlib/versioning/format/rubygems_spec.rb +0 -157
  27. data/spec/mixlib/versioning/format/semver_spec.rb +0 -128
  28. data/spec/mixlib/versioning/format_spec.rb +0 -88
  29. data/spec/mixlib/versioning/versioning_spec.rb +0 -281
  30. data/spec/spec_helper.rb +0 -42
  31. data/spec/support/shared_examples/basic_semver.rb +0 -40
  32. data/spec/support/shared_examples/behaviors/comparable.rb +0 -80
  33. data/spec/support/shared_examples/behaviors/comparable_types.rb +0 -56
  34. data/spec/support/shared_examples/behaviors/filterable.rb +0 -54
  35. data/spec/support/shared_examples/behaviors/parses_valid_version_strings.rb +0 -29
  36. data/spec/support/shared_examples/behaviors/rejects_invalid_version_strings.rb +0 -29
  37. data/spec/support/shared_examples/behaviors/serializable.rb +0 -49
  38. data/spec/support/shared_examples/behaviors/sortable.rb +0 -43
  39. data/spec/support/shared_examples/semver.rb +0 -117
data/Rakefile DELETED
@@ -1,24 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:unit)
5
-
6
- begin
7
- require "chefstyle"
8
- require "rubocop/rake_task"
9
- RuboCop::RakeTask.new(:chefstyle) do |task|
10
- task.options << "--display-cop-names"
11
- end
12
- rescue LoadError
13
- puts "chefstyle gem is not installed"
14
- end
15
-
16
- require "yard"
17
- YARD::Rake::YardocTask.new(:doc)
18
-
19
- namespace :travis do
20
- desc "Run tests on Travis CI"
21
- task ci: %w{chefstyle unit}
22
- end
23
-
24
- task default: %w{travis:ci}
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 1.2.2
@@ -1,20 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- lib = File.expand_path("../lib", __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "mixlib/versioning/version"
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "mixlib-versioning"
8
- spec.version = Mixlib::Versioning::VERSION
9
- spec.authors = ["Seth Chisamore", "Christopher Maier"]
10
- spec.email = ["schisamo@chef.io", "cm@chef.io"]
11
- spec.description = "General purpose Ruby library that allows you to parse, compare and manipulate version strings in multiple formats."
12
- spec.summary = spec.description
13
- spec.homepage = "https://github.com/chef/mixlib-versioning"
14
- spec.license = "Apache 2.0"
15
-
16
- spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
17
- spec.executables = spec.files.grep(%r{^bin/}).map { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
20
- end
@@ -1,190 +0,0 @@
1
- #
2
- # Author:: Seth Chisamore (<schisamo@chef.io>)
3
- # Copyright:: Copyright (c) 2013 Opscode, Inc.
4
- # License:: Apache License, Version 2.0
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- require "spec_helper"
20
-
21
- describe Mixlib::Versioning::Format::GitDescribe do
22
- subject { described_class.new(version_string) }
23
-
24
- it_has_behavior "parses valid version strings", {
25
- "0.10.8-231-g59d6185" => {
26
- major: 0,
27
- minor: 10,
28
- patch: 8,
29
- prerelease: nil,
30
- build: "231.g59d6185.0",
31
- release?: false,
32
- prerelease?: false,
33
- build?: true,
34
- release_build?: true,
35
- prerelease_build?: false,
36
- commits_since: 231,
37
- commit_sha: "59d6185",
38
- iteration: 0,
39
- },
40
- "10.16.2-49-g21353f0-1" => {
41
- major: 10,
42
- minor: 16,
43
- patch: 2,
44
- prerelease: nil,
45
- build: "49.g21353f0.1",
46
- release?: false,
47
- prerelease?: false,
48
- build?: true,
49
- release_build?: true,
50
- prerelease_build?: false,
51
- commits_since: 49,
52
- commit_sha: "21353f0",
53
- iteration: 1,
54
- },
55
- "10.16.2.rc.1-49-g21353f0-1" => {
56
- major: 10,
57
- minor: 16,
58
- patch: 2,
59
- prerelease: "rc.1",
60
- build: "49.g21353f0.1",
61
- release?: false,
62
- prerelease?: false,
63
- build?: true,
64
- release_build?: false,
65
- prerelease_build?: true,
66
- commits_since: 49,
67
- commit_sha: "21353f0",
68
- iteration: 1,
69
- },
70
- "10.16.2-alpha-49-g21353f0-1" => {
71
- major: 10,
72
- minor: 16,
73
- patch: 2,
74
- prerelease: "alpha",
75
- build: "49.g21353f0.1",
76
- release?: false,
77
- prerelease?: false,
78
- build?: true,
79
- release_build?: false,
80
- prerelease_build?: true,
81
- commits_since: 49,
82
- commit_sha: "21353f0",
83
- iteration: 1,
84
- },
85
- "10.16.2-alpha-49-g21353f0" => {
86
- major: 10,
87
- minor: 16,
88
- patch: 2,
89
- prerelease: "alpha",
90
- build: "49.g21353f0.0",
91
- release?: false,
92
- prerelease?: false,
93
- build?: true,
94
- release_build?: false,
95
- prerelease_build?: true,
96
- commits_since: 49,
97
- commit_sha: "21353f0",
98
- iteration: 0,
99
- },
100
- }
101
-
102
- it_has_behavior "rejects invalid version strings", {
103
- "1.0.0" => "no git describe data",
104
- "1.0.0-alpha.1" => "no git describe data",
105
- "1.0.0-alpha.1+build.deadbeef" => "no git describe data",
106
- "1.0.0-123-gfd0e3a65282cb5f6df3bab6a53f4fcb722340d499-1" => "too many SHA1 characters",
107
- "1.0.0-123-gdeadbe-1" => "too few SHA1 characters",
108
- "1.0.0-123-gNOTHEX1-1" => "illegal SHA1 characters",
109
- "1.0.0-123-g1234567-alpha" => "non-numeric iteration",
110
- "1.0.0-alpha-poop-g1234567-1" => "non-numeric 'commits_since'",
111
- "1.0.0-g1234567-1" => "missing 'commits_since'",
112
- "1.0.0-123-1" => "missing SHA1",
113
- }
114
-
115
- version_strings = %w{
116
- 9.0.1-1-gdeadbee-1
117
- 9.1.2-2-g1234567-1
118
- 10.0.0-1-gabcdef3-1
119
- 10.5.7-2-g21353f0-1
120
- 10.20.2-2-gbbbbbbb-1
121
- 10.20.2-3-gaaaaaaa-1
122
- 9.0.1-2-gdeadbe1-1
123
- 9.0.1-2-gdeadbe1-2
124
- 9.0.1-2-gdeadbe2-1
125
- 9.1.1-2-g1234567-1
126
- }
127
-
128
- it_has_behavior "serializable", version_strings
129
-
130
- it_has_behavior "sortable" do
131
- let(:unsorted_version_strings) { version_strings }
132
- let(:sorted_version_strings) do
133
- %w{
134
- 9.0.1-1-gdeadbee-1
135
- 9.0.1-2-gdeadbe1-1
136
- 9.0.1-2-gdeadbe1-2
137
- 9.0.1-2-gdeadbe2-1
138
- 9.1.1-2-g1234567-1
139
- 9.1.2-2-g1234567-1
140
- 10.0.0-1-gabcdef3-1
141
- 10.5.7-2-g21353f0-1
142
- 10.20.2-2-gbbbbbbb-1
143
- 10.20.2-3-gaaaaaaa-1
144
- }
145
- end
146
- let(:min) { "9.0.1-1-gdeadbee-1" }
147
- let(:max) { "10.20.2-3-gaaaaaaa-1" }
148
- end # it_has_behavior
149
-
150
- # The +GitDescribe+ format only produces release build versions.
151
- it_has_behavior "filterable" do
152
- let(:unsorted_version_strings) { version_strings }
153
- let(:build_versions) do
154
- %w{
155
- 9.0.1-1-gdeadbee-1
156
- 9.1.2-2-g1234567-1
157
- 10.0.0-1-gabcdef3-1
158
- 10.5.7-2-g21353f0-1
159
- 10.20.2-2-gbbbbbbb-1
160
- 10.20.2-3-gaaaaaaa-1
161
- 9.0.1-2-gdeadbe1-1
162
- 9.0.1-2-gdeadbe1-2
163
- 9.0.1-2-gdeadbe2-1
164
- 9.1.1-2-g1234567-1
165
- }
166
- end
167
- let(:release_build_versions) do
168
- %w{
169
- 9.0.1-1-gdeadbee-1
170
- 9.1.2-2-g1234567-1
171
- 10.0.0-1-gabcdef3-1
172
- 10.5.7-2-g21353f0-1
173
- 10.20.2-2-gbbbbbbb-1
174
- 10.20.2-3-gaaaaaaa-1
175
- 9.0.1-2-gdeadbe1-1
176
- 9.0.1-2-gdeadbe1-2
177
- 9.0.1-2-gdeadbe2-1
178
- 9.1.1-2-g1234567-1
179
- }
180
- end
181
- end # it_has_behavior
182
-
183
- it_has_behavior "comparable", [
184
- "9.0.1-1-gdeadbee-1", "9.0.1-2-gdeadbe1-1",
185
- "9.0.1-2-gdeadbe1-2", "9.0.1-2-gdeadbe2-1",
186
- "9.1.1-2-g1234567-1", "9.1.2-2-g1234567-1",
187
- "10.0.0-1-gabcdef3-1", "10.5.7-2-g21353f0-1",
188
- "10.20.2-2-gbbbbbbb-1", "10.20.2-3-gaaaaaaa-1"
189
- ]
190
- end # describe
@@ -1,138 +0,0 @@
1
- #
2
- # Author:: Seth Chisamore (<schisamo@chef.io>)
3
- # Copyright:: Copyright (c) 2013 Opscode, Inc.
4
- # License:: Apache License, Version 2.0
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- require "spec_helper"
20
-
21
- describe Mixlib::Versioning::Format::OpscodeSemVer do
22
- subject { described_class.new(version_string) }
23
-
24
- it_should_behave_like Mixlib::Versioning::Format::SemVer
25
-
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",
39
- }
40
-
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",
46
- ]
47
-
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" }
81
- end # it_has_behavior
82
-
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
130
- end # it_has_behavior
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
- ]
138
- end # describe
@@ -1,121 +0,0 @@
1
- #
2
- # Author:: Seth Chisamore (<schisamo@chef.io>)
3
- # Author:: Ryan Hass (<rhass@chef.io>)
4
- # Copyright:: Copyright (c) 2017 Chef Software Inc.
5
- # License:: Apache License, Version 2.0
6
- #
7
- # Licensed under the Apache License, Version 2.0 (the "License");
8
- # you may not use this file except in compliance with the License.
9
- # You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS,
15
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- # See the License for the specific language governing permissions and
17
- # limitations under the License.
18
- #
19
-
20
- require "spec_helper"
21
-
22
- describe Mixlib::Versioning::Format::PartialSemVer do
23
- subject { described_class.new(version_string) }
24
-
25
- it_has_behavior "serializable", [
26
- "1",
27
- "12",
28
- "1.2",
29
- "1.23",
30
- "12.3",
31
- "12.34",
32
- ]
33
-
34
- it_has_behavior "sortable" do
35
- let(:unsorted_version_strings) do
36
- %w{
37
- 2
38
- 1.1
39
- 1
40
- 1.0
41
- 2.0
42
- 1.2
43
- }
44
- end
45
- let(:sorted_version_strings) do
46
- %w{
47
- 1
48
- 1.0
49
- 1.1
50
- 1.2
51
- 2
52
- 2.0
53
- }
54
- end
55
- let(:min) { "1" }
56
- let(:max) { "2.0" }
57
- end # it_has_behavior
58
-
59
- it_has_behavior "filterable" do
60
- let(:unsorted_version_strings) do
61
- %w{
62
- 2
63
- 1.1
64
- 1
65
- 1.0
66
- 2.0
67
- 1.2
68
- 12.0
69
- 12
70
- }
71
- end
72
- let(:release_versions) do
73
- %w{
74
- 2.0
75
- 1.1
76
- 1.0
77
- 1.0
78
- 2.0
79
- 1.2
80
- 12.0
81
- 12.0
82
- }
83
- end
84
- end # it_has_behavior
85
-
86
- it_has_behavior "comparable", [
87
- "1", "2",
88
- "1", "1.1",
89
- "1.1", "2",
90
- "1.1", "1.2"
91
- ]
92
-
93
- it_has_behavior "comparable_types", [
94
- "0.1", { value: "1.0.0.pre.1", class: Mixlib::Versioning::Format::Rubygems },
95
- "0.1", { value: "1.0.0-rc.1", class: Mixlib::Versioning::Format::OpscodeSemVer },
96
- "1", { value: "1.0.1", class: Mixlib::Versioning::Format::Rubygems },
97
- "1", { value: "1.0.1", class: Mixlib::Versioning::Format::SemVer },
98
- "1", { value: "1.0.1", class: Mixlib::Versioning::Format::OpscodeSemVer },
99
- "1", { value: "1.0.0-1-gdeadbee-1", class: Mixlib::Versioning::Format::GitDescribe },
100
- "1", { value: "2.0.0", class: Mixlib::Versioning::Format::Rubygems },
101
- "1", { value: "2.0.0", class: Mixlib::Versioning::Format::SemVer },
102
- "1", { value: "2.0.0-rc.1", class: Mixlib::Versioning::Format::OpscodeSemVer },
103
- "1", { value: "2.0.0-1-gdeadbee-1", class: Mixlib::Versioning::Format::GitDescribe },
104
- "1", { value: "1.1.0", class: Mixlib::Versioning::Format::Rubygems },
105
- "1", { value: "1.1.0", class: Mixlib::Versioning::Format::SemVer },
106
- "1", { value: "1.1.0", class: Mixlib::Versioning::Format::OpscodeSemVer },
107
- "1", { value: "1.1.0-1-gdeadbee-1", class: Mixlib::Versioning::Format::GitDescribe },
108
- "1.1", { value: "1.1.1", class: Mixlib::Versioning::Format::Rubygems },
109
- "1.1", { value: "1.1.1", class: Mixlib::Versioning::Format::SemVer },
110
- "1.1", { value: "1.1.1", class: Mixlib::Versioning::Format::OpscodeSemVer },
111
- "1.1", { value: "1.1.1-1-gdeadbee-1", class: Mixlib::Versioning::Format::GitDescribe },
112
- "1.1", { value: "2.0.0", class: Mixlib::Versioning::Format::Rubygems },
113
- "1.1", { value: "2.0.0", class: Mixlib::Versioning::Format::SemVer },
114
- "1.1", { value: "2.0.0", class: Mixlib::Versioning::Format::OpscodeSemVer },
115
- "1.1", { value: "2.0.0-1-gdeadbee-1", class: Mixlib::Versioning::Format::GitDescribe },
116
- "1.1", { value: "1.2.0", class: Mixlib::Versioning::Format::Rubygems },
117
- "1.1", { value: "1.2.0", class: Mixlib::Versioning::Format::SemVer },
118
- "1.1", { value: "1.2.0", class: Mixlib::Versioning::Format::OpscodeSemVer },
119
- "1.1", { value: "1.2.0-1-gdeadbee-1", class: Mixlib::Versioning::Format::GitDescribe }
120
- ]
121
- end # describe