versionaire 9.1.1 → 9.2.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 +0 -0
- data.tar.gz.sig +0 -0
- data/README.adoc +40 -0
- data/lib/versionaire/extensions/option_parser.rb +10 -0
- data/lib/versionaire/identity.rb +1 -1
- metadata +3 -2
- 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: d1e1e12933915ebaa8ce2769bac22f1ead28d07902b32bcdb4801f70b724b016
|
4
|
+
data.tar.gz: 4c454f8f399df43ebc649010c50d9ee95f321435c96468162ab21b9abd849abb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: facb53e495986112920ca938387be6448eb5bd6e6b94d1a8d5a5e3f3a9c34bbed72da9b6d2f0476b052796d61bedbbb1f27553c536792d2b72a9f81e961d4f70
|
7
|
+
data.tar.gz: 32ad27fbdd19b4c6d253009c025b9409ee29766f2eb0c7e158f5d2e231052b8efa661886a534c719cc0baef9b74758698831c81e49c1f7fd93d264ae7e3ffa33
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/README.adoc
CHANGED
@@ -257,6 +257,46 @@ version.down :patch, 3 # => "5.5.2"
|
|
257
257
|
version.down :major, 6 # => Versionaire::Errors::NegativeNumber
|
258
258
|
----
|
259
259
|
|
260
|
+
=== Extensions
|
261
|
+
|
262
|
+
This project supports libraries which might desire native `Version` types. Each extension _must be
|
263
|
+
explicitly required_ in order to be used since they are _optional_ by default. See below for
|
264
|
+
details.
|
265
|
+
|
266
|
+
==== OptionParser
|
267
|
+
|
268
|
+
link:https://github.com/ruby/optparse[OptionParser] is one of Ruby's
|
269
|
+
link:https://stdgems.org[default gems] which can accept additional types not native to Ruby by
|
270
|
+
default. To extend `OptionParser` with the `Version` type, all you need to do is add these two lines
|
271
|
+
to your implementation:
|
272
|
+
|
273
|
+
. `require "versionaire/extensions/option_parser"` - This will load dependencies and register the
|
274
|
+
`Version` type with `OptionParser`.
|
275
|
+
. `instance.on "--tag VERSION", Versionaire::Version` - Specifying `Versionaire::Version` as the
|
276
|
+
second argument will ensure `OptionParser` properly casts command line input as a `Version` type.
|
277
|
+
|
278
|
+
Here's an example implementation that demonstrates full usage:
|
279
|
+
|
280
|
+
[source,ruby]
|
281
|
+
----
|
282
|
+
require "versionaire/extensions/option_parser"
|
283
|
+
|
284
|
+
options = {}
|
285
|
+
|
286
|
+
parser = OptionParser.new do |instance|
|
287
|
+
instance.on "--tag VERSION", Versionaire::Version, "Casts to version." do |value|
|
288
|
+
options[:version] = value
|
289
|
+
end
|
290
|
+
end
|
291
|
+
|
292
|
+
parser.parse! %w[--tag 1.2.3]
|
293
|
+
puts options
|
294
|
+
----
|
295
|
+
|
296
|
+
The above will ensure `--tag 1.2.3` is parsed as `{:version=>#<struct Versionaire::Version major=1,
|
297
|
+
minor=2, patch=3>}` within your `options` variable. Should `OptionParser` parse an invalid version,
|
298
|
+
you'll get a `OptionParser::InvalidArgument` instead.
|
299
|
+
|
260
300
|
== Development
|
261
301
|
|
262
302
|
To contribute, run:
|
data/lib/versionaire/identity.rb
CHANGED
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.2.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-05-02 00:00:00.000000000 Z
|
32
32
|
dependencies:
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: refinements
|
@@ -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
|
metadata.gz.sig
CHANGED
Binary file
|