firespring_dev_commands 2.1.27.pre.alpha.1 → 2.1.27.pre.alpha.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1f810ca7ab797bb1ec56674b67d42de056d5f88cd95a8e9c45b67d26a3570d19
4
- data.tar.gz: 487bdc8a74717f11bb48b5b81a33093fde87ddb2b44d97cdf84a0372e3b93627
3
+ metadata.gz: fce5da47cf928179b220c2d30c295fb5c853aee03ca1cad7bbf9684f8b8aea3a
4
+ data.tar.gz: 33100d5b2127c7cb422f6695e19e85b3f8bfe41d0dd13f7f0ab4f4721351286b
5
5
  SHA512:
6
- metadata.gz: 212273f4a640214bf8001c12419f33bb6dc621dc37a29b95e75d06c5b5e4bd3f7b7231c003cd032ed1be1c2dc0667d3474fb74892a7577ddd57eca248d96ab09
7
- data.tar.gz: 480720fd9de858a1ce969644958e61238e866fef1126fb91909992eca3301275d04fd42df45c1f34a7c5126758172a4c89f7bfc0ea3c1b8e2528816de97dbfba
6
+ metadata.gz: fb735b569248c55a15bd51bb971054107ea1d885fb08e4a2da43bafdc3093b86daf00c42962fcb0ce4aeb543e76afff8ca06be4359bbbd4c489dc83c09d46bc6
7
+ data.tar.gz: 4e43a5eee15f6dbbbeab27c006a0dbdb1802be2c882008627b4d1025f99e72a52d3855c8121eba967b21fba4f766daf1e2f0e90e11bb06ab32f7c6e110f86d7e
@@ -43,7 +43,7 @@ module Dev
43
43
  def save(dest_dir)
44
44
  raise "directory #{dest_dir} must be an existing directory" unless File.directory?(dest_dir)
45
45
 
46
- domain = domains.first.sub(/^\*\./, '')
46
+ domain = domains.first.sub(/^\*\./, '') # Need to strip off the '*.' if this is a wildcard cert
47
47
  directories = Dir.glob("/etc/letsencrypt/live/#{domain}*/")
48
48
  no_suffix = directories.delete("/etc/letsencrypt/live/#{domain}/")
49
49
  biggest_suffix = directories.max
@@ -144,7 +144,7 @@ module Dev
144
144
  puts "\nPulling #{name}:#{tag}"
145
145
  opts = {
146
146
  fromImage: "#{name}:#{tag}",
147
- platform: Dev::Common::Platform.new.architecture
147
+ platform: Dev::Platform.new.architecture
148
148
  }
149
149
  ::Docker::Image.create(**opts) { |response| Dev::Docker::Status.new.response_callback(response) }
150
150
  end
@@ -1,40 +1,33 @@
1
1
  module Dev
2
- class Common
3
- # Class which returns information about the current platform
4
- class Platform
5
- # Constant containing all supported architectures
6
- ALLOWED_ARCHITECTURES = %w(arm64 amd64).freeze
2
+ # Class which returns information about the current platform
3
+ class Platform
4
+ # Constant containing all supported architectures
5
+ ALLOWED_ARCHITECTURES = %w(linux/arm64 linux/amd64).freeze
7
6
 
8
- # Normalize the ruby platform to return a docker platform architecture format
9
- def determine_compute_architecture
10
- case RUBY_PLATFORM
11
- when /x86_64|amd64|x64-mingw/
12
- 'linux/amd64' # 64-bit Intel/AMD architecture
13
- when /arm|aarch64/
14
- 'linux/arm64' # ARM architecture
15
- else
16
- raise 'Unknown or unsupported architecture'
17
- end
18
- end
7
+ # If an architecture was specified in the ENV, use that. Otherwise auto-deted based of the OS reported architecture
8
+ def architecture
9
+ arch = env_architecture || os_architecture
10
+ raise "Invalid DOCKER_ARCHITECTURE: #{arch} (allowed are #{ALLOWED_ARCHITECTURES.join(', ')})" unless ALLOWED_ARCHITECTURES.include?(arch)
19
11
 
20
- # Determine the platform architecture
21
- # If one was specified in the DOCKER_ARCHITECTURE variable, use it
22
- # Otherwise, use the RUBY_PLATFORM built-in to auto-detect and architecture
23
- def architecture
24
- docker_architecture = ENV['DOCKER_ARCHITECTURE'].to_s.strip.downcase
25
- if docker_architecture.empty?
26
- determine_compute_architecture
27
- else
28
- raise "Missing 'linux/' prefix in DOCKER_ARCHITECTURE: #{docker_architecture}" unless docker_architecture.start_with?('linux/')
12
+ arch
13
+ end
14
+
15
+ # Check to see if a docker architecture has been specified in the ENV
16
+ # If it has, verify the format and the value
17
+ private def env_architecture
18
+ arch = ENV['DOCKER_ARCHITECTURE'].to_s.strip.downcase
19
+ return nil if arch.empty?
20
+
21
+ "linux/#{arch}" unless arch.start_with?('linux/')
22
+ arch
23
+ end
29
24
 
30
- architecture_name = docker_architecture.split('/')[1]
31
- unless ALLOWED_ARCHITECTURES.include?(architecture_name)
32
- raise "Invalid DOCKER_ARCHITECTURE: #{architecture_name}. Allowed architectures are #{ALLOWED_ARCHITECTURES.join(', ')}"
33
- end
25
+ # Returns a valid docker architecture based off the RUBY_PLATFORM
26
+ private def os_architecture
27
+ return 'linux/amd64' if RUBY_PLATFORM.match?(/x86_64|amd64|x64-mingw/)
28
+ return 'linux/arm64' if RUBY_PLATFORM.match?(/arm|aarch64/)
34
29
 
35
- docker_architecture
36
- end
37
- end
30
+ raise 'Unknown or unsupported architecture'
38
31
  end
39
32
  end
40
33
  end
@@ -4,10 +4,10 @@ module Dev
4
4
  module Template
5
5
  # Class contains rake templates for managing configured certificates
6
6
  class Certificate < Dev::Template::BaseInterface
7
- attr_reader :names, :email, :paths
7
+ attr_reader :domains, :email, :paths
8
8
 
9
- def initialize(names, email:, paths:, exclude: [])
10
- @names = names
9
+ def initialize(domains, email:, paths:, exclude: [])
10
+ @domains = domains
11
11
  @email = email
12
12
  @paths = Array(paths)
13
13
 
@@ -17,7 +17,7 @@ module Dev
17
17
  # Create the rake task for the generate method
18
18
  def create_generate_task!
19
19
  # Have to set a local variable to be accessible inside of the instance_eval block
20
- names = @names
20
+ domains = @domains
21
21
  email = @email
22
22
  paths = @paths
23
23
  exclude = @exclude
@@ -29,7 +29,7 @@ module Dev
29
29
  desc 'Requests a new certificate for the configured domain using the route53 validation and deposits it in the configured paths'
30
30
  task generate: %w(init_docker ensure_aws_credentials) do
31
31
  Dev::Docker.new.pull_image('certbot/dns-route53', 'latest')
32
- c = Dev::Certificate.new(names, email)
32
+ c = Dev::Certificate.new(domains, email)
33
33
  c.request
34
34
  paths.each { |path| c.save(path) }
35
35
  end
@@ -6,6 +6,6 @@ module Dev
6
6
  # Use 'v.v.v.pre.alpha.v' for pre-release vesions
7
7
  # Use 'v.v.v.beta.v for beta versions
8
8
  # Use semantic versioning for any releases (https://semver.org/)
9
- VERSION = '2.1.27.pre.alpha.1'.freeze
9
+ VERSION = '2.1.27.pre.alpha.2'.freeze
10
10
  end
11
11
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: firespring_dev_commands
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.27.pre.alpha.1
4
+ version: 2.1.27.pre.alpha.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Firespring