useful_utilities 6.6.1 → 7.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/useful_utilities/redhat_release.rb +12 -8
- data/lib/useful_utilities/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c90246d59d157abd2fbe447256485af3ae42e99411317dfe6a3d5f747b28b85f
|
4
|
+
data.tar.gz: e318b3af652c6a02a4a38f7ea9627b6ecba84fd8ca548e6046fd52c5e4c1a036
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46d7025f5ace0cb07ca5d4b7055b9dcb76edf26b194d84c9273208b0df2b895f1750198850a61772224f8ecf3d79ad09b1a99923ce539c80542539a3960d436c
|
7
|
+
data.tar.gz: c81c68a4470af3764d1000cbe691097619e78b8b1f5113546722763a0df39ca1da8e21600e4608def8b1b5d08c578e3e86396543d843fb0e8daa45ae6768db97
|
@@ -2,23 +2,27 @@ module UsefulUtilities
|
|
2
2
|
# Redhat releases utilities
|
3
3
|
class RedhatRelease
|
4
4
|
LEGACY_DISTRO_TEMPLATE = 'centos%{major_version}'.freeze
|
5
|
+
private_constant :LEGACY_DISTRO_TEMPLATE
|
5
6
|
|
6
7
|
VERSION_SEPARATOR = '.'.freeze # this may change to "dot" and "hyphen" if we allow not only final releases(beta, custom git builds, etc)
|
7
8
|
VERSION_SEPARATOR_REGEXP = Regexp.escape(VERSION_SEPARATOR).freeze # regexp to match single "dot" character
|
9
|
+
private_constant :VERSION_SEPARATOR, :VERSION_SEPARATOR_REGEXP
|
8
10
|
|
9
11
|
VERSION_REGEXP = %r{ # /etc/redhat-release samples: "CentOS Linux release 7.1.1503 (Core)", "Red Hat Enterprise Linux Server release 7.2 (Maipo)"
|
10
12
|
(?<=[[:space:]]) # positive lookbehind assertion: ensures that the preceding character matches single "space" character, but doesn't include this character in the matched text
|
11
|
-
(?<
|
13
|
+
(?<major>[[:digit:]]) # :major named capture group; it matches single digits
|
12
14
|
#{VERSION_SEPARATOR_REGEXP} # regexp for separator of version parts
|
13
|
-
(?<
|
14
|
-
(?: # grouping without capturing;
|
15
|
+
(?<minor>[[:digit:]]+) # :minor named capture group; it matches one or more sequential digits
|
16
|
+
(?: # grouping without capturing; patch version does not exist for versions of CentOS older then 7
|
15
17
|
#{VERSION_SEPARATOR_REGEXP} # regexp for separator of version parts
|
16
|
-
(?<
|
18
|
+
(?<patch>[[:digit:]]+) # :patch named capture group; it matches one or more sequential digits
|
17
19
|
)? # zero or one times quantifier(repetition metacharacter)
|
18
20
|
(?=[[:space:]]) # positive lookahead assertion: ensures that the following character matches single "space" character, but doesn't include this character in the matched text
|
19
21
|
}x.freeze
|
22
|
+
private_constant :VERSION_REGEXP
|
20
23
|
|
21
24
|
DEFAULT_VERSION_ARR = [6, 0].freeze
|
25
|
+
private_constant :DEFAULT_VERSION_ARR
|
22
26
|
|
23
27
|
attr_reader :release_string
|
24
28
|
|
@@ -42,7 +46,7 @@ module UsefulUtilities
|
|
42
46
|
version_arr[1]
|
43
47
|
end
|
44
48
|
|
45
|
-
def
|
49
|
+
def patch_version
|
46
50
|
version_arr[2]
|
47
51
|
end
|
48
52
|
|
@@ -58,9 +62,9 @@ module UsefulUtilities
|
|
58
62
|
|
59
63
|
def match_version_arr
|
60
64
|
@match_version_arr ||= [
|
61
|
-
version_match[:
|
62
|
-
version_match[:
|
63
|
-
version_match[:
|
65
|
+
version_match[:major],
|
66
|
+
version_match[:minor],
|
67
|
+
version_match[:patch]
|
64
68
|
].compact.map(&:to_i)
|
65
69
|
end
|
66
70
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: useful_utilities
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 7.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OnApp Ltd.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 1980-01-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -168,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
168
168
|
- !ruby/object:Gem::Version
|
169
169
|
version: '0'
|
170
170
|
requirements: []
|
171
|
-
rubygems_version: 3.
|
171
|
+
rubygems_version: 3.3.20
|
172
172
|
signing_key:
|
173
173
|
specification_version: 4
|
174
174
|
summary: Helpful methods for time, sizes, hashes etc.
|