atk_toolbox 0.0.72 → 0.0.73
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 +4 -4
- data/lib/atk/version.rb +48 -12
- data/lib/atk/yaml_info_parser.rb +1 -1
- data/lib/atk_toolbox/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6bbdfa878da22ecddbecdc8b42aa91de1f1909fcf196fc42a8921f7ba50dbfd8
|
4
|
+
data.tar.gz: a9d50f7fb7088fc13367d208a8104beaa93fc09148ee28a922b95d2ea4df9d7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3fdad11b9fc752247b9e08fe0ee41b835417c0e2c9263319a6e07710029648beaa1e5eb128fe257290529023517f0888f9d07497f56c9e49cf3b1465884e821
|
7
|
+
data.tar.gz: 5e5ff39ad96783d852af79b776b224d834049ac47d42e4985052a6b629bff94794c9979d8b2b13ee17220a009f16407141d3c498e9d58b81d9517c5bb4733d0d
|
data/lib/atk/version.rb
CHANGED
@@ -1,38 +1,74 @@
|
|
1
1
|
# create a variable for the current ruby version
|
2
2
|
|
3
3
|
class Version
|
4
|
-
attr_accessor :major, :minor, :patch
|
4
|
+
attr_accessor :major, :minor, :patch, :levels
|
5
5
|
|
6
6
|
def initialize(version_as_string)
|
7
|
-
|
8
|
-
@
|
9
|
-
|
7
|
+
@levels = version_as_string.split('.')
|
8
|
+
@comparable = @levels[0] =~ /\A\d+\z/
|
9
|
+
# convert values into integers where possible
|
10
|
+
index = -1
|
11
|
+
for each in @levels.dup
|
12
|
+
index += 1
|
13
|
+
if each =~ /\A\d+\z/
|
14
|
+
@levels[index] = each.to_i
|
15
|
+
end
|
16
|
+
end
|
17
|
+
@major, @minor, @patch, *_ = @levels
|
18
|
+
end
|
19
|
+
|
20
|
+
def comparable?
|
21
|
+
return @comparable
|
10
22
|
end
|
11
23
|
|
12
24
|
def <=>(other_version)
|
13
25
|
if not other_version.is_a?(Version)
|
14
26
|
raise "When doing version comparision, both sides must be a version object"
|
15
27
|
end
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
28
|
+
if other_version.to_s == self.to_s
|
29
|
+
return 0
|
30
|
+
end
|
31
|
+
|
32
|
+
if other_version.comparable? && self.comparable?
|
33
|
+
self_levels = @levels.dup
|
34
|
+
other_levels = other_version.levels.dup
|
35
|
+
loop do
|
36
|
+
if self_levels.size == 0 || other_levels.size == 0
|
37
|
+
if self_levels.size > other_levels.size
|
38
|
+
return 1
|
39
|
+
elsif self_levels.size < other_levels.size
|
40
|
+
return -1
|
41
|
+
else
|
42
|
+
return 0
|
43
|
+
end
|
44
|
+
end
|
45
|
+
comparision = self_levels.shift() <=> other_levels.shift()
|
46
|
+
if comparision != 0
|
47
|
+
return comparision
|
48
|
+
end
|
49
|
+
end
|
50
|
+
else
|
51
|
+
return nil
|
52
|
+
end
|
20
53
|
end
|
21
54
|
|
22
55
|
def >(other_version)
|
23
|
-
|
56
|
+
value = (self <=> other_version)
|
57
|
+
return value && value == 1
|
24
58
|
end
|
25
59
|
|
26
60
|
def <(other_version)
|
27
|
-
|
61
|
+
value = (self <=> other_version)
|
62
|
+
return value && value == -1
|
28
63
|
end
|
29
64
|
|
30
65
|
def ==(other_version)
|
31
|
-
|
66
|
+
value = (self <=> other_version)
|
67
|
+
return value && value == 0
|
32
68
|
end
|
33
69
|
|
34
70
|
def to_s
|
35
|
-
return
|
71
|
+
return @levels.map(&:to_s).join('.')
|
36
72
|
end
|
37
73
|
end
|
38
74
|
|
data/lib/atk/yaml_info_parser.rb
CHANGED
data/lib/atk_toolbox/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: atk_toolbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.73
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Hykin
|
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
115
|
version: '0'
|
116
116
|
requirements: []
|
117
117
|
rubyforge_project:
|
118
|
-
rubygems_version: 2.7.
|
118
|
+
rubygems_version: 2.7.6.2
|
119
119
|
signing_key:
|
120
120
|
specification_version: 4
|
121
121
|
summary: The Ruby gem for all the standard tools ATK uses internally
|