firespring_dev_commands 2.1.2.pre.alpha.2 → 2.1.3.pre.alpha.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e10ea33dd48edb1c355dbc78a06414bebd91c064765b43de3b3b803402d90296
4
- data.tar.gz: d30b398a593794ef99c81781f92ac2494b4f62ecb3f899aed095d7940c319393
3
+ metadata.gz: 99853bd0ded5e80e210af8aba499cc56e82fba9e7c055cc57c2b34a041aa9931
4
+ data.tar.gz: 69deda63901b1338f1e4c1a712fa9b6da8e9c329f32b505a020e907ae2152518
5
5
  SHA512:
6
- metadata.gz: 36cdb73c9e42b6ee2088ceded7f9a796a39c5e386f7c6a75f77ed0a0ae84e7f44a0ef647e80e9ddb1f752471889b2114ac8b1d4ca003d89211f7ed4af0940df5
7
- data.tar.gz: 860d30fef0495f31400a3674f3a0ace8726c6c4c6e361d9b9e78f988e5fb66981f7a81cf8d3840b560f7d5294c5447a202ed6dccbb5a466984733420d03dfbf8
6
+ metadata.gz: bafca03ccf03807edbf6518f0134450701734a5d998c3257207b83a7981c999520d51ea0dd662c7f37b385a81a07ffba13a14b491435d83535f36c3e5e60a5bb
7
+ data.tar.gz: 64d7b998e256508fbfd40fed21e92b15515723ec2d3acde424cad39e4e56b48e3cf63c5b7a72d46c3e8cbac8777c3ab3208509275dc2974ea910725aee44d7ef
@@ -0,0 +1,36 @@
1
+ module Dev
2
+ class Common
3
+ class Platform
4
+ ALLOWED_ARCHITECTURES = %w(arm64 amd64).freeze
5
+
6
+ def determine_compute_architecture
7
+ case RUBY_PLATFORM
8
+ when /x86_64|amd64/
9
+ 'linux/amd64' # 64-bit Intel/AMD architecture
10
+ when /arm|aarch64/
11
+ 'linux/arm64' # ARM architecture
12
+ else
13
+ raise 'Unknown or unsupported architecture'
14
+ end
15
+ end
16
+
17
+ def architecture
18
+ docker_architecture = ENV['DOCKER_ARCHITECTURE'].to_s.strip.downcase
19
+ if docker_architecture.empty?
20
+ determine_compute_architecture
21
+ else
22
+ raise "Missing 'linux/' prefix in DOCKER_ARCHITECTURE: #{docker_architecture}" unless docker_architecture.start_with?('linux/')
23
+
24
+ architecture_name = docker_architecture.split('/')[1]
25
+
26
+ unless ALLOWED_ARCHITECTURES.include?(architecture_name)
27
+ raise "Invalid DOCKER_ARCHITECTURE: #{architecture_name}. Allowed architectures are #{ALLOWED_ARCHITECTURES.join(', ')}"
28
+ end
29
+
30
+ docker_architecture
31
+
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -6,14 +6,11 @@ module Dev
6
6
  class Application
7
7
  # Contains rake tasks for displaying and setting application variables in parameter store
8
8
  class Config < Dev::Template::ApplicationInterface
9
- attr_reader :path_prefix, :key_parameter_path
10
-
11
- # Allow for custom config path_prefix for the application
12
- # Allow for custom key parameter path (otherwise base it off the path prefix)
13
- def initialize(name, path_prefix, key_parameter_path: nil, exclude: [])
14
- @path_prefix = path_prefix
15
- @key_parameter_path = key_parameter_path || "#{path_prefix}/kms/id"
9
+ attr_reader :path
16
10
 
11
+ # Allow for custom config path for the application
12
+ def initialize(name, path, exclude: [])
13
+ @path = path
17
14
  super(name, exclude:)
18
15
  end
19
16
 
@@ -21,7 +18,7 @@ module Dev
21
18
  def create_list_task!
22
19
  # Have to set a local variable to be accessible inside of the instance_eval block
23
20
  application = @name
24
- path_prefix = @path_prefix
21
+ path = @path
25
22
  exclude = @exclude
26
23
 
27
24
  DEV_COMMANDS_TOP_LEVEL.instance_eval do
@@ -32,10 +29,8 @@ module Dev
32
29
  desc "List all #{application} configs"
33
30
  task list: %w(init) do
34
31
  puts
35
- puts "Listing all parameters which start with #{path_prefix}:".light_green
36
- puts
37
- Dev::Aws::Parameter.new.list(path_prefix).each do |it|
38
- puts " #{it.name.light_white} => #{it.value.light_white} (#{it.type})"
32
+ Dev::Aws::Parameter.new.list(path).each do |it|
33
+ puts " #{it.name} => #{it.value} (#{it.type})"
39
34
  end
40
35
  puts
41
36
  end
@@ -49,8 +44,7 @@ module Dev
49
44
  def create_set_task!
50
45
  # Have to set a local variable to be accessible inside of the instance_eval block
51
46
  application = @name
52
- path_prefix = @path_prefix
53
- key_parameter_path = @key_parameter_path
47
+ path = @path
54
48
  exclude = @exclude
55
49
 
56
50
  DEV_COMMANDS_TOP_LEVEL.instance_eval do
@@ -64,7 +58,7 @@ module Dev
64
58
  "\n\toptionally specify ENCRYPT=true to change a String type to a SecureString type"
65
59
  task set: %w(ensure_aws_credentials) do
66
60
  raise 'NAME is required' if ENV['NAME'].to_s.strip.blank?
67
- raise 'NAME is not found in this apps parameters' if Dev::Aws::Parameter.new.list(path_prefix).none? { |it| it.name == ENV['NAME'] }
61
+ raise 'NAME is not found in this apps parameters' if Dev::Aws::Parameter.new.list(path).none? { |it| it.name == ENV['NAME'] }
68
62
  raise 'VALUE is required' if ENV['VALUE'].to_s.strip.blank?
69
63
 
70
64
  param_path = ENV.fetch('NAME', nil)
@@ -74,7 +68,7 @@ module Dev
74
68
  params = {type: 'String'}
75
69
  if ENV['ENCRYPT'].to_s.strip == 'true' || old_value.type == 'SecureString'
76
70
  params[:type] = 'SecureString'
77
- params[:key_id] = Dev::Aws::Parameter.new.get_value(key_parameter_path)
71
+ params[:key_id] = Dev::Aws::Parameter.new.get_value("#{path}/kms/id")
78
72
  end
79
73
 
80
74
  message = 'This will change '.light_green +
@@ -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.2.pre.alpha.2'.freeze
9
+ VERSION = '2.1.3.pre.alpha.1'.freeze
10
10
  end
11
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: firespring_dev_commands
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2.pre.alpha.2
4
+ version: 2.1.3.pre.alpha.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Firespring
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-17 00:00:00.000000000 Z
11
+ date: 2023-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -293,6 +293,7 @@ files:
293
293
  - lib/firespring_dev_commands/node/audit.rb
294
294
  - lib/firespring_dev_commands/php.rb
295
295
  - lib/firespring_dev_commands/php/audit.rb
296
+ - lib/firespring_dev_commands/platform.rb
296
297
  - lib/firespring_dev_commands/rake.rb
297
298
  - lib/firespring_dev_commands/ruby.rb
298
299
  - lib/firespring_dev_commands/ruby/audit.rb