versionaire 8.0.1 → 8.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/{LICENSE.md → LICENSE.adoc} +29 -30
- data/README.adoc +254 -0
- data/lib/versionaire/identity.rb +4 -15
- metadata +22 -21
- metadata.gz.sig +0 -0
- data/README.md +0 -228
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d20b3927b31e04a6aa4db539594e3826114c9059bbdbbc7bf82db8cc2bb1642b
|
4
|
+
data.tar.gz: c8f52778a5a07e77d819e525e5a9e8faf00f342280757261972ee73d49dfca1f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6541aa88de4802b6e7341b8f6b9deeceb5b33a95533de0255f41485f0be754fe66067b9ce03c3bee0936d25ed14589f359effe3e595616424acbfbbe36d2fc7
|
7
|
+
data.tar.gz: 6922a4629f06dba48a05068301160e7861fcf9780d3a29552d65f6d4d9e16f2cbe1dab590b158990316def5c18f79f36a467eb8453a4b91a0378939b36f8684b
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/{LICENSE.md → LICENSE.adoc}
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
= Apache License
|
2
2
|
|
3
3
|
Version 2.0, January 2004
|
4
4
|
|
@@ -6,7 +6,7 @@ http://www.apache.org/licenses
|
|
6
6
|
|
7
7
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
8
8
|
|
9
|
-
|
9
|
+
== 1. Definitions
|
10
10
|
|
11
11
|
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by
|
12
12
|
Sections 1 through 9 of this document.
|
@@ -54,14 +54,14 @@ Contribution."
|
|
54
54
|
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a
|
55
55
|
Contribution has been received by Licensor and subsequently incorporated within the Work.
|
56
56
|
|
57
|
-
|
57
|
+
== 2. Grant of Copyright License
|
58
58
|
|
59
59
|
Subject to the terms and conditions of this License, each Contributor hereby grants to You a
|
60
60
|
perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to
|
61
61
|
reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and
|
62
62
|
distribute the Work and such Derivative Works in Source or Object form.
|
63
63
|
|
64
|
-
|
64
|
+
== 3. Grant of Patent License
|
65
65
|
|
66
66
|
Subject to the terms and conditions of this License, each Contributor hereby grants to You a
|
67
67
|
perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this
|
@@ -74,39 +74,38 @@ a Contribution incorporated within the Work constitutes direct or contributory p
|
|
74
74
|
then any patent licenses granted to You under this License for that Work shall terminate as of the
|
75
75
|
date such litigation is filed.
|
76
76
|
|
77
|
-
|
77
|
+
== 4. Redistribution
|
78
78
|
|
79
79
|
You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with
|
80
80
|
or without modifications, and in Source or Object form, provided that You meet the following
|
81
81
|
conditions:
|
82
82
|
|
83
|
-
|
83
|
+
. You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
84
84
|
|
85
|
-
|
86
|
-
|
85
|
+
. You must cause any modified files to carry prominent notices stating that You changed the files;
|
86
|
+
and
|
87
87
|
|
88
|
-
|
89
|
-
|
90
|
-
|
88
|
+
. You must retain, in the Source form of any Derivative Works that You distribute, all copyright,
|
89
|
+
patent, trademark, and attribution notices from the Source form of the Work, excluding those
|
90
|
+
notices that do not pertain to any part of the Derivative Works; and
|
91
91
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
construed as modifying the License.
|
92
|
+
. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works
|
93
|
+
that You distribute must include a readable copy of the attribution notices contained within such
|
94
|
+
NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in
|
95
|
+
at least one of the following places: within a NOTICE text file distributed as part of the
|
96
|
+
Derivative Works; within the Source form or documentation, if provided along with the Derivative
|
97
|
+
Works; or, within a display generated by the Derivative Works, if and wherever such third-party
|
98
|
+
notices normally appear. The contents of the NOTICE file are for informational purposes only and
|
99
|
+
do not modify the License. You may add Your own attribution notices within Derivative Works that
|
100
|
+
You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such
|
101
|
+
additional attribution notices cannot be construed as modifying the License.
|
103
102
|
|
104
103
|
You may add Your own copyright statement to Your modifications and may provide additional or
|
105
104
|
different license terms and conditions for use, reproduction, or distribution of Your modifications,
|
106
105
|
or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of
|
107
106
|
the Work otherwise complies with the conditions stated in this License.
|
108
107
|
|
109
|
-
|
108
|
+
== 5. Submission of Contributions
|
110
109
|
|
111
110
|
Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the
|
112
111
|
Work by You to the Licensor shall be under the terms and conditions of this License, without any
|
@@ -114,13 +113,13 @@ additional terms or conditions. Notwithstanding the above, nothing herein shall
|
|
114
113
|
the terms of any separate license agreement you may have executed with Licensor regarding such
|
115
114
|
Contributions.
|
116
115
|
|
117
|
-
|
116
|
+
== 6. Trademarks
|
118
117
|
|
119
118
|
This License does not grant permission to use the trade names, trademarks, service marks, or product
|
120
119
|
names of the Licensor, except as required for reasonable and customary use in describing the origin
|
121
120
|
of the Work and reproducing the content of the NOTICE file.
|
122
121
|
|
123
|
-
|
122
|
+
== 7. Disclaimer of Warranty
|
124
123
|
|
125
124
|
Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each
|
126
125
|
Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
@@ -129,7 +128,7 @@ TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. Y
|
|
129
128
|
responsible for determining the appropriateness of using or redistributing the Work and assume any
|
130
129
|
risks associated with Your exercise of permissions under this License.
|
131
130
|
|
132
|
-
|
131
|
+
== 8. Limitation of Liability
|
133
132
|
|
134
133
|
In no event and under no legal theory, whether in tort (including negligence), contract, or
|
135
134
|
otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or
|
@@ -139,7 +138,7 @@ License or out of the use or inability to use the Work (including but not limite
|
|
139
138
|
loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial
|
140
139
|
damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
141
140
|
|
142
|
-
|
141
|
+
== 9. Accepting Warranty or Additional Liability
|
143
142
|
|
144
143
|
While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee
|
145
144
|
for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights
|
@@ -151,11 +150,11 @@ additional liability.
|
|
151
150
|
|
152
151
|
END OF TERMS AND CONDITIONS
|
153
152
|
|
154
|
-
Copyright
|
153
|
+
Copyright link:https://www.alchemists.io[Alchemists].
|
155
154
|
|
156
155
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
|
157
|
-
compliance with the License. You may obtain a
|
158
|
-
the License.
|
156
|
+
compliance with the License. You may obtain a link:https://www.apache.org/licenses/LICENSE-2.0[copy]
|
157
|
+
of the License.
|
159
158
|
|
160
159
|
Unless required by applicable law or agreed to in writing, software distributed under the License is
|
161
160
|
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
data/README.adoc
ADDED
@@ -0,0 +1,254 @@
|
|
1
|
+
:toc: macro
|
2
|
+
:toclevels: 5
|
3
|
+
:figure-caption!:
|
4
|
+
|
5
|
+
= Versionaire
|
6
|
+
|
7
|
+
[link=http://badge.fury.io/rb/versionaire]
|
8
|
+
image::https://badge.fury.io/rb/versionaire.svg[Gem Version]
|
9
|
+
[link=https://circleci.com/gh/bkuhlmann/versionaire]
|
10
|
+
image::https://circleci.com/gh/bkuhlmann/versionaire.svg?style=svg[Circle CI Status]
|
11
|
+
|
12
|
+
Provides an immutable, thread-safe, and semantic version type when managing versions within your
|
13
|
+
applications.
|
14
|
+
|
15
|
+
toc::[]
|
16
|
+
|
17
|
+
== Features
|
18
|
+
|
19
|
+
* Provides https://semver.org[Semantic Versioning].
|
20
|
+
* Provides immutable, thread-safe version instances.
|
21
|
+
* Converts (casts) from a `String`, `Array`, `Hash`, or `Version` to a `Version`.
|
22
|
+
|
23
|
+
== Screencasts
|
24
|
+
|
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
|
+
|
28
|
+
== Requirements
|
29
|
+
|
30
|
+
. https://www.ruby-lang.org[Ruby 2.7.x].
|
31
|
+
|
32
|
+
== Setup
|
33
|
+
|
34
|
+
=== Production
|
35
|
+
|
36
|
+
To install, run:
|
37
|
+
|
38
|
+
[source,bash]
|
39
|
+
----
|
40
|
+
gem install versionaire
|
41
|
+
----
|
42
|
+
|
43
|
+
Add the following to your Gemfile:
|
44
|
+
|
45
|
+
[source,ruby]
|
46
|
+
----
|
47
|
+
gem "versionaire"
|
48
|
+
----
|
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
|
+
== Usage
|
69
|
+
|
70
|
+
=== Initialization
|
71
|
+
|
72
|
+
A new version can be initialized in a variety of ways:
|
73
|
+
|
74
|
+
[source,ruby]
|
75
|
+
----
|
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"
|
80
|
+
----
|
81
|
+
|
82
|
+
=== Equality
|
83
|
+
|
84
|
+
==== Value (`+#==+`)
|
85
|
+
|
86
|
+
Equality is deterimined by the state of the object. This means that a version is equal to another
|
87
|
+
version as long as all of the values (i.e. state) are equal to each other. Example:
|
88
|
+
|
89
|
+
[source,ruby]
|
90
|
+
----
|
91
|
+
version_a = Versionaire::Version[major: 1]
|
92
|
+
version_b = Versionaire::Version[major: 2]
|
93
|
+
version_c = Versionaire::Version[major: 1]
|
94
|
+
|
95
|
+
version_a == version_a # true
|
96
|
+
version_a == version_b # false
|
97
|
+
version_a == version_c # true
|
98
|
+
----
|
99
|
+
|
100
|
+
Knowning this, versions can be compared against one another too:
|
101
|
+
|
102
|
+
[source,ruby]
|
103
|
+
----
|
104
|
+
version_a > version_b # false
|
105
|
+
version_a < version_b # true
|
106
|
+
version_a.between? version_c, version_b # true
|
107
|
+
----
|
108
|
+
|
109
|
+
==== Hash (`#eql?`)
|
110
|
+
|
111
|
+
Behaves exactly as `#==`.
|
112
|
+
|
113
|
+
==== Case (`#===`)
|
114
|
+
|
115
|
+
Behaves exactly as `#==`.
|
116
|
+
|
117
|
+
==== Identity (`#equal?`)
|
118
|
+
|
119
|
+
Works like any other standard Ruby object where an object is equal only to itself.
|
120
|
+
|
121
|
+
[source,ruby]
|
122
|
+
----
|
123
|
+
version_a = Versionaire::Version[major: 1]
|
124
|
+
version_b = Versionaire::Version[major: 2]
|
125
|
+
version_c = Versionaire::Version[major: 1]
|
126
|
+
|
127
|
+
version_a.equal? version_a # true
|
128
|
+
version_a.equal? version_b # false
|
129
|
+
version_a.equal? version_c # false
|
130
|
+
----
|
131
|
+
|
132
|
+
=== Conversions
|
133
|
+
|
134
|
+
==== Function (Casting)
|
135
|
+
|
136
|
+
The `Versionaire::Version` function is provided for explicit casting to a version:
|
137
|
+
|
138
|
+
[source,ruby]
|
139
|
+
----
|
140
|
+
version = Versionaire::Version[major: 1]
|
141
|
+
|
142
|
+
Versionaire::Version "1.0.0"
|
143
|
+
Versionaire::Version [1, 0, 0]
|
144
|
+
Versionaire::Version major: 1, minor: 0, patch: 0
|
145
|
+
Versionaire::Version version
|
146
|
+
----
|
147
|
+
|
148
|
+
Each of these conversions will result in a version object that represents "`1.0.0`". When attempting
|
149
|
+
to convert an unsupported type, a `+Versionaire::Errors::Conversion+` exception will be thrown.
|
150
|
+
|
151
|
+
==== Implicit
|
152
|
+
|
153
|
+
Implicit conversion to a `+String+` is supported:
|
154
|
+
|
155
|
+
[source,ruby]
|
156
|
+
----
|
157
|
+
"1.0.0".match Versionaire::Version[major: 1] # <MatchData "1.0.0">
|
158
|
+
----
|
159
|
+
|
160
|
+
==== Explicit
|
161
|
+
|
162
|
+
Explicit conversion to a `String`, `Array`, or `Hash` is supported:
|
163
|
+
|
164
|
+
[source,ruby]
|
165
|
+
----
|
166
|
+
version = Versionaire::Version.new
|
167
|
+
|
168
|
+
version.to_s # "0.0.0"
|
169
|
+
version.to_a # [0, 0, 0]
|
170
|
+
version.to_h # {major: 0, minor: 0, patch: 0}
|
171
|
+
----
|
172
|
+
|
173
|
+
=== Comparisons
|
174
|
+
|
175
|
+
All versions are comparable which means any of the operators from the `+Comparable+` module will
|
176
|
+
work. Example:
|
177
|
+
|
178
|
+
[source,ruby]
|
179
|
+
----
|
180
|
+
version_1 = Versionaire::Version "1.0.0"
|
181
|
+
version_2 = Versionaire::Version "2.0.0"
|
182
|
+
|
183
|
+
version_1 < version_2 # true
|
184
|
+
version_1 <= version_2 # true
|
185
|
+
version_1 == version_2 # false (see Equality section above for details)
|
186
|
+
version_1 > version_2 # false
|
187
|
+
version_1 >= version_2 # false
|
188
|
+
version_1.between? version_1, version_2 # true
|
189
|
+
version_1.clamp version_1, version_2 # version_1 (added in Ruby 2.4.0)
|
190
|
+
----
|
191
|
+
|
192
|
+
=== Math
|
193
|
+
|
194
|
+
Versions can be added and subtracted from each other.
|
195
|
+
|
196
|
+
==== Addition
|
197
|
+
|
198
|
+
[source,ruby]
|
199
|
+
----
|
200
|
+
version_1 = Versionaire::Version[major: 1, minor: 2, patch: 3]
|
201
|
+
version_2 = Versionaire::Version[major: 2, minor: 5, patch: 7]
|
202
|
+
version_1 + version_2 # "3.7.10"
|
203
|
+
----
|
204
|
+
|
205
|
+
==== Subtraction
|
206
|
+
|
207
|
+
[source,ruby]
|
208
|
+
----
|
209
|
+
version_1 = Versionaire::Version[major: 1, minor: 2, patch: 3]
|
210
|
+
version_2 = Versionaire::Version[major: 1, minor: 1, patch: 1]
|
211
|
+
version_1 - version_2 # "0.1.2"
|
212
|
+
|
213
|
+
version_1 = Versionaire::Version[major: 1]
|
214
|
+
version_2 = Versionaire::Version[major: 5]
|
215
|
+
version_1 - version_2 # Fails with a Versionaire::Errors::NegativeNumber
|
216
|
+
----
|
217
|
+
|
218
|
+
== Tests
|
219
|
+
|
220
|
+
To test, run:
|
221
|
+
|
222
|
+
[source,bash]
|
223
|
+
----
|
224
|
+
bundle exec rake
|
225
|
+
----
|
226
|
+
|
227
|
+
== Versioning
|
228
|
+
|
229
|
+
Read link:https://semver.org[Semantic Versioning] for details. Briefly, it means:
|
230
|
+
|
231
|
+
* Major (X.y.z) - Incremented for any backwards incompatible public API changes.
|
232
|
+
* Minor (x.Y.z) - Incremented for new, backwards compatible, public API enhancements/fixes.
|
233
|
+
* Patch (x.y.Z) - Incremented for small, backwards compatible, bug fixes.
|
234
|
+
|
235
|
+
== Code of Conduct
|
236
|
+
|
237
|
+
Please note that this project is released with a link:CODE_OF_CONDUCT.adoc[CODE OF CONDUCT]. By
|
238
|
+
participating in this project you agree to abide by its terms.
|
239
|
+
|
240
|
+
== Contributions
|
241
|
+
|
242
|
+
Read link:CONTRIBUTING.adoc[CONTRIBUTING] for details.
|
243
|
+
|
244
|
+
== License
|
245
|
+
|
246
|
+
Read link:LICENSE.adoc[LICENSE] for details.
|
247
|
+
|
248
|
+
== History
|
249
|
+
|
250
|
+
Read link:CHANGES.adoc[CHANGES] for details.
|
251
|
+
|
252
|
+
== Credits
|
253
|
+
|
254
|
+
Engineered by link:https://www.alchemists.io/team/brooke_kuhlmann.html[Brooke Kuhlmann].
|
data/lib/versionaire/identity.rb
CHANGED
@@ -3,20 +3,9 @@
|
|
3
3
|
module Versionaire
|
4
4
|
# Gem identity information.
|
5
5
|
module Identity
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
def self.label
|
11
|
-
"Versionaire"
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.version
|
15
|
-
"8.0.1"
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.version_label
|
19
|
-
"#{label} #{version}"
|
20
|
-
end
|
6
|
+
NAME = "versionaire"
|
7
|
+
LABEL = "Versionaire"
|
8
|
+
VERSION = "8.1.0"
|
9
|
+
VERSION_LABEL = "#{LABEL} #{VERSION}"
|
21
10
|
end
|
22
11
|
end
|
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: 8.0
|
4
|
+
version: 8.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
@@ -10,9 +10,9 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
MIIC/
|
14
|
-
|
15
|
-
|
13
|
+
MIIC/jCCAeagAwIBAgIBAzANBgkqhkiG9w0BAQsFADAlMSMwIQYDVQQDDBpicm9v
|
14
|
+
a2UvREM9YWxjaGVtaXN0cy9EQz1pbzAeFw0yMDAzMTUxNDQ1MzJaFw0yMTAzMTUx
|
15
|
+
NDQ1MzJaMCUxIzAhBgNVBAMMGmJyb29rZS9EQz1hbGNoZW1pc3RzL0RDPWlvMIIB
|
16
16
|
IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6l1qpXTiomH1RfMRloyw7MiE
|
17
17
|
xyVx/x8Yc3EupdH7uhNaTXQGyORN6aOY//1QXXMHIZ9tW74nZLhesWMSUMYy0XhB
|
18
18
|
brs+KkurHnc9FnEJAbG7ebGvl/ncqZt72nQvaxpDxvuCBHgJAz+8i5wl6FhLw+oT
|
@@ -20,15 +20,15 @@ cert_chain:
|
|
20
20
|
D5vkU0YlAm1r98BymuJlcQ1qdkVEI1d48ph4kcS0S0nv1RiuyVb6TCAR3Nu3VaVq
|
21
21
|
3fPzZKJLZBx67UvXdbdicWPiUR75elI4PXpLIic3xytaF52ZJYyKZCNZJhNwfQID
|
22
22
|
AQABozkwNzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU0nzow9vc
|
23
|
-
2CdikiiE3fJhP/
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
23
|
+
2CdikiiE3fJhP/gY4ggwDQYJKoZIhvcNAQELBQADggEBAIHhAlD3po4sTYqacXaQ
|
24
|
+
XI9jIhrfMy//2PgbHWcETtlJPBeNUbbSNBABcllUHKqYsVDlSvSmss034KSWNR8F
|
25
|
+
bF1GcloicyvcCC4y6IoW4it0COAcdeaaxkxiBSgKdQFpff9REnDlIKK4uQ9lLxIo
|
26
|
+
Y2G5xubiziKZkyfWFuSr67PIjW3Bu673D1JVBArhA1qbgQmYQcy1CkGOjo+iO8Nf
|
27
|
+
7u/QSfBHb+r/bXhKscDgPpnKwbUmvgO2+94zJG9KsrmIydlzYfsD09aXKx0t6Xy4
|
28
|
+
2XV8FRa7/JimI07sPLC13eLY3xd/aYTi85Z782KIA4j0G8XEEWAX0ouBhlXPocZv
|
29
|
+
QWc=
|
30
30
|
-----END CERTIFICATE-----
|
31
|
-
date: 2020-
|
31
|
+
date: 2020-04-01 00:00:00.000000000 Z
|
32
32
|
dependencies:
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: bundler-audit
|
@@ -134,14 +134,14 @@ dependencies:
|
|
134
134
|
requirements:
|
135
135
|
- - "~>"
|
136
136
|
- !ruby/object:Gem::Version
|
137
|
-
version: '
|
137
|
+
version: '6.0'
|
138
138
|
type: :development
|
139
139
|
prerelease: false
|
140
140
|
version_requirements: !ruby/object:Gem::Requirement
|
141
141
|
requirements:
|
142
142
|
- - "~>"
|
143
143
|
- !ruby/object:Gem::Version
|
144
|
-
version: '
|
144
|
+
version: '6.0'
|
145
145
|
- !ruby/object:Gem::Dependency
|
146
146
|
name: rspec
|
147
147
|
requirement: !ruby/object:Gem::Requirement
|
@@ -232,11 +232,11 @@ email:
|
|
232
232
|
executables: []
|
233
233
|
extensions: []
|
234
234
|
extra_rdoc_files:
|
235
|
-
- README.
|
236
|
-
- LICENSE.
|
235
|
+
- README.adoc
|
236
|
+
- LICENSE.adoc
|
237
237
|
files:
|
238
|
-
- LICENSE.
|
239
|
-
- README.
|
238
|
+
- LICENSE.adoc
|
239
|
+
- README.adoc
|
240
240
|
- lib/versionaire.rb
|
241
241
|
- lib/versionaire/conversion.rb
|
242
242
|
- lib/versionaire/errors/base.rb
|
@@ -246,13 +246,14 @@ files:
|
|
246
246
|
- lib/versionaire/filler.rb
|
247
247
|
- lib/versionaire/identity.rb
|
248
248
|
- lib/versionaire/version.rb
|
249
|
-
homepage: https://
|
249
|
+
homepage: https://www.alchemists.io/projects/versionaire
|
250
250
|
licenses:
|
251
251
|
- Apache-2.0
|
252
252
|
metadata:
|
253
|
-
source_code_uri: https://github.com/bkuhlmann/versionaire
|
254
|
-
changelog_uri: https://github.com/bkuhlmann/versionaire/blob/master/CHANGES.md
|
255
253
|
bug_tracker_uri: https://github.com/bkuhlmann/versionaire/issues
|
254
|
+
changelog_uri: https://www.alchemists.io/projects/versionaire/changes.html
|
255
|
+
documentation_uri: https://www.alchemists.io/projects/versionaire
|
256
|
+
source_code_uri: https://github.com/bkuhlmann/versionaire
|
256
257
|
post_install_message:
|
257
258
|
rdoc_options: []
|
258
259
|
require_paths:
|
metadata.gz.sig
CHANGED
Binary file
|
data/README.md
DELETED
@@ -1,228 +0,0 @@
|
|
1
|
-
<p align="center">
|
2
|
-
<img src="versionaire.png" alt="Versionaire Icon"/>
|
3
|
-
</p>
|
4
|
-
|
5
|
-
# Versionaire
|
6
|
-
|
7
|
-
[![Gem Version](https://badge.fury.io/rb/versionaire.svg)](http://badge.fury.io/rb/versionaire)
|
8
|
-
[![Code Climate Maintainability](https://api.codeclimate.com/v1/badges/e61fa9230ecc0bfa6f07/maintainability)](https://codeclimate.com/github/bkuhlmann/versionaire/maintainability)
|
9
|
-
[![Code Climate Test Coverage](https://api.codeclimate.com/v1/badges/e61fa9230ecc0bfa6f07/test_coverage)](https://codeclimate.com/github/bkuhlmann/versionaire/test_coverage)
|
10
|
-
[![Circle CI Status](https://circleci.com/gh/bkuhlmann/versionaire.svg?style=svg)](https://circleci.com/gh/bkuhlmann/versionaire)
|
11
|
-
|
12
|
-
Provides an immutable, thread-safe, and semantic version type when managing versions within your
|
13
|
-
applications.
|
14
|
-
|
15
|
-
<!-- Tocer[start]: Auto-generated, don't remove. -->
|
16
|
-
|
17
|
-
## Table of Contents
|
18
|
-
|
19
|
-
- [Features](#features)
|
20
|
-
- [Screencasts](#screencasts)
|
21
|
-
- [Requirements](#requirements)
|
22
|
-
- [Setup](#setup)
|
23
|
-
- [Usage](#usage)
|
24
|
-
- [Initialization](#initialization)
|
25
|
-
- [Equality](#equality)
|
26
|
-
- [Value (`#==`)](#value-)
|
27
|
-
- [Hash (`#eql?`)](#hash-eql)
|
28
|
-
- [Case (`#===`)](#case-)
|
29
|
-
- [Identity (`#equal?`)](#identity-equal)
|
30
|
-
- [Conversions](#conversions)
|
31
|
-
- [Function (Casting)](#function-casting)
|
32
|
-
- [Implicit](#implicit)
|
33
|
-
- [Explicit](#explicit)
|
34
|
-
- [Comparisons](#comparisons)
|
35
|
-
- [Math](#math)
|
36
|
-
- [Addition](#addition)
|
37
|
-
- [Subtraction](#subtraction)
|
38
|
-
- [Tests](#tests)
|
39
|
-
- [Versioning](#versioning)
|
40
|
-
- [Code of Conduct](#code-of-conduct)
|
41
|
-
- [Contributions](#contributions)
|
42
|
-
- [License](#license)
|
43
|
-
- [History](#history)
|
44
|
-
- [Credits](#credits)
|
45
|
-
|
46
|
-
<!-- Tocer[finish]: Auto-generated, don't remove. -->
|
47
|
-
|
48
|
-
## Features
|
49
|
-
|
50
|
-
- Provides [Semantic Versioning](https://semver.org).
|
51
|
-
- Provides immutable, thread-safe version instances.
|
52
|
-
- Converts (casts) from a `String`, `Array`, `Hash`, or `Version` to a `Version`.
|
53
|
-
|
54
|
-
## Screencasts
|
55
|
-
|
56
|
-
[![asciicast](https://asciinema.org/a/291457.svg)](https://asciinema.org/a/291457)
|
57
|
-
|
58
|
-
## Requirements
|
59
|
-
|
60
|
-
1. [Ruby 2.7.x](https://www.ruby-lang.org).
|
61
|
-
|
62
|
-
## Setup
|
63
|
-
|
64
|
-
Type the following to install:
|
65
|
-
|
66
|
-
gem install versionaire
|
67
|
-
|
68
|
-
Add the following to your Gemfile:
|
69
|
-
|
70
|
-
gem "versionaire"
|
71
|
-
|
72
|
-
## Usage
|
73
|
-
|
74
|
-
### Initialization
|
75
|
-
|
76
|
-
A new version can be initialized in a variety of ways:
|
77
|
-
|
78
|
-
Versionaire::Version.new # "0.0.0"
|
79
|
-
Versionaire::Version[major: 1] # "1.0.0"
|
80
|
-
Versionaire::Version[major: 1, minor: 2] # "1.2.0"
|
81
|
-
Versionaire::Version[major: 1, minor: 2, patch: 3] # "1.2.3"
|
82
|
-
|
83
|
-
### Equality
|
84
|
-
|
85
|
-
#### Value (`#==`)
|
86
|
-
|
87
|
-
Equality is deterimined by the state of the object. This means that a version is equal to another
|
88
|
-
version as long as all of the values (i.e. state) are equal to each other. Example:
|
89
|
-
|
90
|
-
version_a = Versionaire::Version[major: 1]
|
91
|
-
version_b = Versionaire::Version[major: 2]
|
92
|
-
version_c = Versionaire::Version[major: 1]
|
93
|
-
|
94
|
-
version_a == version_a # true
|
95
|
-
version_a == version_b # false
|
96
|
-
version_a == version_c # true
|
97
|
-
|
98
|
-
Knowning this, versions can be compared against one another too:
|
99
|
-
|
100
|
-
version_a > version_b # false
|
101
|
-
version_a < version_b # true
|
102
|
-
version_a.between? version_c, version_b # true
|
103
|
-
|
104
|
-
#### Hash (`#eql?`)
|
105
|
-
|
106
|
-
Behaves exactly as `#==`.
|
107
|
-
|
108
|
-
#### Case (`#===`)
|
109
|
-
|
110
|
-
Behaves exactly as `#==`.
|
111
|
-
|
112
|
-
#### Identity (`#equal?`)
|
113
|
-
|
114
|
-
Works like any other standard Ruby object where an object is equal only to itself.
|
115
|
-
|
116
|
-
version_a = Versionaire::Version[major: 1]
|
117
|
-
version_b = Versionaire::Version[major: 2]
|
118
|
-
version_c = Versionaire::Version[major: 1]
|
119
|
-
|
120
|
-
version_a.equal? version_a # true
|
121
|
-
version_a.equal? version_b # false
|
122
|
-
version_a.equal? version_c # false
|
123
|
-
|
124
|
-
### Conversions
|
125
|
-
|
126
|
-
#### Function (Casting)
|
127
|
-
|
128
|
-
The `Versionaire::Version` function is provided for explicit casting to a version:
|
129
|
-
|
130
|
-
version = Versionaire::Version[major: 1]
|
131
|
-
|
132
|
-
Versionaire::Version "1.0.0"
|
133
|
-
Versionaire::Version [1, 0, 0]
|
134
|
-
Versionaire::Version major: 1, minor: 0, patch: 0
|
135
|
-
Versionaire::Version version
|
136
|
-
|
137
|
-
Each of these conversions will result in a version object that represents "1.0.0". When attempting
|
138
|
-
to convert an unsupported type, a `Versionaire::Errors::Conversion` exception will be thrown.
|
139
|
-
|
140
|
-
#### Implicit
|
141
|
-
|
142
|
-
Implicit conversion to a `String` is supported:
|
143
|
-
|
144
|
-
"1.0.0".match Versionaire::Version[major: 1] # <MatchData "1.0.0">
|
145
|
-
|
146
|
-
#### Explicit
|
147
|
-
|
148
|
-
Explicit conversion to a `String`, `Array`, or `Hash` is supported:
|
149
|
-
|
150
|
-
version = Versionaire::Version.new
|
151
|
-
|
152
|
-
version.to_s # "0.0.0"
|
153
|
-
version.to_a # [0, 0, 0]
|
154
|
-
version.to_h # {major: 0, minor: 0, patch: 0}
|
155
|
-
|
156
|
-
### Comparisons
|
157
|
-
|
158
|
-
All versions are comparable which means any of the operators from the `Comparable` module will work.
|
159
|
-
Example:
|
160
|
-
|
161
|
-
version_1 = Versionaire::Version "1.0.0"
|
162
|
-
version_2 = Versionaire::Version "2.0.0"
|
163
|
-
|
164
|
-
version_1 < version_2 # true
|
165
|
-
version_1 <= version_2 # true
|
166
|
-
version_1 == version_2 # false (see Equality section above for details)
|
167
|
-
version_1 > version_2 # false
|
168
|
-
version_1 >= version_2 # false
|
169
|
-
version_1.between? version_1, version_2 # true
|
170
|
-
version_1.clamp version_1, version_2 # version_1 (added in Ruby 2.4.0)
|
171
|
-
|
172
|
-
### Math
|
173
|
-
|
174
|
-
Versions can be added and subtracted from each other.
|
175
|
-
|
176
|
-
#### Addition
|
177
|
-
|
178
|
-
version_1 = Versionaire::Version[major: 1, minor: 2, patch: 3]
|
179
|
-
version_2 = Versionaire::Version[major: 2, minor: 5, patch: 7]
|
180
|
-
version_1 + version_2 # "3.7.10"
|
181
|
-
|
182
|
-
#### Subtraction
|
183
|
-
|
184
|
-
version_1 = Versionaire::Version[major: 1, minor: 2, patch: 3]
|
185
|
-
version_2 = Versionaire::Version[major: 1, minor: 1, patch: 1]
|
186
|
-
version_1 - version_2 # "0.1.2"
|
187
|
-
|
188
|
-
version_1 = Versionaire::Version[major: 1]
|
189
|
-
version_2 = Versionaire::Version[major: 5]
|
190
|
-
version_1 - version_2 # Fails with a Versionaire::Errors::NegativeNumber
|
191
|
-
|
192
|
-
## Tests
|
193
|
-
|
194
|
-
To test, run:
|
195
|
-
|
196
|
-
bundle exec rake
|
197
|
-
|
198
|
-
## Versioning
|
199
|
-
|
200
|
-
Read [Semantic Versioning](https://semver.org) for details. Briefly, it means:
|
201
|
-
|
202
|
-
- Major (X.y.z) - Incremented for any backwards incompatible public API changes.
|
203
|
-
- Minor (x.Y.z) - Incremented for new, backwards compatible, public API enhancements/fixes.
|
204
|
-
- Patch (x.y.Z) - Incremented for small, backwards compatible, bug fixes.
|
205
|
-
|
206
|
-
## Code of Conduct
|
207
|
-
|
208
|
-
Please note that this project is released with a [CODE OF CONDUCT](CODE_OF_CONDUCT.md). By
|
209
|
-
participating in this project you agree to abide by its terms.
|
210
|
-
|
211
|
-
## Contributions
|
212
|
-
|
213
|
-
Read [CONTRIBUTING](CONTRIBUTING.md) for details.
|
214
|
-
|
215
|
-
## License
|
216
|
-
|
217
|
-
Copyright 2016 [Alchemists](https://www.alchemists.io).
|
218
|
-
Read [LICENSE](LICENSE.md) for details.
|
219
|
-
|
220
|
-
## History
|
221
|
-
|
222
|
-
Read [CHANGES](CHANGES.md) for details.
|
223
|
-
Built with [Gemsmith](https://github.com/bkuhlmann/gemsmith).
|
224
|
-
|
225
|
-
## Credits
|
226
|
-
|
227
|
-
Developed by [Brooke Kuhlmann](https://www.alchemists.io) at
|
228
|
-
[Alchemists](https://www.alchemists.io).
|