mixlib-versioning 1.2.2 → 1.2.7

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.
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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: '0208c6f3c08a6daab946c9930940f32bc430c5c9'
4
- data.tar.gz: c17a6961d49ee42ae3af96c6bfb7532af19d28de
2
+ SHA256:
3
+ metadata.gz: 9f4a38de50dd107f8a38a16610e8fa9ca474a2c69786ca0631d0e5d057acf506
4
+ data.tar.gz: a4829689e5a6bc004698a98be2eda4bd59d0182cdc7f4dfd17665aae00a4ec4a
5
5
  SHA512:
6
- metadata.gz: 1818dc4222c4dfd7cff6ed49365d6fb0ecbf973020358b9a1e5b6b2da342e65ad2e7ec5901a94fb01344e690539f6bda0646bdb6ab0e96dd9eb0979d273c1a5a
7
- data.tar.gz: da88326f791927d45b25d1b16855c58151ff9c2de4bdd77edcf71c5794ab1d91367ee51824ac91fbe02af4768cf61a7f09b553b785de2210d212292f4d192d3c
6
+ metadata.gz: de0add6de7d29651272fd895c4a4d9ecd573f97026c4ae995bb25439df3ddb099b546d8e6e5fcc9f8495bac59de436af3c5b448fd2b1a685aaef221a055c59c3
7
+ data.tar.gz: 7d0677e7f9d756e54b0920a73eea3edd5f1732c7d7dd3e7a7ebaccddd9290a363ecd0d90fee11e849ef8b47b38974736124dd17bc188e1ada4b4aea201839349
@@ -1,8 +1,7 @@
1
1
  #
2
2
  # Author:: Seth Chisamore (<schisamo@chef.io>)
3
3
  # Author:: Christopher Maier (<cm@chef.io>)
4
- # Copyright:: Copyright (c) 2013 Opscode, Inc.
5
- # Copyright:: Copyright (c) 2017 Chef Software Inc.
4
+ # Copyright:: Copyright (c) 2013-2018 Chef Software Inc.
6
5
  # License:: Apache License, Version 2.0
7
6
  #
8
7
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Seth Chisamore (<schisamo@chef.io>)
3
- # Copyright:: Copyright (c) 2013 Opscode, Inc.
3
+ # Copyright:: Copyright (c) 2013-2018 Chef Software, Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,7 +1,6 @@
1
1
  #
2
2
  # Author:: Seth Chisamore (<schisamo@chef.io>)
3
- # Copyright:: Copyright (c) 2013 Opscode, Inc.
4
- # Copyright:: Copyright (c) 2017 Chef Software Inc.
3
+ # Copyright:: Copyright (c) 2013-2018 Chef Software, Inc.
5
4
  # License:: Apache License, Version 2.0
6
5
  #
7
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -329,7 +328,7 @@ module Mixlib
329
328
  # Now we need to compare appropriately based on type.
330
329
  #
331
330
  # Numbers have lower precedence than strings; therefore, if
332
- # the components are of differnt types (String vs. Integer),
331
+ # the components are of different types (String vs. Integer),
333
332
  # we just return -1 for the numeric one and we're done.
334
333
  #
335
334
  # If both are the same type (Integer vs. Integer, or String
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # Author:: Seth Chisamore (<schisamo@chef.io>)
3
3
  # Author:: Christopher Maier (<cm@chef.io>)
4
- # Copyright:: Copyright (c) 2013 Opscode, Inc.
4
+ # Copyright:: Copyright (c) 2013-2018 Chef Software, Inc.
5
5
  # License:: Apache License, Version 2.0
6
6
  #
7
7
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # Author:: Seth Chisamore (<schisamo@chef.io>)
3
3
  # Author:: Christopher Maier (<cm@chef.io>)
4
- # Copyright:: Copyright (c) 2013 Opscode, Inc.
4
+ # Copyright:: Copyright (c) 2013-2018 Chef Software, Inc.
5
5
  # License:: Apache License, Version 2.0
6
6
  #
7
7
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -2,7 +2,7 @@
2
2
  # Author:: Seth Chisamore (<schisamo@chef.io>)
3
3
  # Author:: Christopher Maier (<cm@chef.io>)
4
4
  # Author:: Ryan Hass (<rhass@chef.io>)
5
- # Copyright:: Copyright (c) 2017 Chef Software Inc.
5
+ # Copyright:: Copyright (c) 2017-2018 Chef Software Inc.
6
6
  # License:: Apache License, Version 2.0
7
7
  #
8
8
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # Author:: Seth Chisamore (<schisamo@chef.io>)
3
3
  # Author:: Christopher Maier (<cm@chef.io>)
4
- # Copyright:: Copyright (c) 2013 Opscode, Inc.
4
+ # Copyright:: Copyright (c) 2013-2018 Chef Software, Inc.
5
5
  # License:: Apache License, Version 2.0
6
6
  #
7
7
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # Author:: Seth Chisamore (<schisamo@chef.io>)
3
3
  # Author:: Christopher Maier (<cm@chef.io>)
4
- # Copyright:: Copyright (c) 2013 Opscode, Inc.
4
+ # Copyright:: Copyright (c) 2013-2018 Chef Software, Inc.
5
5
  # License:: Apache License, Version 2.0
6
6
  #
7
7
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Seth Chisamore (<schisamo@chef.io>)
3
- # Copyright:: Copyright (c) 2013 Opscode, Inc.
3
+ # Copyright:: Copyright (c) 2013-2018 Chef Software, Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,6 +18,6 @@
18
18
 
19
19
  module Mixlib
20
20
  class Versioning
21
- VERSION = "1.2.2"
21
+ VERSION = "1.2.7"
22
22
  end
23
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mixlib-versioning
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seth Chisamore
@@ -9,28 +9,16 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-07-27 00:00:00.000000000 Z
12
+ date: 2018-12-18 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: General purpose Ruby library that allows you to parse, compare and manipulate
15
15
  version strings in multiple formats.
16
- email:
17
- - schisamo@chef.io
18
- - cm@chef.io
16
+ email: info@chef.io
19
17
  executables: []
20
18
  extensions: []
21
19
  extra_rdoc_files: []
22
20
  files:
23
- - ".expeditor/config.yml"
24
- - ".expeditor/update_version.sh"
25
- - ".github/CODEOWNERS"
26
- - ".gitignore"
27
- - ".travis.yml"
28
- - CHANGELOG.md
29
- - Gemfile
30
21
  - LICENSE
31
- - README.md
32
- - Rakefile
33
- - VERSION
34
22
  - lib/mixlib/versioning.rb
35
23
  - lib/mixlib/versioning/exceptions.rb
36
24
  - lib/mixlib/versioning/format.rb
@@ -40,27 +28,9 @@ files:
40
28
  - lib/mixlib/versioning/format/rubygems.rb
41
29
  - lib/mixlib/versioning/format/semver.rb
42
30
  - lib/mixlib/versioning/version.rb
43
- - mixlib-versioning.gemspec
44
- - spec/mixlib/versioning/format/git_describe_spec.rb
45
- - spec/mixlib/versioning/format/opscode_semver_spec.rb
46
- - spec/mixlib/versioning/format/partial_semver_spec.rb
47
- - spec/mixlib/versioning/format/rubygems_spec.rb
48
- - spec/mixlib/versioning/format/semver_spec.rb
49
- - spec/mixlib/versioning/format_spec.rb
50
- - spec/mixlib/versioning/versioning_spec.rb
51
- - spec/spec_helper.rb
52
- - spec/support/shared_examples/basic_semver.rb
53
- - spec/support/shared_examples/behaviors/comparable.rb
54
- - spec/support/shared_examples/behaviors/comparable_types.rb
55
- - spec/support/shared_examples/behaviors/filterable.rb
56
- - spec/support/shared_examples/behaviors/parses_valid_version_strings.rb
57
- - spec/support/shared_examples/behaviors/rejects_invalid_version_strings.rb
58
- - spec/support/shared_examples/behaviors/serializable.rb
59
- - spec/support/shared_examples/behaviors/sortable.rb
60
- - spec/support/shared_examples/semver.rb
61
31
  homepage: https://github.com/chef/mixlib-versioning
62
32
  licenses:
63
- - Apache 2.0
33
+ - Apache-2.0
64
34
  metadata: {}
65
35
  post_install_message:
66
36
  rdoc_options: []
@@ -78,26 +48,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
78
48
  version: '0'
79
49
  requirements: []
80
50
  rubyforge_project:
81
- rubygems_version: 2.6.11
51
+ rubygems_version: 2.7.6
82
52
  signing_key:
83
53
  specification_version: 4
84
54
  summary: General purpose Ruby library that allows you to parse, compare and manipulate
85
55
  version strings in multiple formats.
86
- test_files:
87
- - spec/mixlib/versioning/format/git_describe_spec.rb
88
- - spec/mixlib/versioning/format/opscode_semver_spec.rb
89
- - spec/mixlib/versioning/format/partial_semver_spec.rb
90
- - spec/mixlib/versioning/format/rubygems_spec.rb
91
- - spec/mixlib/versioning/format/semver_spec.rb
92
- - spec/mixlib/versioning/format_spec.rb
93
- - spec/mixlib/versioning/versioning_spec.rb
94
- - spec/spec_helper.rb
95
- - spec/support/shared_examples/basic_semver.rb
96
- - spec/support/shared_examples/behaviors/comparable.rb
97
- - spec/support/shared_examples/behaviors/comparable_types.rb
98
- - spec/support/shared_examples/behaviors/filterable.rb
99
- - spec/support/shared_examples/behaviors/parses_valid_version_strings.rb
100
- - spec/support/shared_examples/behaviors/rejects_invalid_version_strings.rb
101
- - spec/support/shared_examples/behaviors/serializable.rb
102
- - spec/support/shared_examples/behaviors/sortable.rb
103
- - spec/support/shared_examples/semver.rb
56
+ test_files: []
@@ -1,14 +0,0 @@
1
- slack:
2
- notify_channel: eng-services-alerts
3
-
4
- github:
5
- maintainer_group: chef/engineering-services
6
- version_tag_format: v{{version}}
7
-
8
- merge_actions:
9
- built_in:bump_version:
10
- ignore_labels: "Version: Skip Bump"
11
- bash:.expeditor/update_version.sh:
12
- only_if: built_in:bump_version
13
- built_in:update_changelog:
14
- ignore_labels: "Changelog: Skip Update"
@@ -1,9 +0,0 @@
1
- #!/bin/bash
2
- #
3
- # After a PR merge, Chef Expeditor will bump the PATCH version in the VERSION file.
4
- # It then executes this file to update any other files/components with that new version.
5
- #
6
-
7
- set -evx
8
-
9
- sed -i -r "s/VERSION = \".+\"/VERSION = \"$(cat VERSION)\"/" lib/mixlib/versioning/version.rb
@@ -1,3 +0,0 @@
1
- # Order is important. The last matching pattern has the most precedence.
2
-
3
- * @chef/engineering-services
data/.gitignore DELETED
@@ -1,21 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- .rspec
7
- .yardopts
8
- Gemfile.lock
9
- InstalledFiles
10
- _yardoc
11
- coverage
12
- doc/
13
- lib/bundler/man
14
- pkg
15
- rdoc
16
- spec/reports
17
- test/tmp
18
- test/version_tmp
19
- tmp
20
- bin/
21
- Gemfile.local
@@ -1,28 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- cache: bundler
4
-
5
- matrix:
6
- include:
7
- - rvm: 2.0
8
- - rvm: 2.2
9
- - rvm: 2.3
10
- - rvm: 2.4.1
11
- - rvm: ruby-head
12
- allow_failures:
13
- - rvm: ruby-head
14
-
15
- branches:
16
- only:
17
- - master
18
-
19
- bundler_args: --without changelog
20
-
21
- before_install:
22
- - gem install bundler
23
- - bundle --version
24
- - gem update --system
25
- - gem --version
26
-
27
- script:
28
- - bundle exec rake travis:ci
@@ -1,30 +0,0 @@
1
- # Mixlib::Versioning Changes
2
-
3
- <!-- latest_release -->
4
- ## [v1.2.2](https://github.com/chef/mixlib-versioning/tree/v1.2.2) (2017-07-27)
5
-
6
- #### Merged Pull Requests
7
- - Support older rubies [#27](https://github.com/chef/mixlib-versioning/pull/27) ([schisamo](https://github.com/schisamo))
8
- <!-- latest_release -->
9
-
10
- ## [v1.2.1](https://github.com/chef/mixlib-versioning/tree/v1.2.1) (2017-07-24)
11
-
12
- #### Merged Pull Requests
13
- - Use Expeditor for version bumping and CHANGELOG generation [#23](https://github.com/chef/mixlib-versioning/pull/23) ([schisamo](https://github.com/schisamo))
14
-
15
- ## [1.1.0](https://github.com/chef/mixlib-versioning/tree/v1.1.0) (2015-06-15)
16
-
17
- #### New features
18
-
19
- * Allow parse to take a list of formats to choose from
20
- * Update to SemVer 2.0.0
21
-
22
- #### Improvements
23
-
24
- * Add ability to compare directly with strings.
25
- * Lock to RuboCop 0.31.0 (also fix style errors)
26
-
27
-
28
- ## [1.0.0](https://github.com/chef/mixlib-versioning/tree/v1.0.0) (2013-03-29)
29
-
30
- * The initial release. Versioning parsing shouldn't suck.
data/Gemfile DELETED
@@ -1,26 +0,0 @@
1
- source "https://rubygems.org"
2
- gemspec
3
-
4
- group :docs do
5
- gem "yard", "~> 0.8"
6
- gem "redcarpet", "~> 2.2"
7
- gem "github-markup", "~> 0.7"
8
- end
9
-
10
- group :test, :development do
11
- gem "rspec", "~> 3.0"
12
- gem "rspec-its"
13
- gem "rake", "~> 12"
14
- end
15
-
16
- if RUBY_VERSION =~ /^2/
17
- group :chefstyle do
18
- gem "chefstyle"
19
- end
20
- end
21
-
22
- instance_eval(ENV["GEMFILE_MOD"]) if ENV["GEMFILE_MOD"]
23
-
24
- # If you want to load debugging tools into the bundle exec sandbox,
25
- # add these additional dependencies into Gemfile.local
26
- eval(IO.read(__FILE__ + ".local"), binding) if File.exist?(__FILE__ + ".local")
data/README.md DELETED
@@ -1,377 +0,0 @@
1
- # Mixlib::Versioning
2
-
3
- [![Build Status](https://travis-ci.org/chef/mixlib-versioning.svg?branch=master)](https://travis-ci.org/chef/mixlib-versioning) [![Code Climate](https://codeclimate.com/github/chef/mixlib-versioning.svg)](https://codeclimate.com/github/chef/mixlib-versioning)
4
-
5
- This project is managed by the CHEF Release Engineering team. For more information on the Release Engineering team's contribution, triage, and release process, please consult the [CHEF Release Engineering OSS Management Guide](https://docs.google.com/a/chef.io/document/d/1oJB0vZb_3bl7_ZU2YMDBkMFdL-EWplW1BJv_FXTUOzg/edit).
6
-
7
- Versioning is hard! `mixlib-versioning` is a general Ruby library that allows you to parse, compare and manipulate version numbers in multiple formats. Currently the following version string formats are supported:
8
-
9
- ## SemVer 2.0.0
10
-
11
- **Specification:**
12
-
13
- <http://semver.org/>
14
-
15
- **Supported Formats:**
16
-
17
- ```text
18
- MAJOR.MINOR.PATCH
19
- MAJOR.MINOR.PATCH-PRERELEASE
20
- MAJOR.MINOR.PATCH-PRERELEASE+BUILD
21
- ```
22
-
23
- Not much to say here except: _YUNO USE SEMVER!_ The specification is focused and brief, do yourself a favor and go read it.
24
-
25
- ## Opscode SemVer
26
-
27
- **Supported Formats:**
28
-
29
- ```text
30
- MAJOR.MINOR.PATCH
31
- MAJOR.MINOR.PATCH-alpha.INDEX
32
- MAJOR.MINOR.PATCH-beta.INDEX
33
- MAJOR.MINOR.PATCH-rc.INDEX
34
- MAJOR.MINOR.PATCH-alpha.INDEX+YYYYMMDDHHMMSS
35
- MAJOR.MINOR.PATCH-beta.INDEX+YYYYMMDDHHMMSS
36
- MAJOR.MINOR.PATCH-rc.INDEX+YYYYMMDDHHMMSS
37
- MAJOR.MINOR.PATCH-alpha.INDEX+YYYYMMDDHHMMSS.git.COMMITS_SINCE.SHA1
38
- MAJOR.MINOR.PATCH-beta.INDEX+YYYYMMDDHHMMSS.git.COMMITS_SINCE.SHA1
39
- MAJOR.MINOR.PATCH-rc.INDEX+YYYYMMDDHHMMSS.git.COMMITS_SINCE.SHA1
40
- ```
41
-
42
- All the fun of regular SemVer with some extra limits around what constitutes a valid pre-release or build version string.
43
-
44
- Valid prerelease version strings use the format: `PRERELEASE_STAGE.INDEX`. Valid prerelease stages include: `alpha`, `beta` and `rc`.
45
-
46
- All of the following are acceptable Opscode SemVer pre-release versions:
47
-
48
- ```text
49
- 11.0.8-alpha.0
50
- 11.0.8-alpha.1
51
- 11.0.8-beta.7
52
- 11.0.8-beta.8
53
- 11.0.8-rc.1
54
- 11.0.8-rc.2
55
- ```
56
-
57
- Build version strings are limited to timestamps (`YYYYMMDDHHMMSS`), git describe strings (`git.COMMITS_SINCE.SHA1`) or a combination of the two (`YYYYMMDDHHMMSS.git.COMMITS_SINCE.SHA1`).
58
-
59
- All of the following are acceptable Opscode build versions:
60
-
61
- ```text
62
- 11.0.8+20130308110833
63
- 11.0.8+git.2.g94a1dde
64
- 11.0.8+20130308110833.git.2.94a1dde
65
- ```
66
-
67
- And as is true with regular SemVer you can mix pre-release and build versions:
68
-
69
- ```text
70
- 11.0.8-rc.1+20130308110833
71
- 11.0.8-alpha.2+20130308110833.git.2.94a1dde
72
- ```
73
-
74
- ## Rubygems
75
-
76
- **specification:**
77
-
78
- <http://docs.rubygems.org/read/chapter/7>
79
-
80
- <http://guides.rubygems.org/patterns/>
81
-
82
- **Supported Formats:**
83
-
84
- ```text
85
- MAJOR.MINOR.PATCH
86
- MAJOR.MINOR.PATCH.PRERELEASE
87
- ```
88
-
89
- Rubygems is _almost_ SemVer compliant but it separates the main version from the pre-release version using a "dot". It also does not have the notion of a build version like SemVer.
90
-
91
- Examples of valid Rubygems version strings:
92
-
93
- ```text
94
- 10.1.1
95
- 10.1.1
96
- 10.1.1.alpha.1
97
- 10.1.1.beta.1
98
- 10.1.1.rc.0
99
- ```
100
-
101
- ## Git Describe
102
-
103
- **Specification:**
104
-
105
- <http://git-scm.com/docs/git-describe>
106
-
107
- **Supported Formats:**
108
-
109
- ```text
110
- MAJOR.MINOR.PATCH-COMMITS_SINCE-gGIT_SHA1
111
- MAJOR.MINOR.PATCH-COMMITS_SINCE-gGIT_SHA1-ITERATION
112
- MAJOR.MINOR.PATCH-PRERELEASE-COMMITS_SINCE-gGIT_SHA1
113
- MAJOR.MINOR.PATCH-PRERELEASE-COMMITS_SINCE-gGIT_SHA1-ITERATION
114
- ```
115
-
116
- Examples of valid Git Describe version strings:
117
-
118
- ```text
119
- 10.16.2-49-g21353f0-1
120
- 10.16.2.rc.1-49-g21353f0-1
121
- 11.0.0-alpha-10-g642ffed
122
- 11.0.0-alpha.1-1-gcea071e
123
- ```
124
-
125
-
126
- ## SemVer Partial
127
-
128
-
129
- ```text
130
- MAJOR
131
- MAJOR.MINOR
132
- ```
133
-
134
- Examples of valid SemVer Partial version strings:
135
-
136
- ```text
137
- 1
138
- 0.1
139
- 1.0
140
- ```
141
-
142
- ## Installation
143
-
144
- Add this line to your application's Gemfile:
145
-
146
- ```
147
- gem 'mixlib-versioning'
148
- ```
149
-
150
- And then execute:
151
-
152
- ```
153
- $ bundle
154
- ```
155
-
156
- Or install it yourself as:
157
-
158
- ```
159
- $ gem install mixlib-semver
160
- ```
161
-
162
- ## Usage
163
-
164
- ### Basic Version String Parsing
165
-
166
- ```irb
167
- >> require 'mixlib/versioning'
168
- true
169
- >> v1 = Mixlib::Versioning.parse("11.0.3")
170
- #<Mixlib::Versioning::Format::OpscodeSemVer:0x3fecddccff4c @major=11, @minor=0, @patch=3, @prerelease=nil, @build=nil, @input="11.0.3">
171
- >> v1.release?
172
- true
173
- >> v1.prerelease?
174
- false
175
- >> v1.build?
176
- false
177
- >> v1.prerelease_build?
178
- false
179
- >> v2 = Mixlib::Versioning.parse("11.0.0-beta.1")
180
- #<Mixlib::Versioning::Format::OpscodeSemVer:0x3fecde44f420 @major=11, @minor=0, @patch=0, @prerelease="beta.1", @build=nil, @input="11.0.0-beta.1">
181
- >> v2.release?
182
- false
183
- >> v2.prerelease?
184
- true
185
- >> v2.build?
186
- false
187
- >> v2.prerelease_build?
188
- false
189
- >> v3 = Mixlib::Versioning.parse("11.0.6+20130216075209")
190
- #<Mixlib::Versioning::Format::OpscodeSemVer:0x3fecde49568c @major=11, @minor=0, @patch=6, @prerelease=nil, @build="20130216075209", @input="11.0.6+20130216075209">
191
- >> v3.release?
192
- false
193
- >> v3.prerelease?
194
- false
195
- >> v3.build?
196
- true
197
- >> v3.prerelease_build?
198
- false
199
- >> v4 = Mixlib::Versioning.parse("11.0.8-rc.1+20130302083119")
200
- #<Mixlib::Versioning::Format::OpscodeSemVer:0x3fecde4dad7c @major=11, @minor=0, @patch=8, @prerelease="rc.1", @build="20130302083119", @input="11.0.8-rc.1+20130302083119">
201
- >> v4.release?
202
- false
203
- >> v4.prerelease?
204
- false
205
- >> v4.build?
206
- true
207
- >> v4.prerelease_build?
208
- true
209
- >> v5 = Mixlib::Versioning.parse("10.16.8.alpha.0")
210
- #<Mixlib::Versioning::Format::Rubygems:0x3fecde532bd0 @major=10, @minor=16, @patch=8, @prerelease="alpha.0", @iteration=0, @input="10.16.8.alpha.0">
211
- >> v5.major
212
- 10
213
- >> v5.minor
214
- 16
215
- >> v5.patch
216
- 8
217
- >> v5.prerelease
218
- "alpha.0"
219
- >> v5.release?
220
- false
221
- >> v5.prerelease?
222
- true
223
- ```
224
-
225
- ### Version Comparison and Sorting
226
-
227
- ```irb
228
- >> require 'mixlib/versioning'
229
- true
230
- >> v1 = Mixlib::Versioning.parse("11.0.0-beta.1")
231
- #<Mixlib::Versioning::Format::OpscodeSemVer:0x3ff009cd54e0 @major=11, @minor=0, @patch=0, @prerelease="beta.1", @build=nil, @input="11.0.0-beta.1">
232
- >> v2 = Mixlib::Versioning.parse("11.0.0-rc.1")
233
- #<Mixlib::Versioning::Format::OpscodeSemVer:0x3ff009d07260 @major=11, @minor=0, @patch=0, @prerelease="rc.1", @build=nil, @input="11.0.0-rc.1">
234
- >> v3 = Mixlib::Versioning.parse("11.0.0")
235
- #<Mixlib::Versioning::Format::OpscodeSemVer:0x3ff009d0d3cc @major=11, @minor=0, @patch=0, @prerelease=nil, @build=nil, @input="11.0.0">
236
- >> v1 < v2
237
- true
238
- >> v3 < v1
239
- false
240
- >> v1 == v2
241
- false
242
- >> [v3, v1, v2].sort
243
- [
244
- [0] #<Mixlib::Versioning::Format::OpscodeSemVer:0x3ff009cd54e0 @major=11, @minor=0, @patch=0, @prerelease="beta.1", @build=nil, @input="11.0.0-beta.1">,
245
- [1] #<Mixlib::Versioning::Format::OpscodeSemVer:0x3ff009d07260 @major=11, @minor=0, @patch=0, @prerelease="rc.1", @build=nil, @input="11.0.0-rc.1">,
246
- [2] #<Mixlib::Versioning::Format::OpscodeSemVer:0x3ff009d0d3cc @major=11, @minor=0, @patch=0, @prerelease=nil, @build=nil, @input="11.0.0">
247
- ]
248
- >> [v3, v1, v2].map { |v| v.to_s}.sort
249
- [
250
- [0] "11.0.0",
251
- [1] "11.0.0-beta.1",
252
- [2] "11.0.0-rc.1"
253
- ]
254
- ```
255
-
256
- ### Target Version Selection
257
-
258
- Basic usage:
259
-
260
- ```ruby
261
- >> require 'mixlib/versioning'
262
- true
263
- >> all_versions = %w{
264
- 11.0.0-alpha.1
265
- 11.0.0-alpha.1-1-gcea071e
266
- 11.0.0-alpha.3+20130103213604.git.11.3fe70b5
267
- 11.0.0-alpha.3+20130129075201.git.38.3332a80
268
- 11.0.0-alpha.3+20130130075202.git.38.3332a80
269
- 11.0.0-beta.0+20130131044557
270
- 11.0.0-beta.1+20130201023059.git.5.c9d3320
271
- 11.0.0-beta.2+20130201035911
272
- 11.0.0-beta.2+20130201191308.git.4.9aa4cb2
273
- 11.0.0-rc.1
274
- 11.0.0+20130204053034.git.1.1802643
275
- 11.0.4
276
- 11.0.6-alpha.0+20130208045134.git.2.298c401
277
- 11.0.6-alpha.0+20130214075209.git.11.5d72e1c
278
- 11.0.6-alpha.0+20130215075208.git.11.5d72e1c
279
- 11.0.6-rc.0
280
- 11.0.6
281
- 11.0.6+20130216075209
282
- 11.0.6+20130221075213
283
- 11.0.8-rc.1
284
- 11.0.8-rc.1+20130302083119
285
- 11.0.8-rc.1+20130304083118
286
- 11.0.8-rc.1+20130305083118
287
- 11.0.8-rc.1+20130305195925.git.2.94a1dde
288
- 11.0.8-rc.1+20130306083036.git.2.94a1dde
289
- 11.0.8-rc.1+20130319083111.git.6.dc8613e
290
- };''
291
- ""
292
- >> Mixlib::Versioning.find_target_version(all_versions, "11.0.6", false, false)
293
- #<Mixlib::Versioning::Format::OpscodeSemVer:0x3ffdc91364a4 @major=11, @minor=0, @patch=6, @prerelease=nil, @build=nil, @input="11.0.6">
294
- >> target = Mixlib::Versioning.find_target_version(all_versions, "11.0.6", false, false)
295
- #<Mixlib::Versioning::Format::OpscodeSemVer:0x3ffdc91364a4 @major=11, @minor=0, @patch=6, @prerelease=nil, @build=nil, @input="11.0.6">
296
- >> target.to_s
297
- "11.0.6"
298
- ```
299
-
300
- Select latest release version:
301
-
302
- ```irb
303
- >> target = Mixlib::Versioning.find_target_version(all_versions, nil, false, false)
304
- #<Mixlib::Versioning::Format::OpscodeSemVer:0x3ffdc91364a4 @major=11, @minor=0, @patch=6, @prerelease=nil, @build=nil, @input="11.0.6">
305
- >> target.to_s
306
- "11.0.6"
307
- ```
308
-
309
- Select latest pre-release version:
310
-
311
- ```irb
312
- >> target = Mixlib::Versioning.find_target_version(all_versions, nil, true, false)
313
- #<Mixlib::Versioning::Format::OpscodeSemVer:0x3ffdc9139078 @major=11, @minor=0, @patch=8, @prerelease="rc.1", @build=nil, @input="11.0.8-rc.1">
314
- >> target.to_s
315
- "11.0.8-rc.1"
316
- ```
317
-
318
- Select the latest release build version:
319
-
320
- ```irb
321
- >> target = Mixlib::Versioning.find_target_version(all_versions, nil, false, true)
322
- #<Mixlib::Versioning::Format::OpscodeSemVer:0x3ffdc91f0bb0 @major=11, @minor=0, @patch=6, @prerelease=nil, @build="20130221075213", @input="11.0.6+20130221075213">
323
- >> target.to_s
324
- "11.0.6+20130221075213"
325
- ```
326
-
327
- Select the latest pre-release build version:
328
-
329
- ```irb
330
- >> target = Mixlib::Versioning.find_target_version(all_versions, nil, true, true)
331
- #<Mixlib::Versioning::Format::OpscodeSemVer:0x3ffdc91f154c @major=11, @minor=0, @patch=8, @prerelease="rc.1", @build="20130319083111.git.6.dc8613e", @input="11.0.8-rc.1+20130319083111.git.6.dc8613e">
332
- >> target.to_s
333
- "11.0.8-rc.1+20130319083111.git.6.dc8613e"
334
- ```
335
-
336
- ## How to Run the Tests
337
-
338
- To run the unit tests, run
339
-
340
- ```
341
- rake spec
342
- ```
343
-
344
- ## Documentation
345
-
346
- All documentation is written using YARD. You can generate a by running:
347
-
348
- ```
349
- rake yard
350
- ```
351
-
352
- ## Contributing
353
-
354
- For information on contributing to this project see <https://github.com/chef/chef/blob/master/CONTRIBUTING.md>
355
-
356
- ## License
357
-
358
- | | |
359
- |:---------------------|:-----------------------------------------|
360
- | **Author:** | Seth Chisamore (schisamo@chef.io)
361
- | **Author:** | Christopher Maier (cm@chef.io)
362
- | **Copyright:** | Copyright (c) 2013-2017 Chef Software, Inc.
363
- | **License:** | Apache License, Version 2.0
364
-
365
- ```text
366
- Licensed under the Apache License, Version 2.0 (the "License");
367
- you may not use this file except in compliance with the License.
368
- You may obtain a copy of the License at
369
-
370
- http://www.apache.org/licenses/LICENSE-2.0
371
-
372
- Unless required by applicable law or agreed to in writing, software
373
- distributed under the License is distributed on an "AS IS" BASIS,
374
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
375
- See the License for the specific language governing permissions and
376
- limitations under the License.
377
- ```