versionaire 9.1.1 → 9.3.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: 95e35f5d3112af653667a69f1421b1c2ffeb9f0ee37081679e42e40b02613fce
4
- data.tar.gz: 604702a9d233a94faee6d8ecc20f19b7d17e8f1dda2972a6b72b46cda4f44acb
3
+ metadata.gz: 3ed24547416f7f6a15d9c09e3125f8f425b60ea6a5b23727a2c7e1fbf298bfba
4
+ data.tar.gz: 416424449d95c8735779f302b5713d15ac62151f8b77ea16368ababcb97b7177
5
5
  SHA512:
6
- metadata.gz: 64a6327a293b8dd9989f000b1173541e83bb8855886c4da4213f2b7f70973c8d012ec58080c1ae6b675e4aa6033c5eacd6d2e23968a3ad9c66d58a32472aded0
7
- data.tar.gz: 4ef00d34ac1dacff42fa208970bf53b36ba27b0d849a4dcb11d57c98ea756fd7499f3c51c9a0c41316b3451d73b18aa7adc8a0393823a20f96674644f3dc7164
6
+ metadata.gz: d646ed7306202f5329a3c0bc832c3d584167936710d4c36c06c251eb23bfed3a98a67ab8a387f6ef1c3faa5006e7f40432aa40ecf53580364550dce4e6a5ee15
7
+ data.tar.gz: 29e34071763bf50bd4e11b851c63727ba549438ed05efb6ef5ef7fb2904ea7815712b83fa5c682af176c1e7cf0b41cf556f10128c5daa3f1c529b8ddabb41d34
checksums.yaml.gz.sig CHANGED
@@ -1 +1 @@
1
- `�+����RA
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
- Provides an immutable, thread-safe, and semantic version type when managing versions within your
15
- applications.
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 polute your entire object space like a monkey patch would, and provides a idiomatic
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:
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "optparse"
4
+ require "versionaire"
5
+
6
+ OptionParser.accept Versionaire::Version do |value|
7
+ Versionaire::Version value
8
+ rescue Versionaire::Errors::Base
9
+ raise OptionParser::InvalidArgument, value
10
+ end
@@ -5,7 +5,7 @@ module Versionaire
5
5
  module Identity
6
6
  NAME = "versionaire"
7
7
  LABEL = "Versionaire"
8
- VERSION = "9.1.1"
9
- VERSION_LABEL = "#{LABEL} #{VERSION}"
8
+ VERSION = "9.3.0"
9
+ VERSION_LABEL = "#{LABEL} #{VERSION}".freeze
10
10
  end
11
11
  end
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.1.1
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-04-18 00:00:00.000000000 Z
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.0'
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.0'
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.16
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