debian_codename 0.2.0

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.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/debian_codename.rb +90 -0
  3. metadata +46 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 78b5e4e8d7b141d02e8986d7c7f6ced3a07a1c9dd8bd8f6fe75dcb96e892f74d
4
+ data.tar.gz: c7cc6214ce8b243c32dfb2a1251b0a2497a03b754743858dee2271847cd69e37
5
+ SHA512:
6
+ metadata.gz: d3dcb7ebd8093be1954581c4c1c261cc2f069f2f919faa92d401e26935f74125c24aa33d292c0eb9459bd1e30fe4d2dddfee48714c2fcad81324b44afd523152
7
+ data.tar.gz: cbb9184b43e25989750f542692e027037ab087250b269e58d9825e6d6a98627ca9a133bef8ebc078ec91b9b4a9b70041cda66a68397f170b1c8116dfd9531269
@@ -0,0 +1,90 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DebianCodename
4
+ class DebianCodenameError < StandardError; end
5
+
6
+ # Codenames need to be all lower case
7
+
8
+ # https://wiki.debian.org/DebianReleases#Production_Releases
9
+ DEBIAN_CODENAMES = {
10
+ '14' => %w[forky],
11
+ '13' => %w[trixie],
12
+ '12' => %w[bookworm],
13
+ '11' => %w[bullseye],
14
+ '10' => %w[buster],
15
+ '9' => %w[stretch],
16
+ '8' => %w[jessie],
17
+ '7' => %w[wheezy],
18
+ '6.0' => %w[squeeze],
19
+ '5.0' => %w[lenny],
20
+ '4.0' => %w[etch],
21
+ '3.1' => %w[sarge],
22
+ '3.0' => %w[woody],
23
+ '2.2' => %w[potato],
24
+ '2.1' => %w[slink],
25
+ '2.0' => %w[hamm],
26
+ '1.3' => %w[bo],
27
+ '1.2' => %w[rex],
28
+ '1.1' => %w[buzz]
29
+ }.freeze
30
+
31
+ # https://wiki.ubuntu.com/DevelopmentCodeNames
32
+ # https://wiki.ubuntu.com/Releases
33
+ # Codename nouns ignored here at the moment but kept for consistency and possible future
34
+ # improvements
35
+ UBUNTU_CODENAMES = {
36
+ '23.04' => %w[lunar lobster],
37
+ '22.10' => %w[kinetic kudu],
38
+ '22.04' => %w[jammy jellyfish],
39
+ '20.10' => %w[groovy gorilla],
40
+ '20.04' => %w[focal fossa],
41
+ '19.10' => %w[eoan ermine],
42
+ '19.04' => %w[disco dingo],
43
+ '18.10' => %w[cosmic cuttlefish],
44
+ '18.04' => %w[bionic beaver],
45
+ '17.10' => %w[artful aardvark],
46
+ '17.04' => %w[zesty zapus],
47
+ '16.10' => %w[yakkety yak],
48
+ '16.04' => %w[xenial xerus],
49
+ '15.10' => %w[wily werewolf],
50
+ '15.04' => %w[vivid vervet],
51
+ '14.10' => %w[utopic unicorn],
52
+ '14.04' => %w[trusty tahr],
53
+ '13.10' => %w[saucy salamander],
54
+ '13.05' => %w[raring ringtail],
55
+ '12.10' => %w[quantal quetzal],
56
+ '12.04' => %w[precise pangolin],
57
+ '11.10' => %w[oneiric ocelot],
58
+ '11.04' => %w[natty narwhal],
59
+ '10.10' => %w[maverick meerkat],
60
+ '10.04' => %w[lucid lynx],
61
+ '9.10' => %w[karmic koala],
62
+ '9.04' => %w[jaunty jackalope],
63
+ '8.10' => %w[intrepid ibex],
64
+ '8.04' => %w[hardy heron],
65
+ '7.10' => %w[gutsy gibbon],
66
+ '7.04' => %w[feisty fawn],
67
+ '6.10' => %w[edgy eft],
68
+ '6.06' => %w[dapper drake],
69
+ '5.10' => %w[breezy badger],
70
+ '5.04' => %w[hoary hedgehog],
71
+ '4.10' => %w[warty warthog]
72
+ }.freeze
73
+
74
+ module_function
75
+
76
+ # Whether version number or codename is the user_search_string, return the matching
77
+ # item.
78
+ def fast_find(user_search_string)
79
+ search_string = user_search_string.downcase
80
+
81
+ [DEBIAN_CODENAMES, UBUNTU_CODENAMES].each do |code_catalog|
82
+ return code_catalog[search_string][0] if code_catalog.key?(search_string)
83
+
84
+ key = code_catalog.find { |_key, value| value[0] == search_string }
85
+ return key.first unless key.nil?
86
+ end
87
+
88
+ raise DebianCodenameError, "No match for #{user_search_string}"
89
+ end
90
+ end
metadata ADDED
@@ -0,0 +1,46 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: debian_codename
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - Puppet Release Engineering
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-01-05 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Convert Debian/Ubuntu codenames to version numbers and vice-versa
14
+ email:
15
+ - release@puppet.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/debian_codename.rb
21
+ homepage: https://github.com/puppetlabs/debian_codename
22
+ licenses: []
23
+ metadata:
24
+ homepage_uri: https://github.com/puppetlabs/debian_codename
25
+ source_code_uri: https://github.com/puppetlabs/debian_codename
26
+ changelog_uri: https://github.com/puppetlabs/debian_codename/CHANGELOG.md
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: 2.4.0
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ requirements: []
42
+ rubygems_version: 3.0.3
43
+ signing_key:
44
+ specification_version: 4
45
+ summary: Convert Debian/Ubuntu codenames to version numbers and vice-versa
46
+ test_files: []