versionaire 8.1.0 → 8.6.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: d20b3927b31e04a6aa4db539594e3826114c9059bbdbbc7bf82db8cc2bb1642b
4
- data.tar.gz: c8f52778a5a07e77d819e525e5a9e8faf00f342280757261972ee73d49dfca1f
3
+ metadata.gz: '086f0f72812f1c6dd5ae1597a8098c53513642ba6b642009dc7d33309dc87b84'
4
+ data.tar.gz: daad3d46b8ccd0528fe9def4a0b4bd83b6b99810b909076150edce0fe6e8efcd
5
5
  SHA512:
6
- metadata.gz: e6541aa88de4802b6e7341b8f6b9deeceb5b33a95533de0255f41485f0be754fe66067b9ce03c3bee0936d25ed14589f359effe3e595616424acbfbbe36d2fc7
7
- data.tar.gz: 6922a4629f06dba48a05068301160e7861fcf9780d3a29552d65f6d4d9e16f2cbe1dab590b158990316def5c18f79f36a467eb8453a4b91a0378939b36f8684b
6
+ metadata.gz: 7958a758fc0d40c359f26a21c3f6eb9bbaf778b8dbfe82b9f798f15b5bfd5333ca1275554ea908a76a35539408578a8c9025386b14379983788e8d1ebdd47222
7
+ data.tar.gz: 8646bfa7633a29cf08a75231df02eb55fc04f8d0ef8fc7b7c1e77b2361b8967f508ea2caa1444367e0d3fd683537babf14d2338773965a3a17c1d5ea272fffd2
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -150,7 +150,7 @@ additional liability.
150
150
 
151
151
  END OF TERMS AND CONDITIONS
152
152
 
153
- Copyright link:https://www.alchemists.io[Alchemists].
153
+ Copyright 2016 link:https://www.alchemists.io/team/brooke_kuhlmann[Brooke Kuhlmann].
154
154
 
155
155
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
156
156
  compliance with the License. You may obtain a link:https://www.apache.org/licenses/LICENSE-2.0[copy]
@@ -6,6 +6,8 @@
6
6
 
7
7
  [link=http://badge.fury.io/rb/versionaire]
8
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]
9
11
  [link=https://circleci.com/gh/bkuhlmann/versionaire]
10
12
  image::https://circleci.com/gh/bkuhlmann/versionaire.svg?style=svg[Circle CI Status]
11
13
 
@@ -22,17 +24,15 @@ toc::[]
22
24
 
23
25
  == Screencasts
24
26
 
25
- [link=https://www.alchemists.io/screencasts/versionaire.html]
26
- image::https://www.alchemists.io/images/screencasts/versionaire/cover-original.png[Screencast,role=focal_point]
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]
27
29
 
28
30
  == Requirements
29
31
 
30
- . https://www.ruby-lang.org[Ruby 2.7.x].
32
+ . https://www.ruby-lang.org[Ruby].
31
33
 
32
34
  == Setup
33
35
 
34
- === Production
35
-
36
36
  To install, run:
37
37
 
38
38
  [source,bash]
@@ -47,24 +47,6 @@ Add the following to your Gemfile:
47
47
  gem "versionaire"
48
48
  ----
49
49
 
50
- === Development
51
-
52
- To contribute, run:
53
-
54
- [source,bash]
55
- ----
56
- git clone https://github.com/bkuhlmann/versionaire.git
57
- cd versionaire
58
- bin/setup
59
- ----
60
-
61
- You can also use the IRB console for direct access to all objects:
62
-
63
- [source,bash]
64
- ----
65
- bin/console
66
- ----
67
-
68
50
  == Usage
69
51
 
70
52
  === Initialization
@@ -73,10 +55,10 @@ A new version can be initialized in a variety of ways:
73
55
 
74
56
  [source,ruby]
75
57
  ----
76
- Versionaire::Version.new # "0.0.0"
77
- Versionaire::Version[major: 1] # "1.0.0"
78
- Versionaire::Version[major: 1, minor: 2] # "1.2.0"
79
- Versionaire::Version[major: 1, minor: 2, patch: 3] # "1.2.3"
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"
80
62
  ----
81
63
 
82
64
  === Equality
@@ -92,18 +74,18 @@ version_a = Versionaire::Version[major: 1]
92
74
  version_b = Versionaire::Version[major: 2]
93
75
  version_c = Versionaire::Version[major: 1]
94
76
 
95
- version_a == version_a # true
96
- version_a == version_b # false
97
- version_a == version_c # true
77
+ version_a == version_a # true
78
+ version_a == version_b # false
79
+ version_a == version_c # true
98
80
  ----
99
81
 
100
82
  Knowning this, versions can be compared against one another too:
101
83
 
102
84
  [source,ruby]
103
85
  ----
104
- version_a > version_b # false
105
- version_a < version_b # true
106
- version_a.between? version_c, version_b # true
86
+ version_a > version_b # false
87
+ version_a < version_b # true
88
+ version_a.between? version_c, version_b # true
107
89
  ----
108
90
 
109
91
  ==== Hash (`#eql?`)
@@ -124,16 +106,16 @@ version_a = Versionaire::Version[major: 1]
124
106
  version_b = Versionaire::Version[major: 2]
125
107
  version_c = Versionaire::Version[major: 1]
126
108
 
127
- version_a.equal? version_a # true
128
- version_a.equal? version_b # false
129
- version_a.equal? version_c # false
109
+ version_a.equal? version_a # true
110
+ version_a.equal? version_b # false
111
+ version_a.equal? version_c # false
130
112
  ----
131
113
 
132
114
  === Conversions
133
115
 
134
- ==== Function (Casting)
116
+ ==== Function
135
117
 
136
- The `Versionaire::Version` function is provided for explicit casting to a version:
118
+ Use the `Versionaire::Version` function to explicitly cast to a version:
137
119
 
138
120
  [source,ruby]
139
121
  ----
@@ -148,6 +130,29 @@ Versionaire::Version version
148
130
  Each of these conversions will result in a version object that represents "`1.0.0`". When attempting
149
131
  to convert an unsupported type, a `+Versionaire::Errors::Conversion+` exception will be thrown.
150
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
+
151
156
  ==== Implicit
152
157
 
153
158
  Implicit conversion to a `+String+` is supported:
@@ -215,6 +220,24 @@ version_2 = Versionaire::Version[major: 5]
215
220
  version_1 - version_2 # Fails with a Versionaire::Errors::NegativeNumber
216
221
  ----
217
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
+
218
241
  == Tests
219
242
 
220
243
  To test, run:
@@ -251,4 +274,4 @@ Read link:CHANGES.adoc[CHANGES] for details.
251
274
 
252
275
  == Credits
253
276
 
254
- Engineered by link:https://www.alchemists.io/team/brooke_kuhlmann.html[Brooke Kuhlmann].
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
@@ -5,7 +5,7 @@ module Versionaire
5
5
  module Identity
6
6
  NAME = "versionaire"
7
7
  LABEL = "Versionaire"
8
- VERSION = "8.1.0"
8
+ VERSION = "8.6.0"
9
9
  VERSION_LABEL = "#{LABEL} #{VERSION}"
10
10
  end
11
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,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: versionaire
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.1.0
4
+ version: 8.6.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
  - |
@@ -28,205 +28,9 @@ cert_chain:
28
28
  2XV8FRa7/JimI07sPLC13eLY3xd/aYTi85Z782KIA4j0G8XEEWAX0ouBhlXPocZv
29
29
  QWc=
30
30
  -----END CERTIFICATE-----
31
- date: 2020-04-01 00:00:00.000000000 Z
32
- dependencies:
33
- - !ruby/object:Gem::Dependency
34
- name: bundler-audit
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: '0.6'
40
- type: :development
41
- prerelease: false
42
- version_requirements: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - "~>"
45
- - !ruby/object:Gem::Version
46
- version: '0.6'
47
- - !ruby/object:Gem::Dependency
48
- name: gemsmith
49
- requirement: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - "~>"
52
- - !ruby/object:Gem::Version
53
- version: '14.0'
54
- type: :development
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - "~>"
59
- - !ruby/object:Gem::Version
60
- version: '14.0'
61
- - !ruby/object:Gem::Dependency
62
- name: git-cop
63
- requirement: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - "~>"
66
- - !ruby/object:Gem::Version
67
- version: '4.0'
68
- type: :development
69
- prerelease: false
70
- version_requirements: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - "~>"
73
- - !ruby/object:Gem::Version
74
- version: '4.0'
75
- - !ruby/object:Gem::Dependency
76
- name: guard-rspec
77
- requirement: !ruby/object:Gem::Requirement
78
- requirements:
79
- - - "~>"
80
- - !ruby/object:Gem::Version
81
- version: '4.7'
82
- type: :development
83
- prerelease: false
84
- version_requirements: !ruby/object:Gem::Requirement
85
- requirements:
86
- - - "~>"
87
- - !ruby/object:Gem::Version
88
- version: '4.7'
89
- - !ruby/object:Gem::Dependency
90
- name: pry
91
- requirement: !ruby/object:Gem::Requirement
92
- requirements:
93
- - - "~>"
94
- - !ruby/object:Gem::Version
95
- version: '0.12'
96
- type: :development
97
- prerelease: false
98
- version_requirements: !ruby/object:Gem::Requirement
99
- requirements:
100
- - - "~>"
101
- - !ruby/object:Gem::Version
102
- version: '0.12'
103
- - !ruby/object:Gem::Dependency
104
- name: pry-byebug
105
- requirement: !ruby/object:Gem::Requirement
106
- requirements:
107
- - - "~>"
108
- - !ruby/object:Gem::Version
109
- version: '3.7'
110
- type: :development
111
- prerelease: false
112
- version_requirements: !ruby/object:Gem::Requirement
113
- requirements:
114
- - - "~>"
115
- - !ruby/object:Gem::Version
116
- version: '3.7'
117
- - !ruby/object:Gem::Dependency
118
- name: rake
119
- requirement: !ruby/object:Gem::Requirement
120
- requirements:
121
- - - "~>"
122
- - !ruby/object:Gem::Version
123
- version: '13.0'
124
- type: :development
125
- prerelease: false
126
- version_requirements: !ruby/object:Gem::Requirement
127
- requirements:
128
- - - "~>"
129
- - !ruby/object:Gem::Version
130
- version: '13.0'
131
- - !ruby/object:Gem::Dependency
132
- name: reek
133
- requirement: !ruby/object:Gem::Requirement
134
- requirements:
135
- - - "~>"
136
- - !ruby/object:Gem::Version
137
- version: '6.0'
138
- type: :development
139
- prerelease: false
140
- version_requirements: !ruby/object:Gem::Requirement
141
- requirements:
142
- - - "~>"
143
- - !ruby/object:Gem::Version
144
- version: '6.0'
145
- - !ruby/object:Gem::Dependency
146
- name: rspec
147
- requirement: !ruby/object:Gem::Requirement
148
- requirements:
149
- - - "~>"
150
- - !ruby/object:Gem::Version
151
- version: '3.9'
152
- type: :development
153
- prerelease: false
154
- version_requirements: !ruby/object:Gem::Requirement
155
- requirements:
156
- - - "~>"
157
- - !ruby/object:Gem::Version
158
- version: '3.9'
159
- - !ruby/object:Gem::Dependency
160
- name: rubocop
161
- requirement: !ruby/object:Gem::Requirement
162
- requirements:
163
- - - "~>"
164
- - !ruby/object:Gem::Version
165
- version: '0.79'
166
- type: :development
167
- prerelease: false
168
- version_requirements: !ruby/object:Gem::Requirement
169
- requirements:
170
- - - "~>"
171
- - !ruby/object:Gem::Version
172
- version: '0.79'
173
- - !ruby/object:Gem::Dependency
174
- name: rubocop-performance
175
- requirement: !ruby/object:Gem::Requirement
176
- requirements:
177
- - - "~>"
178
- - !ruby/object:Gem::Version
179
- version: '1.5'
180
- type: :development
181
- prerelease: false
182
- version_requirements: !ruby/object:Gem::Requirement
183
- requirements:
184
- - - "~>"
185
- - !ruby/object:Gem::Version
186
- version: '1.5'
187
- - !ruby/object:Gem::Dependency
188
- name: rubocop-rake
189
- requirement: !ruby/object:Gem::Requirement
190
- requirements:
191
- - - "~>"
192
- - !ruby/object:Gem::Version
193
- version: '0.5'
194
- type: :development
195
- prerelease: false
196
- version_requirements: !ruby/object:Gem::Requirement
197
- requirements:
198
- - - "~>"
199
- - !ruby/object:Gem::Version
200
- version: '0.5'
201
- - !ruby/object:Gem::Dependency
202
- name: rubocop-rspec
203
- requirement: !ruby/object:Gem::Requirement
204
- requirements:
205
- - - "~>"
206
- - !ruby/object:Gem::Version
207
- version: '1.37'
208
- type: :development
209
- prerelease: false
210
- version_requirements: !ruby/object:Gem::Requirement
211
- requirements:
212
- - - "~>"
213
- - !ruby/object:Gem::Version
214
- version: '1.37'
215
- - !ruby/object:Gem::Dependency
216
- name: simplecov
217
- requirement: !ruby/object:Gem::Requirement
218
- requirements:
219
- - - "~>"
220
- - !ruby/object:Gem::Version
221
- version: '0.18'
222
- type: :development
223
- prerelease: false
224
- version_requirements: !ruby/object:Gem::Requirement
225
- requirements:
226
- - - "~>"
227
- - !ruby/object:Gem::Version
228
- version: '0.18'
229
- description:
31
+ date: 2020-12-13 00:00:00.000000000 Z
32
+ dependencies: []
33
+ description:
230
34
  email:
231
35
  - brooke@alchemists.io
232
36
  executables: []
@@ -238,6 +42,7 @@ files:
238
42
  - LICENSE.adoc
239
43
  - README.adoc
240
44
  - lib/versionaire.rb
45
+ - lib/versionaire/cast.rb
241
46
  - lib/versionaire/conversion.rb
242
47
  - lib/versionaire/errors/base.rb
243
48
  - lib/versionaire/errors/conversion.rb
@@ -254,7 +59,7 @@ metadata:
254
59
  changelog_uri: https://www.alchemists.io/projects/versionaire/changes.html
255
60
  documentation_uri: https://www.alchemists.io/projects/versionaire
256
61
  source_code_uri: https://github.com/bkuhlmann/versionaire
257
- post_install_message:
62
+ post_install_message:
258
63
  rdoc_options: []
259
64
  require_paths:
260
65
  - lib
@@ -269,8 +74,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
269
74
  - !ruby/object:Gem::Version
270
75
  version: '0'
271
76
  requirements: []
272
- rubygems_version: 3.1.2
273
- signing_key:
77
+ rubygems_version: 3.2.0
78
+ signing_key:
274
79
  specification_version: 4
275
80
  summary: Provides an immutable, thread-safe, and semantic version type.
276
81
  test_files: []
metadata.gz.sig CHANGED
@@ -1,3 +1,2 @@
1
- gx�e'��.�\�bf"�d�T���.XQLE!"EJt ]�vȶ9>:�8�?�︩�Y��~P�~R�IB@mTW^3��?7]vy]^ ������K-b�^�!�=X��_��>����A 8�j�}x ���w����*�P���MSóX��JXEDht�_3����x���~�(^���{��*;n��a�W亞��ȫ�1�ƒl�/_��H.@�ܧ-��� ��
2
- z����n
3
- 1�K~�3­
1
+ Ƴ1��a if���X�9�q�!� X����H�R0���+�w�Gʻr����vP��59Y,�d�j�k��[��O�:�X@C_1yj O��~r�|]g|6��9��՛z���:�
2
+ h�ږ���AQ�u.�D��=>�L�A���,��sn�g0���>m��1��F�G��`�1H�[&[�Y�[��D貍t�Q�[��e�X���Mpy�> ���Y���+bLӪ��&S�7�tz#�/�7�$�����"|