debian_codename 0.2.0 → 1.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/debian_codename.rb +32 -5
- 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: e20e9d4a61f0222b1c3a4550a5fc8f50af1ac73b446a2b0e20ffa96ab2377e00
|
4
|
+
data.tar.gz: dac229d1fccf6e6f63b11ea0fba3a2ada0d6eb1c3b41d90e5e24fa4fd1d00641
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0df33843a57febb6de376e308c068a8c54c5c6d27917b30f809d062fb6cee25944884037696b88acf6833af72f3f7afafd15ec42fdba2c1a927c0c7186232389
|
7
|
+
data.tar.gz: 1fa53b11dcf85c2c7fdc19b5caaf24e601403964db8b48db6831e8063e4e1b9ef5d0374fc5edfe954736b8b677a737562ae85286e796014e79e301f82d2f46b8
|
data/lib/debian_codename.rb
CHANGED
@@ -73,18 +73,45 @@ module DebianCodename
|
|
73
73
|
|
74
74
|
module_function
|
75
75
|
|
76
|
-
#
|
77
|
-
# item.
|
76
|
+
# Convert from version string to codename and vice versa
|
78
77
|
def fast_find(user_search_string)
|
79
78
|
search_string = user_search_string.downcase
|
80
79
|
|
81
80
|
[DEBIAN_CODENAMES, UBUNTU_CODENAMES].each do |code_catalog|
|
82
|
-
return code_catalog
|
81
|
+
return codename(code_catalog, search_string) if code_catalog.key?(search_string)
|
83
82
|
|
84
|
-
|
85
|
-
return
|
83
|
+
version_found = code_catalog.find { |_, value| value[0] == search_string }
|
84
|
+
return version_found.first unless version_found.nil?
|
86
85
|
end
|
87
86
|
|
88
87
|
raise DebianCodenameError, "No match for #{user_search_string}"
|
89
88
|
end
|
89
|
+
|
90
|
+
# Return a canonical form (Hash with ':version' and ':codename' keys)
|
91
|
+
def find(user_search_string)
|
92
|
+
search_string = user_search_string.downcase
|
93
|
+
|
94
|
+
[DEBIAN_CODENAMES, UBUNTU_CODENAMES].each do |code_catalog|
|
95
|
+
if code_catalog.key?(search_string)
|
96
|
+
return {
|
97
|
+
version: search_string,
|
98
|
+
codename: codename(code_catalog, search_string)
|
99
|
+
}
|
100
|
+
end
|
101
|
+
|
102
|
+
version_found = code_catalog.find { |_, value| value[0] == search_string }
|
103
|
+
unless version_found.nil?
|
104
|
+
return {
|
105
|
+
version: version_found.first,
|
106
|
+
codename: search_string
|
107
|
+
}
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
raise DebianCodenameError, 'No match'
|
112
|
+
end
|
113
|
+
|
114
|
+
def codename(code_catalog, version_string)
|
115
|
+
code_catalog[version_string][0]
|
116
|
+
end
|
90
117
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: debian_codename
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet Release Engineering
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-01-
|
11
|
+
date: 2023-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Convert Debian/Ubuntu codenames to version numbers and vice-versa
|
14
14
|
email:
|