versionaire 9.1.1 → 9.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +1 -2
- data/README.adoc +45 -3
- data/lib/versionaire/extensions/option_parser.rb +10 -0
- data/lib/versionaire/identity.rb +2 -2
- data.tar.gz.sig +0 -0
- metadata +6 -5
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ed24547416f7f6a15d9c09e3125f8f425b60ea6a5b23727a2c7e1fbf298bfba
|
4
|
+
data.tar.gz: 416424449d95c8735779f302b5713d15ac62151f8b77ea16368ababcb97b7177
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d646ed7306202f5329a3c0bc832c3d584167936710d4c36c06c251eb23bfed3a98a67ab8a387f6ef1c3faa5006e7f40432aa40ecf53580364550dce4e6a5ee15
|
7
|
+
data.tar.gz: 29e34071763bf50bd4e11b851c63727ba549438ed05efb6ef5ef7fb2904ea7815712b83fa5c682af176c1e7cf0b41cf556f10128c5daa3f1c529b8ddabb41d34
|
checksums.yaml.gz.sig
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
2
|
-
���pH�pe���ueŴ��T���%ļ�6-ʳ�[�k>��n#p��r�m��y/ۺ�h��ǽ�7���b���m�l�lc1�AF�; �a=�w��CD�B��ꧺk8�_3lrҐB�a\�VV���H_]k��x]���V����p\>0���ד�l�-z�6����=����e!��3�*G
|
1
|
+
ET�h�`���₮7��G��).���:�D(���]Z܇��6v���(��p�A�ۑ �k�{�-z�4l�w����k=|tX3,�����-��B�_j~�6F)�����V�#�ඈ�h���.�ls���p�k�s��C�:yȃ�n�ξ�?��Bjhq��Sk�79��Z�*.�0�M/"
|
data/README.adoc
CHANGED
@@ -11,8 +11,10 @@ image::https://img.shields.io/badge/code_style-alchemists-brightgreen.svg[Alchem
|
|
11
11
|
[link=https://circleci.com/gh/bkuhlmann/versionaire]
|
12
12
|
image::https://circleci.com/gh/bkuhlmann/versionaire.svg?style=svg[Circle CI Status]
|
13
13
|
|
14
|
-
|
15
|
-
|
14
|
+
Ruby doesn't provide a primitive version type by default. Versionaire fills this gap by providing an
|
15
|
+
immutable, thread-safe, and link:https://semver.org[Semantic Version] in order to use versions
|
16
|
+
within your applications. This new version type behaves and feels a lot like other primitives (i.e.
|
17
|
+
`String`, `Array`, `Hash`, etc) and can even be cast/converted from other primitives.
|
16
18
|
|
17
19
|
toc::[]
|
18
20
|
|
@@ -150,7 +152,7 @@ Version version
|
|
150
152
|
By adding `using Versionaire::Cast` to your implementation, this allows Versionaire to refine
|
151
153
|
`Kernel` so you have a top-level `Version` conversion function much like Kernel's native support for
|
152
154
|
`Integer`, `String`, `Array`, `Hash`, etc. The benefit to this approach is it reduces the amount of
|
153
|
-
typing, doesn't
|
155
|
+
typing, doesn't pollute your entire object space like a monkey patch would, and provides a idiomatic
|
154
156
|
approach to casting like any other primitive.
|
155
157
|
|
156
158
|
==== Implicit
|
@@ -257,6 +259,46 @@ version.down :patch, 3 # => "5.5.2"
|
|
257
259
|
version.down :major, 6 # => Versionaire::Errors::NegativeNumber
|
258
260
|
----
|
259
261
|
|
262
|
+
=== Extensions
|
263
|
+
|
264
|
+
This project supports libraries which might desire native `Version` types. Each extension _must be
|
265
|
+
explicitly required_ in order to be used since they are _optional_ by default. See below for
|
266
|
+
details.
|
267
|
+
|
268
|
+
==== OptionParser
|
269
|
+
|
270
|
+
link:https://github.com/ruby/optparse[OptionParser] is one of Ruby's
|
271
|
+
link:https://stdgems.org[default gems] which can accept additional types not native to Ruby by
|
272
|
+
default. To extend `OptionParser` with the `Version` type, all you need to do is add these two lines
|
273
|
+
to your implementation:
|
274
|
+
|
275
|
+
. `require "versionaire/extensions/option_parser"` - This will load dependencies and register the
|
276
|
+
`Version` type with `OptionParser`.
|
277
|
+
. `instance.on "--tag VERSION", Versionaire::Version` - Specifying `Versionaire::Version` as the
|
278
|
+
second argument will ensure `OptionParser` properly casts command line input as a `Version` type.
|
279
|
+
|
280
|
+
Here's an example implementation that demonstrates full usage:
|
281
|
+
|
282
|
+
[source,ruby]
|
283
|
+
----
|
284
|
+
require "versionaire/extensions/option_parser"
|
285
|
+
|
286
|
+
options = {}
|
287
|
+
|
288
|
+
parser = OptionParser.new do |instance|
|
289
|
+
instance.on "--tag VERSION", Versionaire::Version, "Casts to version." do |value|
|
290
|
+
options[:version] = value
|
291
|
+
end
|
292
|
+
end
|
293
|
+
|
294
|
+
parser.parse! %w[--tag 1.2.3]
|
295
|
+
puts options
|
296
|
+
----
|
297
|
+
|
298
|
+
The above will ensure `--tag 1.2.3` is parsed as `{:version=>#<struct Versionaire::Version major=1,
|
299
|
+
minor=2, patch=3>}` within your `options` variable. Should `OptionParser` parse an invalid version,
|
300
|
+
you'll get a `OptionParser::InvalidArgument` instead.
|
301
|
+
|
260
302
|
== Development
|
261
303
|
|
262
304
|
To contribute, run:
|
data/lib/versionaire/identity.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: versionaire
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 9.
|
4
|
+
version: 9.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
@@ -28,7 +28,7 @@ cert_chain:
|
|
28
28
|
lkHilIrX69jq8wMPpBhlaw2mRmeSL50Wv5u6xVBvOHhXFSP1crXM95vfLhLyRYod
|
29
29
|
W2A=
|
30
30
|
-----END CERTIFICATE-----
|
31
|
-
date: 2021-
|
31
|
+
date: 2021-10-09 00:00:00.000000000 Z
|
32
32
|
dependencies:
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: refinements
|
@@ -36,14 +36,14 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '8.
|
39
|
+
version: '8.4'
|
40
40
|
type: :runtime
|
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: '8.
|
46
|
+
version: '8.4'
|
47
47
|
description:
|
48
48
|
email:
|
49
49
|
- brooke@alchemists.io
|
@@ -61,6 +61,7 @@ files:
|
|
61
61
|
- lib/versionaire/errors/cast.rb
|
62
62
|
- lib/versionaire/errors/invalid_number.rb
|
63
63
|
- lib/versionaire/errors/negative_number.rb
|
64
|
+
- lib/versionaire/extensions/option_parser.rb
|
64
65
|
- lib/versionaire/function.rb
|
65
66
|
- lib/versionaire/identity.rb
|
66
67
|
- lib/versionaire/version.rb
|
@@ -87,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
88
|
- !ruby/object:Gem::Version
|
88
89
|
version: '0'
|
89
90
|
requirements: []
|
90
|
-
rubygems_version: 3.2.
|
91
|
+
rubygems_version: 3.2.28
|
91
92
|
signing_key:
|
92
93
|
specification_version: 4
|
93
94
|
summary: Provides an immutable, thread-safe, and semantic version type.
|
metadata.gz.sig
CHANGED
Binary file
|