useful_utilities 6.6.1 → 7.0.1
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/useful_utilities/redhat_release.rb +13 -9
- 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: ca26dcec0b9792d0f1028510f771e7f5662bbbfb7261e105a3f468792ac3dceb
|
4
|
+
data.tar.gz: b02e0ea6e43c649a0a815ed4ac2239626d11870c5d6acd3487a27c91ec49a7c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0d0ca043f84529767e4b0b4101e87687fdf545d428c9010910a4cefbac5ff1d8391732b9f5f7b1f70f8b6c21a33f39acf95dc33e4f2a152908610b6e110ca5d
|
7
|
+
data.tar.gz: 3300abc52d74f542e9b2d3103357f48d1e116ba21e00250a33d3525a6d0adcb3f2e85d0d8ee9e9ed972bc4642ab18322ca3feb6c6803dddb68fa927d6c4f0de3
|
@@ -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
|
-
(?=[[:space:]])
|
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.1
|
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.2.16
|
172
172
|
signing_key:
|
173
173
|
specification_version: 4
|
174
174
|
summary: Helpful methods for time, sizes, hashes etc.
|