versionaire 8.0.1 → 8.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c79d0a45805594ba63401cdcefe4378221a9792f218187619c48bfee60aa7a14
4
- data.tar.gz: c873a28ec96bf5bd56125772ea3e26458aaf5aebe069b4db93169d972d76b41d
3
+ metadata.gz: 0f0a4896401e4a8c4df94fe4ec19fabe7bbf6dc17b776fa7cd0eabb49de39f84
4
+ data.tar.gz: 4ad3d1ab406e3fa81c68bb2d0a09d0d59c2bb03cde9c0dba6039a38ec16cfae5
5
5
  SHA512:
6
- metadata.gz: '09209a0a888f5b8eefb9d28acdb9bb22464a8155ca70f1165790d955c2aa32a2d9d02f0232fbdc5d56231edd2c5562a0d65d73f760504110b00946f2729cafa3'
7
- data.tar.gz: 463e1bec546994e1924b66549d9bd90bf72bd00b362a611092598b0766f689638c61de9e04a2ed1a259a23e357bc696e68319cb4db2763b2ee7d4754451dae9e
6
+ metadata.gz: d6a72bbec222e02ce976ec42523e4300611b0c22a59f551cdc9c6ab21af9bf9d591f03a7dce52e3b738862f6f8de98ca2a333543f0ccc49f9489ed887e094d43
7
+ data.tar.gz: acdb7b4f11ac472ff3c555415b9a58732b16dfc43fbfb96cb99ba1ab414fb900ac12fb47f1db6c9a3c8d5ded5a4555b150ab2db11b228939a881d46f1e85e511
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,4 +1,4 @@
1
- # Apache License
1
+ = Apache License
2
2
 
3
3
  Version 2.0, January 2004
4
4
 
@@ -6,7 +6,7 @@ http://www.apache.org/licenses
6
6
 
7
7
  TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
8
 
9
- ## 1. Definitions
9
+ == 1. Definitions
10
10
 
11
11
  "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by
12
12
  Sections 1 through 9 of this document.
@@ -54,14 +54,14 @@ Contribution."
54
54
  "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a
55
55
  Contribution has been received by Licensor and subsequently incorporated within the Work.
56
56
 
57
- ## 2. Grant of Copyright License
57
+ == 2. Grant of Copyright License
58
58
 
59
59
  Subject to the terms and conditions of this License, each Contributor hereby grants to You a
60
60
  perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to
61
61
  reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and
62
62
  distribute the Work and such Derivative Works in Source or Object form.
63
63
 
64
- ## 3. Grant of Patent License
64
+ == 3. Grant of Patent License
65
65
 
66
66
  Subject to the terms and conditions of this License, each Contributor hereby grants to You a
67
67
  perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this
@@ -74,39 +74,38 @@ a Contribution incorporated within the Work constitutes direct or contributory p
74
74
  then any patent licenses granted to You under this License for that Work shall terminate as of the
75
75
  date such litigation is filed.
76
76
 
77
- ## 4. Redistribution
77
+ == 4. Redistribution
78
78
 
79
79
  You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with
80
80
  or without modifications, and in Source or Object form, provided that You meet the following
81
81
  conditions:
82
82
 
83
- 1. You must give any other recipients of the Work or Derivative Works a copy of this License; and
83
+ . You must give any other recipients of the Work or Derivative Works a copy of this License; and
84
84
 
85
- 2. You must cause any modified files to carry prominent notices stating that You changed the
86
- files; and
85
+ . You must cause any modified files to carry prominent notices stating that You changed the files;
86
+ and
87
87
 
88
- 3. You must retain, in the Source form of any Derivative Works that You distribute, all copyright,
89
- patent, trademark, and attribution notices from the Source form of the Work, excluding those
90
- notices that do not pertain to any part of the Derivative Works; and
88
+ . You must retain, in the Source form of any Derivative Works that You distribute, all copyright,
89
+ patent, trademark, and attribution notices from the Source form of the Work, excluding those
90
+ notices that do not pertain to any part of the Derivative Works; and
91
91
 
92
- 4. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative
93
- Works that You distribute must include a readable copy of the attribution notices contained
94
- within such NOTICE file, excluding those notices that do not pertain to any part of the
95
- Derivative Works, in at least one of the following places: within a NOTICE text file
96
- distributed as part of the Derivative Works; within the Source form or documentation, if
97
- provided along with the Derivative Works; or, within a display generated by the Derivative
98
- Works, if and wherever such third-party notices normally appear. The contents of the NOTICE
99
- file are for informational purposes only and do not modify the License. You may add Your own
100
- attribution notices within Derivative Works that You distribute, alongside or as an addendum to
101
- the NOTICE text from the Work, provided that such additional attribution notices cannot be
102
- construed as modifying the License.
92
+ . If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works
93
+ that You distribute must include a readable copy of the attribution notices contained within such
94
+ NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in
95
+ at least one of the following places: within a NOTICE text file distributed as part of the
96
+ Derivative Works; within the Source form or documentation, if provided along with the Derivative
97
+ Works; or, within a display generated by the Derivative Works, if and wherever such third-party
98
+ notices normally appear. The contents of the NOTICE file are for informational purposes only and
99
+ do not modify the License. You may add Your own attribution notices within Derivative Works that
100
+ You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such
101
+ additional attribution notices cannot be construed as modifying the License.
103
102
 
104
103
  You may add Your own copyright statement to Your modifications and may provide additional or
105
104
  different license terms and conditions for use, reproduction, or distribution of Your modifications,
106
105
  or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of
107
106
  the Work otherwise complies with the conditions stated in this License.
108
107
 
109
- ## 5. Submission of Contributions
108
+ == 5. Submission of Contributions
110
109
 
111
110
  Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the
112
111
  Work by You to the Licensor shall be under the terms and conditions of this License, without any
@@ -114,13 +113,13 @@ additional terms or conditions. Notwithstanding the above, nothing herein shall
114
113
  the terms of any separate license agreement you may have executed with Licensor regarding such
115
114
  Contributions.
116
115
 
117
- ## 6. Trademarks
116
+ == 6. Trademarks
118
117
 
119
118
  This License does not grant permission to use the trade names, trademarks, service marks, or product
120
119
  names of the Licensor, except as required for reasonable and customary use in describing the origin
121
120
  of the Work and reproducing the content of the NOTICE file.
122
121
 
123
- ## 7. Disclaimer of Warranty
122
+ == 7. Disclaimer of Warranty
124
123
 
125
124
  Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each
126
125
  Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -129,7 +128,7 @@ TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. Y
129
128
  responsible for determining the appropriateness of using or redistributing the Work and assume any
130
129
  risks associated with Your exercise of permissions under this License.
131
130
 
132
- ## 8. Limitation of Liability
131
+ == 8. Limitation of Liability
133
132
 
134
133
  In no event and under no legal theory, whether in tort (including negligence), contract, or
135
134
  otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or
@@ -139,7 +138,7 @@ License or out of the use or inability to use the Work (including but not limite
139
138
  loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial
140
139
  damages or losses), even if such Contributor has been advised of the possibility of such damages.
141
140
 
142
- ## 9. Accepting Warranty or Additional Liability
141
+ == 9. Accepting Warranty or Additional Liability
143
142
 
144
143
  While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee
145
144
  for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights
@@ -151,11 +150,11 @@ additional liability.
151
150
 
152
151
  END OF TERMS AND CONDITIONS
153
152
 
154
- Copyright 2016 [Alchemists](https://www.alchemists.io).
153
+ Copyright 2016 link:https://www.alchemists.io/team/brooke_kuhlmann[Brooke Kuhlmann].
155
154
 
156
155
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
157
- compliance with the License. You may obtain a [copy](http://www.apache.org/licenses/LICENSE-2.0) of
158
- the License.
156
+ compliance with the License. You may obtain a link:https://www.apache.org/licenses/LICENSE-2.0[copy]
157
+ of the License.
159
158
 
160
159
  Unless required by applicable law or agreed to in writing, software distributed under the License is
161
160
  distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
@@ -0,0 +1,277 @@
1
+ :toc: macro
2
+ :toclevels: 5
3
+ :figure-caption!:
4
+
5
+ = Versionaire
6
+
7
+ [link=http://badge.fury.io/rb/versionaire]
8
+ image::https://badge.fury.io/rb/versionaire.svg[Gem Version]
9
+ [link=https://www.alchemists.io/projects/code_quality]
10
+ image::https://img.shields.io/badge/code_style-alchemists-brightgreen.svg[Alchemists Style Guide]
11
+ [link=https://circleci.com/gh/bkuhlmann/versionaire]
12
+ image::https://circleci.com/gh/bkuhlmann/versionaire.svg?style=svg[Circle CI Status]
13
+
14
+ Provides an immutable, thread-safe, and semantic version type when managing versions within your
15
+ applications.
16
+
17
+ toc::[]
18
+
19
+ == Features
20
+
21
+ * Provides https://semver.org[Semantic Versioning].
22
+ * Provides immutable, thread-safe version instances.
23
+ * Converts (casts) from a `String`, `Array`, `Hash`, or `Version` to a `Version`.
24
+
25
+ == Screencasts
26
+
27
+ [link=https://www.alchemists.io/screencasts/versionaire]
28
+ image::https://www.alchemists.io/images/screencasts/versionaire/cover.svg[Screencast,600,240,role=focal_point]
29
+
30
+ == Requirements
31
+
32
+ . https://www.ruby-lang.org[Ruby].
33
+
34
+ == Setup
35
+
36
+ To install, run:
37
+
38
+ [source,bash]
39
+ ----
40
+ gem install versionaire
41
+ ----
42
+
43
+ Add the following to your Gemfile:
44
+
45
+ [source,ruby]
46
+ ----
47
+ gem "versionaire"
48
+ ----
49
+
50
+ == Usage
51
+
52
+ === Initialization
53
+
54
+ A new version can be initialized in a variety of ways:
55
+
56
+ [source,ruby]
57
+ ----
58
+ Versionaire::Version.new # "0.0.0"
59
+ Versionaire::Version[major: 1] # "1.0.0"
60
+ Versionaire::Version[major: 1, minor: 2] # "1.2.0"
61
+ Versionaire::Version[major: 1, minor: 2, patch: 3] # "1.2.3"
62
+ ----
63
+
64
+ === Equality
65
+
66
+ ==== Value (`+#==+`)
67
+
68
+ Equality is deterimined by the state of the object. This means that a version is equal to another
69
+ version as long as all of the values (i.e. state) are equal to each other. Example:
70
+
71
+ [source,ruby]
72
+ ----
73
+ version_a = Versionaire::Version[major: 1]
74
+ version_b = Versionaire::Version[major: 2]
75
+ version_c = Versionaire::Version[major: 1]
76
+
77
+ version_a == version_a # true
78
+ version_a == version_b # false
79
+ version_a == version_c # true
80
+ ----
81
+
82
+ Knowning this, versions can be compared against one another too:
83
+
84
+ [source,ruby]
85
+ ----
86
+ version_a > version_b # false
87
+ version_a < version_b # true
88
+ version_a.between? version_c, version_b # true
89
+ ----
90
+
91
+ ==== Hash (`#eql?`)
92
+
93
+ Behaves exactly as `#==`.
94
+
95
+ ==== Case (`#===`)
96
+
97
+ Behaves exactly as `#==`.
98
+
99
+ ==== Identity (`#equal?`)
100
+
101
+ Works like any other standard Ruby object where an object is equal only to itself.
102
+
103
+ [source,ruby]
104
+ ----
105
+ version_a = Versionaire::Version[major: 1]
106
+ version_b = Versionaire::Version[major: 2]
107
+ version_c = Versionaire::Version[major: 1]
108
+
109
+ version_a.equal? version_a # true
110
+ version_a.equal? version_b # false
111
+ version_a.equal? version_c # false
112
+ ----
113
+
114
+ === Conversions
115
+
116
+ ==== Function
117
+
118
+ Use the `Versionaire::Version` function to explicitly cast to a version:
119
+
120
+ [source,ruby]
121
+ ----
122
+ version = Versionaire::Version[major: 1]
123
+
124
+ Versionaire::Version "1.0.0"
125
+ Versionaire::Version [1, 0, 0]
126
+ Versionaire::Version major: 1, minor: 0, patch: 0
127
+ Versionaire::Version version
128
+ ----
129
+
130
+ Each of these conversions will result in a version object that represents "`1.0.0`". When attempting
131
+ to convert an unsupported type, a `+Versionaire::Errors::Conversion+` exception will be thrown.
132
+
133
+ ==== Refinement
134
+
135
+ Building upon the examples shown above, there is an even more elegant solution where you can use
136
+ this gem's built-in link:https://www.alchemists.io/articles/ruby_refinements[refinement] support:
137
+
138
+ [source,ruby]
139
+ ----
140
+ using Versionaire::Cast
141
+
142
+ version = Versionaire::Version[major: 1]
143
+
144
+ Version "1.0.0"
145
+ Version [1, 0, 0]
146
+ Version major: 1, minor: 0, patch: 0
147
+ Version version
148
+ ----
149
+
150
+ By adding `using Versionaire::Cast` to your implementation, this allows Versionaire to refine
151
+ `Kernel` so you have a top-level `Version` conversion function much like Kernel's native support for
152
+ `Integer`, `String`, `Array`, `Hash`, etc. The benefit to this approach is it reduces the amount of
153
+ typing, doesn't polute your entire object space like a monkey patch would, and provides a idiomatic
154
+ approach to casting like any other primitive.
155
+
156
+ ==== Implicit
157
+
158
+ Implicit conversion to a `+String+` is supported:
159
+
160
+ [source,ruby]
161
+ ----
162
+ "1.0.0".match Versionaire::Version[major: 1] # <MatchData "1.0.0">
163
+ ----
164
+
165
+ ==== Explicit
166
+
167
+ Explicit conversion to a `String`, `Array`, or `Hash` is supported:
168
+
169
+ [source,ruby]
170
+ ----
171
+ version = Versionaire::Version.new
172
+
173
+ version.to_s # "0.0.0"
174
+ version.to_a # [0, 0, 0]
175
+ version.to_h # {major: 0, minor: 0, patch: 0}
176
+ ----
177
+
178
+ === Comparisons
179
+
180
+ All versions are comparable which means any of the operators from the `+Comparable+` module will
181
+ work. Example:
182
+
183
+ [source,ruby]
184
+ ----
185
+ version_1 = Versionaire::Version "1.0.0"
186
+ version_2 = Versionaire::Version "2.0.0"
187
+
188
+ version_1 < version_2 # true
189
+ version_1 <= version_2 # true
190
+ version_1 == version_2 # false (see Equality section above for details)
191
+ version_1 > version_2 # false
192
+ version_1 >= version_2 # false
193
+ version_1.between? version_1, version_2 # true
194
+ version_1.clamp version_1, version_2 # version_1 (added in Ruby 2.4.0)
195
+ ----
196
+
197
+ === Math
198
+
199
+ Versions can be added and subtracted from each other.
200
+
201
+ ==== Addition
202
+
203
+ [source,ruby]
204
+ ----
205
+ version_1 = Versionaire::Version[major: 1, minor: 2, patch: 3]
206
+ version_2 = Versionaire::Version[major: 2, minor: 5, patch: 7]
207
+ version_1 + version_2 # "3.7.10"
208
+ ----
209
+
210
+ ==== Subtraction
211
+
212
+ [source,ruby]
213
+ ----
214
+ version_1 = Versionaire::Version[major: 1, minor: 2, patch: 3]
215
+ version_2 = Versionaire::Version[major: 1, minor: 1, patch: 1]
216
+ version_1 - version_2 # "0.1.2"
217
+
218
+ version_1 = Versionaire::Version[major: 1]
219
+ version_2 = Versionaire::Version[major: 5]
220
+ version_1 - version_2 # Fails with a Versionaire::Errors::NegativeNumber
221
+ ----
222
+
223
+ == Development
224
+
225
+ To contribute, run:
226
+
227
+ [source,bash]
228
+ ----
229
+ git clone https://github.com/bkuhlmann/versionaire.git
230
+ cd versionaire
231
+ bin/setup
232
+ ----
233
+
234
+ You can also use the IRB console for direct access to all objects:
235
+
236
+ [source,bash]
237
+ ----
238
+ bin/console
239
+ ----
240
+
241
+ == Tests
242
+
243
+ To test, run:
244
+
245
+ [source,bash]
246
+ ----
247
+ bundle exec rake
248
+ ----
249
+
250
+ == Versioning
251
+
252
+ Read link:https://semver.org[Semantic Versioning] for details. Briefly, it means:
253
+
254
+ * Major (X.y.z) - Incremented for any backwards incompatible public API changes.
255
+ * Minor (x.Y.z) - Incremented for new, backwards compatible, public API enhancements/fixes.
256
+ * Patch (x.y.Z) - Incremented for small, backwards compatible, bug fixes.
257
+
258
+ == Code of Conduct
259
+
260
+ Please note that this project is released with a link:CODE_OF_CONDUCT.adoc[CODE OF CONDUCT]. By
261
+ participating in this project you agree to abide by its terms.
262
+
263
+ == Contributions
264
+
265
+ Read link:CONTRIBUTING.adoc[CONTRIBUTING] for details.
266
+
267
+ == License
268
+
269
+ Read link:LICENSE.adoc[LICENSE] for details.
270
+
271
+ == History
272
+
273
+ Read link:CHANGES.adoc[CHANGES] for details.
274
+
275
+ == Credits
276
+
277
+ Engineered by link:https://www.alchemists.io/team/brooke_kuhlmann[Brooke Kuhlmann].
@@ -8,3 +8,4 @@ require "versionaire/filler"
8
8
  require "versionaire/conversion"
9
9
  require "versionaire/identity"
10
10
  require "versionaire/version"
11
+ require "versionaire/cast"
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Versionaire
4
+ # Refines Kernel in order to provide a top-level Version conversion function.
5
+ module Cast
6
+ refine Kernel do
7
+ def Version object
8
+ Versionaire::Version object
9
+ end
10
+ end
11
+ end
12
+ end
@@ -5,7 +5,7 @@ module Versionaire
5
5
  # Thrown when not using numbers.
6
6
  class InvalidNumber < Base
7
7
  def initialize message = "Major, minor, and patch must be a number."
8
- super
8
+ super message
9
9
  end
10
10
  end
11
11
  end
@@ -5,7 +5,7 @@ module Versionaire
5
5
  # Thrown when numbers are negative.
6
6
  class NegativeNumber < Base
7
7
  def initialize message = "Major, minor, and patch must be a positive number."
8
- super
8
+ super message
9
9
  end
10
10
  end
11
11
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Versionaire
4
+ # Ensures an array can be filled to a certain size with default elements.
4
5
  class Filler
5
6
  def initialize pad = 0, max: 2
6
7
  @pad = pad
@@ -3,20 +3,9 @@
3
3
  module Versionaire
4
4
  # Gem identity information.
5
5
  module Identity
6
- def self.name
7
- "versionaire"
8
- end
9
-
10
- def self.label
11
- "Versionaire"
12
- end
13
-
14
- def self.version
15
- "8.0.1"
16
- end
17
-
18
- def self.version_label
19
- "#{label} #{version}"
20
- end
6
+ NAME = "versionaire"
7
+ LABEL = "Versionaire"
8
+ VERSION = "8.5.0"
9
+ VERSION_LABEL = "#{LABEL} #{VERSION}"
21
10
  end
22
11
  end
@@ -4,7 +4,6 @@ module Versionaire
4
4
  DELIMITER = "."
5
5
 
6
6
  # An immutable, semantic version value object.
7
- # rubocop:disable Metrics/BlockLength
8
7
  Version = Struct.new :major, :minor, :patch, keyword_init: true do
9
8
  include Comparable
10
9
 
@@ -70,5 +69,4 @@ module Versionaire
70
69
  to_a.zip(other.to_a).map { |pair| pair.reduce action }
71
70
  end
72
71
  end
73
- # rubocop:enable Metrics/BlockLength
74
72
  end
metadata CHANGED
@@ -1,18 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: versionaire
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.0.1
4
+ version: 8.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIC/jCCAeagAwIBAgIBAjANBgkqhkiG9w0BAQsFADAlMSMwIQYDVQQDDBpicm9v
14
- a2UvREM9YWxjaGVtaXN0cy9EQz1pbzAeFw0xOTAyMTcxNjAxMTFaFw0yMDAyMTcx
15
- NjAxMTFaMCUxIzAhBgNVBAMMGmJyb29rZS9EQz1hbGNoZW1pc3RzL0RDPWlvMIIB
13
+ MIIC/jCCAeagAwIBAgIBAzANBgkqhkiG9w0BAQsFADAlMSMwIQYDVQQDDBpicm9v
14
+ a2UvREM9YWxjaGVtaXN0cy9EQz1pbzAeFw0yMDAzMTUxNDQ1MzJaFw0yMTAzMTUx
15
+ NDQ1MzJaMCUxIzAhBgNVBAMMGmJyb29rZS9EQz1hbGNoZW1pc3RzL0RDPWlvMIIB
16
16
  IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6l1qpXTiomH1RfMRloyw7MiE
17
17
  xyVx/x8Yc3EupdH7uhNaTXQGyORN6aOY//1QXXMHIZ9tW74nZLhesWMSUMYy0XhB
18
18
  brs+KkurHnc9FnEJAbG7ebGvl/ncqZt72nQvaxpDxvuCBHgJAz+8i5wl6FhLw+oT
@@ -20,15 +20,15 @@ cert_chain:
20
20
  D5vkU0YlAm1r98BymuJlcQ1qdkVEI1d48ph4kcS0S0nv1RiuyVb6TCAR3Nu3VaVq
21
21
  3fPzZKJLZBx67UvXdbdicWPiUR75elI4PXpLIic3xytaF52ZJYyKZCNZJhNwfQID
22
22
  AQABozkwNzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU0nzow9vc
23
- 2CdikiiE3fJhP/gY4ggwDQYJKoZIhvcNAQELBQADggEBANgfX7kPZkJvsbdWMvbe
24
- DUUYxRTqTUzCDpLd2p3sQvgLMKjTNSKt6CFq/kh+98b6RCgO6DqiVfxvOEq02dvf
25
- ebMN/ylQqan2FgiAs1rpP0/D4C0MlBjoDktsT+2IyLol1KmkDB20ExJ4Sf1GRNdA
26
- hpWOtcgqHtmrc7xzgB6BuyoYufrKKUlCO3ewTM4C375D2qO7hIdKuMOO3CdPMtSk
27
- OrWpbzCL+nbbXqeoqiHgZaUvcyyQrGj5sQRxMTzuMXzzQxtHnuTuKrcz16HMTX/O
28
- dKvURM+1PwDCzC5tvRwjhUJIizau6+MtkFCvJHmaAj1aZL3odcPejHj5Hxt/0CUW
29
- y84=
23
+ 2CdikiiE3fJhP/gY4ggwDQYJKoZIhvcNAQELBQADggEBAIHhAlD3po4sTYqacXaQ
24
+ XI9jIhrfMy//2PgbHWcETtlJPBeNUbbSNBABcllUHKqYsVDlSvSmss034KSWNR8F
25
+ bF1GcloicyvcCC4y6IoW4it0COAcdeaaxkxiBSgKdQFpff9REnDlIKK4uQ9lLxIo
26
+ Y2G5xubiziKZkyfWFuSr67PIjW3Bu673D1JVBArhA1qbgQmYQcy1CkGOjo+iO8Nf
27
+ 7u/QSfBHb+r/bXhKscDgPpnKwbUmvgO2+94zJG9KsrmIydlzYfsD09aXKx0t6Xy4
28
+ 2XV8FRa7/JimI07sPLC13eLY3xd/aYTi85Z782KIA4j0G8XEEWAX0ouBhlXPocZv
29
+ QWc=
30
30
  -----END CERTIFICATE-----
31
- date: 2020-02-01 00:00:00.000000000 Z
31
+ date: 2020-12-04 00:00:00.000000000 Z
32
32
  dependencies:
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: bundler-audit
@@ -36,42 +36,56 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '0.6'
39
+ version: '0.7'
40
40
  type: :development
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '0.6'
46
+ version: '0.7'
47
+ - !ruby/object:Gem::Dependency
48
+ name: bundler-leak
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '0.2'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '0.2'
47
61
  - !ruby/object:Gem::Dependency
48
62
  name: gemsmith
49
63
  requirement: !ruby/object:Gem::Requirement
50
64
  requirements:
51
65
  - - "~>"
52
66
  - !ruby/object:Gem::Version
53
- version: '14.0'
67
+ version: '14.8'
54
68
  type: :development
55
69
  prerelease: false
56
70
  version_requirements: !ruby/object:Gem::Requirement
57
71
  requirements:
58
72
  - - "~>"
59
73
  - !ruby/object:Gem::Version
60
- version: '14.0'
74
+ version: '14.8'
61
75
  - !ruby/object:Gem::Dependency
62
- name: git-cop
76
+ name: git-lint
63
77
  requirement: !ruby/object:Gem::Requirement
64
78
  requirements:
65
79
  - - "~>"
66
80
  - !ruby/object:Gem::Version
67
- version: '4.0'
81
+ version: '1.3'
68
82
  type: :development
69
83
  prerelease: false
70
84
  version_requirements: !ruby/object:Gem::Requirement
71
85
  requirements:
72
86
  - - "~>"
73
87
  - !ruby/object:Gem::Version
74
- version: '4.0'
88
+ version: '1.3'
75
89
  - !ruby/object:Gem::Dependency
76
90
  name: guard-rspec
77
91
  requirement: !ruby/object:Gem::Requirement
@@ -92,28 +106,28 @@ dependencies:
92
106
  requirements:
93
107
  - - "~>"
94
108
  - !ruby/object:Gem::Version
95
- version: '0.12'
109
+ version: '0.13'
96
110
  type: :development
97
111
  prerelease: false
98
112
  version_requirements: !ruby/object:Gem::Requirement
99
113
  requirements:
100
114
  - - "~>"
101
115
  - !ruby/object:Gem::Version
102
- version: '0.12'
116
+ version: '0.13'
103
117
  - !ruby/object:Gem::Dependency
104
118
  name: pry-byebug
105
119
  requirement: !ruby/object:Gem::Requirement
106
120
  requirements:
107
121
  - - "~>"
108
122
  - !ruby/object:Gem::Version
109
- version: '3.7'
123
+ version: '3.9'
110
124
  type: :development
111
125
  prerelease: false
112
126
  version_requirements: !ruby/object:Gem::Requirement
113
127
  requirements:
114
128
  - - "~>"
115
129
  - !ruby/object:Gem::Version
116
- version: '3.7'
130
+ version: '3.9'
117
131
  - !ruby/object:Gem::Dependency
118
132
  name: rake
119
133
  requirement: !ruby/object:Gem::Requirement
@@ -134,56 +148,70 @@ dependencies:
134
148
  requirements:
135
149
  - - "~>"
136
150
  - !ruby/object:Gem::Version
137
- version: '5.6'
151
+ version: '6.0'
152
+ type: :development
153
+ prerelease: false
154
+ version_requirements: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - "~>"
157
+ - !ruby/object:Gem::Version
158
+ version: '6.0'
159
+ - !ruby/object:Gem::Dependency
160
+ name: refinements
161
+ requirement: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - "~>"
164
+ - !ruby/object:Gem::Version
165
+ version: '7.16'
138
166
  type: :development
139
167
  prerelease: false
140
168
  version_requirements: !ruby/object:Gem::Requirement
141
169
  requirements:
142
170
  - - "~>"
143
171
  - !ruby/object:Gem::Version
144
- version: '5.6'
172
+ version: '7.16'
145
173
  - !ruby/object:Gem::Dependency
146
174
  name: rspec
147
175
  requirement: !ruby/object:Gem::Requirement
148
176
  requirements:
149
177
  - - "~>"
150
178
  - !ruby/object:Gem::Version
151
- version: '3.9'
179
+ version: '3.10'
152
180
  type: :development
153
181
  prerelease: false
154
182
  version_requirements: !ruby/object:Gem::Requirement
155
183
  requirements:
156
184
  - - "~>"
157
185
  - !ruby/object:Gem::Version
158
- version: '3.9'
186
+ version: '3.10'
159
187
  - !ruby/object:Gem::Dependency
160
188
  name: rubocop
161
189
  requirement: !ruby/object:Gem::Requirement
162
190
  requirements:
163
191
  - - "~>"
164
192
  - !ruby/object:Gem::Version
165
- version: '0.79'
193
+ version: '1.3'
166
194
  type: :development
167
195
  prerelease: false
168
196
  version_requirements: !ruby/object:Gem::Requirement
169
197
  requirements:
170
198
  - - "~>"
171
199
  - !ruby/object:Gem::Version
172
- version: '0.79'
200
+ version: '1.3'
173
201
  - !ruby/object:Gem::Dependency
174
202
  name: rubocop-performance
175
203
  requirement: !ruby/object:Gem::Requirement
176
204
  requirements:
177
205
  - - "~>"
178
206
  - !ruby/object:Gem::Version
179
- version: '1.5'
207
+ version: '1.8'
180
208
  type: :development
181
209
  prerelease: false
182
210
  version_requirements: !ruby/object:Gem::Requirement
183
211
  requirements:
184
212
  - - "~>"
185
213
  - !ruby/object:Gem::Version
186
- version: '1.5'
214
+ version: '1.8'
187
215
  - !ruby/object:Gem::Dependency
188
216
  name: rubocop-rake
189
217
  requirement: !ruby/object:Gem::Requirement
@@ -204,40 +232,41 @@ dependencies:
204
232
  requirements:
205
233
  - - "~>"
206
234
  - !ruby/object:Gem::Version
207
- version: '1.37'
235
+ version: '2.0'
208
236
  type: :development
209
237
  prerelease: false
210
238
  version_requirements: !ruby/object:Gem::Requirement
211
239
  requirements:
212
240
  - - "~>"
213
241
  - !ruby/object:Gem::Version
214
- version: '1.37'
242
+ version: '2.0'
215
243
  - !ruby/object:Gem::Dependency
216
244
  name: simplecov
217
245
  requirement: !ruby/object:Gem::Requirement
218
246
  requirements:
219
247
  - - "~>"
220
248
  - !ruby/object:Gem::Version
221
- version: '0.18'
249
+ version: '0.19'
222
250
  type: :development
223
251
  prerelease: false
224
252
  version_requirements: !ruby/object:Gem::Requirement
225
253
  requirements:
226
254
  - - "~>"
227
255
  - !ruby/object:Gem::Version
228
- version: '0.18'
229
- description:
256
+ version: '0.19'
257
+ description:
230
258
  email:
231
259
  - brooke@alchemists.io
232
260
  executables: []
233
261
  extensions: []
234
262
  extra_rdoc_files:
235
- - README.md
236
- - LICENSE.md
263
+ - README.adoc
264
+ - LICENSE.adoc
237
265
  files:
238
- - LICENSE.md
239
- - README.md
266
+ - LICENSE.adoc
267
+ - README.adoc
240
268
  - lib/versionaire.rb
269
+ - lib/versionaire/cast.rb
241
270
  - lib/versionaire/conversion.rb
242
271
  - lib/versionaire/errors/base.rb
243
272
  - lib/versionaire/errors/conversion.rb
@@ -246,14 +275,15 @@ files:
246
275
  - lib/versionaire/filler.rb
247
276
  - lib/versionaire/identity.rb
248
277
  - lib/versionaire/version.rb
249
- homepage: https://github.com/bkuhlmann/versionaire
278
+ homepage: https://www.alchemists.io/projects/versionaire
250
279
  licenses:
251
280
  - Apache-2.0
252
281
  metadata:
253
- source_code_uri: https://github.com/bkuhlmann/versionaire
254
- changelog_uri: https://github.com/bkuhlmann/versionaire/blob/master/CHANGES.md
255
282
  bug_tracker_uri: https://github.com/bkuhlmann/versionaire/issues
256
- post_install_message:
283
+ changelog_uri: https://www.alchemists.io/projects/versionaire/changes.html
284
+ documentation_uri: https://www.alchemists.io/projects/versionaire
285
+ source_code_uri: https://github.com/bkuhlmann/versionaire
286
+ post_install_message:
257
287
  rdoc_options: []
258
288
  require_paths:
259
289
  - lib
@@ -268,8 +298,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
268
298
  - !ruby/object:Gem::Version
269
299
  version: '0'
270
300
  requirements: []
271
- rubygems_version: 3.1.2
272
- signing_key:
301
+ rubygems_version: 3.1.4
302
+ signing_key:
273
303
  specification_version: 4
274
304
  summary: Provides an immutable, thread-safe, and semantic version type.
275
305
  test_files: []
metadata.gz.sig CHANGED
Binary file
data/README.md DELETED
@@ -1,228 +0,0 @@
1
- <p align="center">
2
- <img src="versionaire.png" alt="Versionaire Icon"/>
3
- </p>
4
-
5
- # Versionaire
6
-
7
- [![Gem Version](https://badge.fury.io/rb/versionaire.svg)](http://badge.fury.io/rb/versionaire)
8
- [![Code Climate Maintainability](https://api.codeclimate.com/v1/badges/e61fa9230ecc0bfa6f07/maintainability)](https://codeclimate.com/github/bkuhlmann/versionaire/maintainability)
9
- [![Code Climate Test Coverage](https://api.codeclimate.com/v1/badges/e61fa9230ecc0bfa6f07/test_coverage)](https://codeclimate.com/github/bkuhlmann/versionaire/test_coverage)
10
- [![Circle CI Status](https://circleci.com/gh/bkuhlmann/versionaire.svg?style=svg)](https://circleci.com/gh/bkuhlmann/versionaire)
11
-
12
- Provides an immutable, thread-safe, and semantic version type when managing versions within your
13
- applications.
14
-
15
- <!-- Tocer[start]: Auto-generated, don't remove. -->
16
-
17
- ## Table of Contents
18
-
19
- - [Features](#features)
20
- - [Screencasts](#screencasts)
21
- - [Requirements](#requirements)
22
- - [Setup](#setup)
23
- - [Usage](#usage)
24
- - [Initialization](#initialization)
25
- - [Equality](#equality)
26
- - [Value (`#==`)](#value-)
27
- - [Hash (`#eql?`)](#hash-eql)
28
- - [Case (`#===`)](#case-)
29
- - [Identity (`#equal?`)](#identity-equal)
30
- - [Conversions](#conversions)
31
- - [Function (Casting)](#function-casting)
32
- - [Implicit](#implicit)
33
- - [Explicit](#explicit)
34
- - [Comparisons](#comparisons)
35
- - [Math](#math)
36
- - [Addition](#addition)
37
- - [Subtraction](#subtraction)
38
- - [Tests](#tests)
39
- - [Versioning](#versioning)
40
- - [Code of Conduct](#code-of-conduct)
41
- - [Contributions](#contributions)
42
- - [License](#license)
43
- - [History](#history)
44
- - [Credits](#credits)
45
-
46
- <!-- Tocer[finish]: Auto-generated, don't remove. -->
47
-
48
- ## Features
49
-
50
- - Provides [Semantic Versioning](https://semver.org).
51
- - Provides immutable, thread-safe version instances.
52
- - Converts (casts) from a `String`, `Array`, `Hash`, or `Version` to a `Version`.
53
-
54
- ## Screencasts
55
-
56
- [![asciicast](https://asciinema.org/a/291457.svg)](https://asciinema.org/a/291457)
57
-
58
- ## Requirements
59
-
60
- 1. [Ruby 2.7.x](https://www.ruby-lang.org).
61
-
62
- ## Setup
63
-
64
- Type the following to install:
65
-
66
- gem install versionaire
67
-
68
- Add the following to your Gemfile:
69
-
70
- gem "versionaire"
71
-
72
- ## Usage
73
-
74
- ### Initialization
75
-
76
- A new version can be initialized in a variety of ways:
77
-
78
- Versionaire::Version.new # "0.0.0"
79
- Versionaire::Version[major: 1] # "1.0.0"
80
- Versionaire::Version[major: 1, minor: 2] # "1.2.0"
81
- Versionaire::Version[major: 1, minor: 2, patch: 3] # "1.2.3"
82
-
83
- ### Equality
84
-
85
- #### Value (`#==`)
86
-
87
- Equality is deterimined by the state of the object. This means that a version is equal to another
88
- version as long as all of the values (i.e. state) are equal to each other. Example:
89
-
90
- version_a = Versionaire::Version[major: 1]
91
- version_b = Versionaire::Version[major: 2]
92
- version_c = Versionaire::Version[major: 1]
93
-
94
- version_a == version_a # true
95
- version_a == version_b # false
96
- version_a == version_c # true
97
-
98
- Knowning this, versions can be compared against one another too:
99
-
100
- version_a > version_b # false
101
- version_a < version_b # true
102
- version_a.between? version_c, version_b # true
103
-
104
- #### Hash (`#eql?`)
105
-
106
- Behaves exactly as `#==`.
107
-
108
- #### Case (`#===`)
109
-
110
- Behaves exactly as `#==`.
111
-
112
- #### Identity (`#equal?`)
113
-
114
- Works like any other standard Ruby object where an object is equal only to itself.
115
-
116
- version_a = Versionaire::Version[major: 1]
117
- version_b = Versionaire::Version[major: 2]
118
- version_c = Versionaire::Version[major: 1]
119
-
120
- version_a.equal? version_a # true
121
- version_a.equal? version_b # false
122
- version_a.equal? version_c # false
123
-
124
- ### Conversions
125
-
126
- #### Function (Casting)
127
-
128
- The `Versionaire::Version` function is provided for explicit casting to a version:
129
-
130
- version = Versionaire::Version[major: 1]
131
-
132
- Versionaire::Version "1.0.0"
133
- Versionaire::Version [1, 0, 0]
134
- Versionaire::Version major: 1, minor: 0, patch: 0
135
- Versionaire::Version version
136
-
137
- Each of these conversions will result in a version object that represents "1.0.0". When attempting
138
- to convert an unsupported type, a `Versionaire::Errors::Conversion` exception will be thrown.
139
-
140
- #### Implicit
141
-
142
- Implicit conversion to a `String` is supported:
143
-
144
- "1.0.0".match Versionaire::Version[major: 1] # <MatchData "1.0.0">
145
-
146
- #### Explicit
147
-
148
- Explicit conversion to a `String`, `Array`, or `Hash` is supported:
149
-
150
- version = Versionaire::Version.new
151
-
152
- version.to_s # "0.0.0"
153
- version.to_a # [0, 0, 0]
154
- version.to_h # {major: 0, minor: 0, patch: 0}
155
-
156
- ### Comparisons
157
-
158
- All versions are comparable which means any of the operators from the `Comparable` module will work.
159
- Example:
160
-
161
- version_1 = Versionaire::Version "1.0.0"
162
- version_2 = Versionaire::Version "2.0.0"
163
-
164
- version_1 < version_2 # true
165
- version_1 <= version_2 # true
166
- version_1 == version_2 # false (see Equality section above for details)
167
- version_1 > version_2 # false
168
- version_1 >= version_2 # false
169
- version_1.between? version_1, version_2 # true
170
- version_1.clamp version_1, version_2 # version_1 (added in Ruby 2.4.0)
171
-
172
- ### Math
173
-
174
- Versions can be added and subtracted from each other.
175
-
176
- #### Addition
177
-
178
- version_1 = Versionaire::Version[major: 1, minor: 2, patch: 3]
179
- version_2 = Versionaire::Version[major: 2, minor: 5, patch: 7]
180
- version_1 + version_2 # "3.7.10"
181
-
182
- #### Subtraction
183
-
184
- version_1 = Versionaire::Version[major: 1, minor: 2, patch: 3]
185
- version_2 = Versionaire::Version[major: 1, minor: 1, patch: 1]
186
- version_1 - version_2 # "0.1.2"
187
-
188
- version_1 = Versionaire::Version[major: 1]
189
- version_2 = Versionaire::Version[major: 5]
190
- version_1 - version_2 # Fails with a Versionaire::Errors::NegativeNumber
191
-
192
- ## Tests
193
-
194
- To test, run:
195
-
196
- bundle exec rake
197
-
198
- ## Versioning
199
-
200
- Read [Semantic Versioning](https://semver.org) for details. Briefly, it means:
201
-
202
- - Major (X.y.z) - Incremented for any backwards incompatible public API changes.
203
- - Minor (x.Y.z) - Incremented for new, backwards compatible, public API enhancements/fixes.
204
- - Patch (x.y.Z) - Incremented for small, backwards compatible, bug fixes.
205
-
206
- ## Code of Conduct
207
-
208
- Please note that this project is released with a [CODE OF CONDUCT](CODE_OF_CONDUCT.md). By
209
- participating in this project you agree to abide by its terms.
210
-
211
- ## Contributions
212
-
213
- Read [CONTRIBUTING](CONTRIBUTING.md) for details.
214
-
215
- ## License
216
-
217
- Copyright 2016 [Alchemists](https://www.alchemists.io).
218
- Read [LICENSE](LICENSE.md) for details.
219
-
220
- ## History
221
-
222
- Read [CHANGES](CHANGES.md) for details.
223
- Built with [Gemsmith](https://github.com/bkuhlmann/gemsmith).
224
-
225
- ## Credits
226
-
227
- Developed by [Brooke Kuhlmann](https://www.alchemists.io) at
228
- [Alchemists](https://www.alchemists.io).