firespring_dev_commands 2.1.1.pre.alpha.2 → 2.1.1.pre.alpha.4

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: 369c113ffd1b5a9c345d8123c4df7e5a635983cbdffbb9b9a2dadc8826be7fb5
4
- data.tar.gz: fa3643a4470b8f041af334969af99543ce7581bf088656a18bffae6ba2587e96
3
+ metadata.gz: 8dab91ae2bd3bcd7d38e4556e579bd785d2a04143fdd24a094bde154b9c65f2e
4
+ data.tar.gz: 2c4f44e0ec1b402800f42b591f53d30184b6344ae215f5a240fc0553cf5bd2a0
5
5
  SHA512:
6
- metadata.gz: 6cded404bdfaf2aa243fac1cf9a344fefad9023ab1cb7c339dba77f4ffec8acbd6f86d8c94baebc72d3e79d63dfba56c253a863b9d5c868379d9bad7cadcabef
7
- data.tar.gz: 3f272118fc39705182f6f7365a68bb67e9e3f9faf1e6e9fd4ef2043ea0e9a25e2472f80e01aa50a8f032662a0abe39d28944b8205b8065108ec447a8a1a363ec
6
+ metadata.gz: b6c919f2b2c53f1e24ff8918459b708a90a23d1952a7214ca59b25e4fdcc9f47c7b84b6adf212b34f34aa9ca71af53e859e9edf90e46cddfa993e4757781263f
7
+ data.tar.gz: 862c605e2ce123a63959bbf27dbd423928a495b6051c087ef9a44974c627d7096e2140e33faf512da272d36e1254c901ead5a3d91ac5dbd4fcd8473c134cc9ac
@@ -0,0 +1,97 @@
1
+ require_relative 'base_interface'
2
+
3
+ module Dev
4
+ module Template
5
+ # Contains all default rake tasks for a docker application
6
+ class Application
7
+ # Contains rake tasks for displaying and setting application variables in parameter store
8
+ class Config < Dev::Template::ApplicationInterface
9
+ attr_reader :path
10
+
11
+ # Allow for custom config path for the application
12
+ def initialize(name, path, exclude: [])
13
+ @path = path
14
+ super(name, exclude:)
15
+ end
16
+
17
+ # Create the list rake task
18
+ def create_list_task!
19
+ # Have to set a local variable to be accessible inside of the instance_eval block
20
+ application = @name
21
+ path = @path
22
+ exclude = @exclude
23
+
24
+ DEV_COMMANDS_TOP_LEVEL.instance_eval do
25
+ namespace application do
26
+ namespace :config do
27
+ return if exclude.include?(:list)
28
+
29
+ desc "List all #{application} configs"
30
+ task list: %w(init) do
31
+ puts
32
+ Dev::Aws::Parameter.new.list(path).each do |it|
33
+ puts " #{it.name} => #{it.value} (#{it.type})"
34
+ end
35
+ puts
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+
42
+ # rubocop:disable Metrics/MethodLength
43
+ # Create the set task
44
+ def create_set_task!
45
+ # Have to set a local variable to be accessible inside of the instance_eval block
46
+ application = @name
47
+ path = @path
48
+ exclude = @exclude
49
+
50
+ DEV_COMMANDS_TOP_LEVEL.instance_eval do
51
+ namespace application do
52
+ namespace :config do
53
+ return if exclude.include?(:set)
54
+
55
+ desc 'Updates the parameter with the given name to the new value' \
56
+ "\n\tspecify NAME as the name of the parameter to be set (it will be prefixed with the base path for this app)" \
57
+ "\n\tspecify VALUE is required and is the value you wish the paramete to be set to" \
58
+ "\n\toptionally specify ENCRYPT=true to change a String type to a SecureString type"
59
+ task set: %w(ensure_aws_credentials) do
60
+ raise 'NAME is required' if ENV['NAME'].to_s.strip.blank?
61
+ raise 'NAME is not found in this apps parameters' if Dev::Aws::Parameter.new.list(path).none? { |it| it.name == ENV['NAME'] }
62
+ raise 'VALUE is required' if ENV['VALUE'].to_s.strip.blank?
63
+
64
+ param_path = ENV.fetch('NAME', nil)
65
+ new_value = ENV.fetch('VALUE', nil)
66
+ old_value = Dev::Aws::Parameter.new.get(param_path)
67
+
68
+ params = {type: 'String'}
69
+ if ENV['ENCRYPT'].to_s.strip == 'true' || old_value.type == 'SecureString'
70
+ params[:type] = 'SecureString'
71
+ params[:key_id] = Dev::Aws::Parameter.new.get_value("#{path}/kms/id")
72
+ end
73
+
74
+ message = 'This will change '.light_green +
75
+ param_path.light_yellow +
76
+ ' from "'.light_green +
77
+ old_value.value.light_yellow +
78
+ '" ('.light_green +
79
+ old_value.type.light_yellow +
80
+ ') to "'.light_green +
81
+ new_value.light_yellow +
82
+ '" ('.light_green +
83
+ params[:type].light_yellow +
84
+ '). Continue'.light_green
85
+ Dev::Common.new.with_confirmation(message, color_message: false) do
86
+ Dev::Aws::Parameter.new.put(param_path, new_value, **params)
87
+ end
88
+ end
89
+ end
90
+ end
91
+ end
92
+ end
93
+ # rubocop:enable Metrics/MethodLength
94
+ end
95
+ end
96
+ end
97
+ 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.1.pre.alpha.2'.freeze
9
+ VERSION = '2.1.1.pre.alpha.4'.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.1.pre.alpha.2
4
+ version: 2.1.1.pre.alpha.4
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-11 00:00:00.000000000 Z
11
+ date: 2023-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -305,6 +305,7 @@ files:
305
305
  - lib/firespring_dev_commands/templates/aws.rb
306
306
  - lib/firespring_dev_commands/templates/base_interface.rb
307
307
  - lib/firespring_dev_commands/templates/ci.rb
308
+ - lib/firespring_dev_commands/templates/config.rb
308
309
  - lib/firespring_dev_commands/templates/docker/application.rb
309
310
  - lib/firespring_dev_commands/templates/docker/default.rb
310
311
  - lib/firespring_dev_commands/templates/docker/node/application.rb