versionaire 12.1.1 → 13.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8ccdc85c252a158771e6fff4663216c1ec12b8911f3f9f43a946979878ef697b
4
- data.tar.gz: 73a4212cc9694cee9369b1c85d8b643b2ff9d46b8948bdf17ae667e27551c7cc
3
+ metadata.gz: ddea448c492c62a0bc45e8cda40984cf5695ae839e3f71cd66711b37f6de9cfd
4
+ data.tar.gz: 78f8baf838b4f6361d44dad88d81fab42f0f73c4e86abe4a1a5ee86fc801d5e8
5
5
  SHA512:
6
- metadata.gz: 89eef3d69e55a54fe7fa11293b588e5044d970d6c28b26cb9d26905488f085aa9e23c3e82c8eda4f95598100373311c6e10191ecf3b832d82dfc35618629781f
7
- data.tar.gz: 12b167c40e71526a1461882579a13dc749e9e88707d53c6ec36cd047efc8a2c2c699311162f2369c17c690e591de16dc8313abd96781d04a09765cb9a049828d
6
+ metadata.gz: 27a98bbc05db0abaacc9d15dbb164ef342449085882d7e4bf3ca55efd30c9e7dee2514fff942f0d01af7ca93046f642ffab6cb7be616f7bda8984950f05362de
7
+ data.tar.gz: e4ad9c4bf1d8359843620037c22d9f60e32054936fec48f44020b0520da86f84594fb686f2db9cff4e11cd7e7fc7d30e98051805b04f54da635fc80258136888
checksums.yaml.gz.sig CHANGED
Binary file
data/README.adoc CHANGED
@@ -4,25 +4,21 @@
4
4
 
5
5
  :option_parser_link: link:https://alchemists.io/articles/ruby_option_parser[OptionParser]
6
6
  :semver_link: link:https://semver.org[Semantic Versioning]
7
+ :strict_semver_link: link:https://alchemists.io/articles/strict_semantic_versioning[Strict Semantic Versioning]
7
8
 
8
9
  = Versionaire
9
10
 
10
- Ruby doesn't provide a primitive version type by default so Versionaire fills this gap by providing immutable and thread-safe {semver_link} so you can leverage versions within your applications. This new `Version` type behaves and feels a lot like other primitives (i.e. `String`, `Array`, `Hash`, etc) and can even be cast/converted from other primitives.
11
+ Ruby doesn't provide a primitive version type by default so Versionaire fills this gap by providing immutable and thread-safe {strict_semver_link} so you can leverage versions within your applications. This new `Version` type behaves and feels a lot like other primitives (i.e. `String`, `Array`, `Hash`, `Proc`, etc) and can be cast/converted from other primitives.
11
12
 
12
13
  toc::[]
13
14
 
14
15
  == Features
15
16
 
16
- * Provides _strict_ {semver_link} which means `<major>.<minor>.<patch>`.
17
+ * Provides {strict_semver_link} which means `<major>.<minor>.<patch>`.
17
18
  * Provides immutable, thread-safe version instances.
18
- * Converts (casts) from a `String`, `Array`, `Hash`, or `Version` to a `Version`.
19
- * Disallows `<major>.<minor>.<patch>-<pre-release>` usage even though {semver_link} suggests that you _may_ use pre-release information.
20
- * Disallows `<major>.<minor>.<patch>+<build_metadata>` usage even though {semver_link} suggests that you _may_ use build metadata.
21
-
22
- == Screencasts
23
-
24
- [link=https://alchemists.io/screencasts/versionaire]
25
- image::https://alchemists.io/images/screencasts/versionaire/cover.svg[Screencast,600,240,role=focal_point]
19
+ * Converts (casts) from a `String`, `Array`, `Hash`, `Proc`, or `Version` to a `Version`.
20
+ * Disallows `<major>.<minor>.<patch>-<pre-release>` usage even though {semver_link} suggests you _may_ use pre-release information.
21
+ * Disallows `<major>.<minor>.<patch>+<build_metadata>` usage even though {semver_link} suggests you _may_ use build metadata.
26
22
 
27
23
  == Requirements
28
24
 
@@ -139,8 +135,9 @@ Versionaire::Version major: 1, minor: 0, patch: 0
139
135
  Versionaire::Version version
140
136
  ----
141
137
 
142
- Each of these conversions will result in a version object that represents "`1.0.0`". When attempting
143
- to convert an unsupported type, a `Versionaire::Error` exception will be thrown.
138
+ Each of these conversions will result in a version object that represents "`1.0.0`".
139
+
140
+ When attempting to convert an unsupported type, a `Versionaire::Error` exception will be thrown.
144
141
 
145
142
  ==== Refinement
146
143
 
@@ -160,9 +157,8 @@ Version version
160
157
 
161
158
  By adding `using Versionaire::Cast` to your implementation, this allows Versionaire to refine
162
159
  `Kernel` so you have a top-level `Version` conversion function much like Kernel's native support for
163
- `Integer`, `String`, `Array`, `Hash`, etc. The benefit to this approach is it reduces the amount of
164
- typing, doesn't pollute your entire object space like a monkey patch would, and provides a idiomatic
165
- approach to casting like any other primitive.
160
+ `Integer`, `String`, `Array`, `Hash`, etc. The benefit to this approach is to reduce the amount of
161
+ typing so you don't pollute your entire object space, like a monkey patch, while providing an idiomatic approach to casting like any other primitive.
166
162
 
167
163
  ==== Implicit
168
164
 
@@ -187,7 +183,7 @@ version.to_h # {major: 0, minor: 0, patch: 0}
187
183
  version.to_proc # #<Proc:0x000000010b015b88 (lambda)>
188
184
  ----
189
185
 
190
- To elaborate on procs further, this means the following is possible:
186
+ To elaborate on procs, this means the following is possible where you might want to collect all minor verions values or make use of version information in other useful ways:
191
187
 
192
188
  [source,ruby]
193
189
  ----
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "refinements/arrays"
4
- require "refinements/structs"
3
+ require "refinements/array"
4
+ require "refinements/struct"
5
5
 
6
6
  # The gem namespace.
7
7
  module Versionaire
@@ -22,8 +22,8 @@ module Versionaire
22
22
 
23
23
  # Aids with converting objects into valid versions.
24
24
  class Converter
25
- using Refinements::Arrays
26
- using Refinements::Structs
25
+ using Refinements::Array
26
+ using Refinements::Struct
27
27
 
28
28
  def initialize object, model: Version
29
29
  @object = object
@@ -41,7 +41,7 @@ module Versionaire
41
41
  body = "Use: [<major>, <minor>, <patch>], [<major>, <minor>], [<major>], or []."
42
42
  fail Error, error_message(object, body) unless (0..3).cover? object.size
43
43
 
44
- model.with_positions(*object.pad(0, max: 3))
44
+ model.with_positions(*object.pad(0, 3))
45
45
  end
46
46
 
47
47
  def from_hash
@@ -63,7 +63,7 @@ module Versionaire
63
63
  def string_to_version
64
64
  object.split(DELIMITER)
65
65
  .map(&:to_i)
66
- .then { |numbers| numbers.pad 0, max: 3 }
66
+ .then { |numbers| numbers.pad 0, 3 }
67
67
  .then { |arguments| model.with_positions(*arguments) }
68
68
  end
69
69
 
@@ -1,14 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "refinements/structs"
3
+ require "refinements/array"
4
+ require "refinements/struct"
4
5
 
5
6
  module Versionaire
6
7
  # An immutable, semantic version value object.
7
8
  Version = Struct.new :major, :minor, :patch, keyword_init: true do
8
9
  include Comparable
9
10
 
10
- using Refinements::Arrays
11
- using Refinements::Structs
11
+ using Refinements::Array
12
+ using Refinements::Struct
12
13
 
13
14
  def initialize major: 0, minor: 0, patch: 0
14
15
  super
data/versionaire.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "versionaire"
5
- spec.version = "12.1.1"
5
+ spec.version = "13.1.0"
6
6
  spec.authors = ["Brooke Kuhlmann"]
7
7
  spec.email = ["brooke@alchemists.io"]
8
8
  spec.homepage = "https://alchemists.io/projects/versionaire"
@@ -22,8 +22,8 @@ Gem::Specification.new do |spec|
22
22
  spec.signing_key = Gem.default_key_path
23
23
  spec.cert_chain = [Gem.default_cert_path]
24
24
 
25
- spec.required_ruby_version = [">= 3.2", "<= 3.3"]
26
- spec.add_dependency "refinements", "~> 11.0"
25
+ spec.required_ruby_version = "~> 3.3"
26
+ spec.add_dependency "refinements", "~> 12.0"
27
27
 
28
28
  spec.files = Dir["*.gemspec", "lib/**/*"]
29
29
  spec.extra_rdoc_files = Dir["README*", "LICENSE*"]
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: 12.1.1
4
+ version: 13.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
@@ -35,7 +35,7 @@ cert_chain:
35
35
  3n5C8/6Zh9DYTkpcwPSuIfAga6wf4nXc9m6JAw8AuMLaiWN/r/2s4zJsUHYERJEu
36
36
  gZGm4JqtuSg8pYjPeIJxS960owq+SfuC+jxqmRA54BisFCv/0VOJi7tiJVY=
37
37
  -----END CERTIFICATE-----
38
- date: 2023-11-16 00:00:00.000000000 Z
38
+ date: 2024-02-20 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: refinements
@@ -43,14 +43,14 @@ dependencies:
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '11.0'
46
+ version: '12.0'
47
47
  type: :runtime
48
48
  prerelease: false
49
49
  version_requirements: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '11.0'
53
+ version: '12.0'
54
54
  description:
55
55
  email:
56
56
  - brooke@alchemists.io
@@ -86,10 +86,7 @@ require_paths:
86
86
  - lib
87
87
  required_ruby_version: !ruby/object:Gem::Requirement
88
88
  requirements:
89
- - - ">="
90
- - !ruby/object:Gem::Version
91
- version: '3.2'
92
- - - "<="
89
+ - - "~>"
93
90
  - !ruby/object:Gem::Version
94
91
  version: '3.3'
95
92
  required_rubygems_version: !ruby/object:Gem::Requirement
@@ -98,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
95
  - !ruby/object:Gem::Version
99
96
  version: '0'
100
97
  requirements: []
101
- rubygems_version: 3.4.22
98
+ rubygems_version: 3.5.6
102
99
  signing_key:
103
100
  specification_version: 4
104
101
  summary: An immutable, thread-safe, and semantic version type.
metadata.gz.sig CHANGED
Binary file