versionaire 7.1.0 → 7.2.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/README.md +10 -10
- data/lib/versionaire/conversion.rb +11 -11
- data/lib/versionaire/identity.rb +1 -1
- data/lib/versionaire/version.rb +9 -1
- metadata +13 -14
- 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: f5ad83ad73daa56d1e2e0b0d7048cb79e8ef234af33bb71fb09d9d6b50000d66
|
4
|
+
data.tar.gz: 64bef36a76f1590a9209356973150d288ced2811cf1e8a60ded4fd376c92782f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a6e8122fc30d451751d5f705ea2155a0476b5fa258b22a1620df9bf3fd80833dc298b515dbb4a0595eb8c15c611f69b7cedf411b8c8c4b0a8817c055c829cff
|
7
|
+
data.tar.gz: ed363f7d8b928fefdbd0127dd8397a4560b746f7404c92406fc6f906c5b8898575114fd4efa44c7ecd1c099ea1209b67d256bdc8e7f88ca832e98d23f1ea7857
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/README.md
CHANGED
@@ -153,16 +153,16 @@ Explicit conversion to a `String`, `Array`, or `Hash` is supported:
|
|
153
153
|
All versions are comparable which means any of the operators from the `Comparable` module will work.
|
154
154
|
Example:
|
155
155
|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
156
|
+
version_1 = Versionaire::Version "1.0.0"
|
157
|
+
version_2 = Versionaire::Version "2.0.0"
|
158
|
+
|
159
|
+
version_1 < version_2 # true
|
160
|
+
version_1 <= version_2 # true
|
161
|
+
version_1 == version_2 # false (see Equality section above for details)
|
162
|
+
version_1 > version_2 # false
|
163
|
+
version_1 >= version_2 # false
|
164
|
+
version_1.between? version_1, version_2 # true
|
165
|
+
version_1.clamp version_1, version_2 # version_1 (added in Ruby 2.4.0)
|
166
166
|
|
167
167
|
### Math
|
168
168
|
|
@@ -20,20 +20,20 @@ module Versionaire
|
|
20
20
|
|
21
21
|
# Aids with converting objects into valid versions.
|
22
22
|
class Converter
|
23
|
-
def initialize
|
24
|
-
@
|
23
|
+
def initialize object
|
24
|
+
@object = object
|
25
25
|
end
|
26
26
|
|
27
27
|
def from_string
|
28
28
|
body = %(Use: "<major>.<minor>.<maintenance>" or "v<major>.<minor>.<maintenance>".)
|
29
|
-
fail(Errors::Conversion, error_message(
|
29
|
+
fail(Errors::Conversion, error_message(object, body)) unless Version.regex.match? object
|
30
30
|
|
31
31
|
Version.new string_to_arguments
|
32
32
|
end
|
33
33
|
|
34
34
|
def from_array
|
35
35
|
body = "Use: [], [<major>], [<major>, <minor>], or [<major>, <minor>, <maintenance>]."
|
36
|
-
fail(Errors::Conversion, error_message(
|
36
|
+
fail(Errors::Conversion, error_message(object, body)) unless (0..3).cover?(object.size)
|
37
37
|
|
38
38
|
Version.new array_to_arguments
|
39
39
|
end
|
@@ -42,29 +42,29 @@ module Versionaire
|
|
42
42
|
body = "Use: {major: <major>}, " \
|
43
43
|
"{major: <major>, minor: <minor>}, or " \
|
44
44
|
"{major: <major>, minor: <minor>, maintenance: <maintenance>}."
|
45
|
-
fail(Errors::Conversion, error_message(
|
45
|
+
fail(Errors::Conversion, error_message(object, body)) unless required_keys?
|
46
46
|
|
47
|
-
Version.new
|
47
|
+
Version.new object
|
48
48
|
end
|
49
49
|
|
50
50
|
def from_object
|
51
|
-
fail Errors::Conversion, error_message(
|
51
|
+
fail Errors::Conversion, error_message(object, "Use: String, Array, Hash, or Version.")
|
52
52
|
end
|
53
53
|
|
54
54
|
private
|
55
55
|
|
56
|
-
attr_reader :
|
56
|
+
attr_reader :object
|
57
57
|
|
58
58
|
def string_to_arguments
|
59
|
-
Version.arguments(*
|
59
|
+
Version.arguments(*object.tr("v", "").split(".").map(&:to_i))
|
60
60
|
end
|
61
61
|
|
62
62
|
def array_to_arguments
|
63
|
-
Version.arguments(*
|
63
|
+
Version.arguments(*object.dup.fill(0, object.size..2))
|
64
64
|
end
|
65
65
|
|
66
66
|
def required_keys?
|
67
|
-
|
67
|
+
object.keys.all? { |key| VERSION_ATTRIBUTES.include? key }
|
68
68
|
end
|
69
69
|
|
70
70
|
def error_message object, body
|
data/lib/versionaire/identity.rb
CHANGED
data/lib/versionaire/version.rb
CHANGED
@@ -7,6 +7,8 @@ module Versionaire
|
|
7
7
|
# An immutable, semantic version value object.
|
8
8
|
# rubocop:disable Metrics/BlockLength
|
9
9
|
Version = Struct.new :major, :minor, :maintenance, keyword_init: true do
|
10
|
+
include Comparable
|
11
|
+
|
10
12
|
def self.regex
|
11
13
|
/
|
12
14
|
\A # Start of string.
|
@@ -39,12 +41,18 @@ module Versionaire
|
|
39
41
|
klass.new klass.arguments(*reduce(other, :-))
|
40
42
|
end
|
41
43
|
|
44
|
+
def == other
|
45
|
+
hash == other.hash
|
46
|
+
end
|
47
|
+
|
48
|
+
alias_method :eql?, :==
|
49
|
+
|
42
50
|
def <=> other
|
43
51
|
to_s <=> other.to_s
|
44
52
|
end
|
45
53
|
|
46
54
|
def to_s
|
47
|
-
|
55
|
+
to_a.join VERSION_DELIMITER
|
48
56
|
end
|
49
57
|
|
50
58
|
alias_method :to_str, :to_s
|
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: 7.
|
4
|
+
version: 7.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
@@ -10,26 +10,25 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-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4C0MlBjoDktsT+2IyLol1KmkDB20ExJ4Sf1GRNdA
|
26
|
+
hpWOtcgqHtmrc7xzgB6BuyoYufrKKUlCO3ewTM4C375D2qO7hIdKuMOO3CdPMtSk
|
27
|
+
OrWpbzCL+nbbXqeoqiHgZaUvcyyQrGj5sQRxMTzuMXzzQxtHnuTuKrcz16HMTX/O
|
28
|
+
dKvURM+1PwDCzC5tvRwjhUJIizau6+MtkFCvJHmaAj1aZL3odcPejHj5Hxt/0CUW
|
29
|
+
y84=
|
31
30
|
-----END CERTIFICATE-----
|
32
|
-
date: 2019-02-
|
31
|
+
date: 2019-02-17 00:00:00.000000000 Z
|
33
32
|
dependencies:
|
34
33
|
- !ruby/object:Gem::Dependency
|
35
34
|
name: awesome_print
|
metadata.gz.sig
CHANGED
Binary file
|