firespring_dev_commands 1.4.0 → 1.4.1.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: 4e9e462aab0f6e7fd67c1353efd21a9fffb4d2559e4905107a85daf480d473ea
4
- data.tar.gz: 287866a582fea3418bc3c4742bee30819fdcace8bd28bb62ae6b4dd85b90338a
3
+ metadata.gz: 8d5c83227c864815ba6ed74cce07031d65aaa9908ff7f181c37431afaf3f7100
4
+ data.tar.gz: b122efd2b6ad1cc1fff4aad60b74eca2d87cc1e035d33fe036cd97ca30353e0d
5
5
  SHA512:
6
- metadata.gz: cdac913916470054983e29d73788b76c46120149e22a82c59707aea02b28ea83c69b8db42ef0fd6ba06ba763bad04faf25bf8714e0ab1a629a704370fef9f0ce
7
- data.tar.gz: 33991ca03cb4a4435e526c202ba3b8ae271eb1dd66276dedf6e398b3841d4e76bab5e586fa4adf3e7a89db4ccbda25e2297d7c54f474961f51953aa54449ddcf
6
+ metadata.gz: 2f6a128a17f3ad6fd648bd97b367d8801c93f6ae553ad8407d58f7f1d3d94596c4f463886686c79b5e823176bf36b55f79b6c43181763cca9550f72ba0416863
7
+ data.tar.gz: 8a9d0c35277921095686e27a68eaf70d59ac09ac394d2016d76abef740c9bdd718e2a45e2bc13c041a26d2155f67aa87c24f554e4cf31e17259ab1b0699cbb2d
@@ -50,6 +50,16 @@ module Dev
50
50
  puts " export AWS_SESSION_TOKEN=#{ENV.fetch('AWS_SESSION_TOKEN', nil)}"
51
51
  puts
52
52
  end
53
+
54
+ # Print the export commands for the current credentials
55
+ def export_info
56
+ Dev::Aws::Credentials.new.export!
57
+ puts "export AWS_DEFAULT_REGION=#{ENV.fetch('AWS_DEFAULT_REGION', nil)}"
58
+ puts "export AWS_ACCESS_KEY_ID=#{ENV.fetch('AWS_ACCESS_KEY_ID', nil)}"
59
+ puts "export AWS_SECRET_ACCESS_KEY=#{ENV.fetch('AWS_SECRET_ACCESS_KEY', nil)}"
60
+ puts "export AWS_SESSION_TOKEN=#{ENV.fetch('AWS_SESSION_TOKEN', nil)}"
61
+ puts
62
+ end
53
63
  end
54
64
  end
55
65
  end
@@ -31,6 +31,13 @@ module Dev
31
31
  task profile: %w(init) do
32
32
  Dev::Aws::Profile.new.info
33
33
  end
34
+
35
+ namespace :profile do
36
+ desc 'Return the commands to export your AWS credentials into your environment'
37
+ task export: %w(init) do
38
+ Dev::Aws::Profile.new.export_info
39
+ end
40
+ end
34
41
  end
35
42
  end
36
43
  end
@@ -118,9 +118,9 @@ DEV_COMMANDS_TOP_LEVEL.instance_eval do
118
118
 
119
119
  # Define an empty _pre_down_hooks handler which can be overridden by the user
120
120
  task :_pre_down_hooks do
121
- # The user may define custom _pre_logs_hooks tasks to add any pre-logs actions the logs process
122
- # Define this process in the appropriate namespace to add them only to a specific logs
123
- # In that case it is recommended that you call the base _pre_logs_hooks as a dependency of that task
121
+ # The user may define custom _pre_down_hooks tasks to add any pre-down actions the down process
122
+ # Define this process in the appropriate namespace to add them only to a specific down
123
+ # In that case it is recommended that you call the base _pre_down_hooks as a dependency of that task
124
124
  end
125
125
 
126
126
  # Define an empty _post_down_hooks handler which can be overridden by the user
@@ -130,6 +130,20 @@ DEV_COMMANDS_TOP_LEVEL.instance_eval do
130
130
  # In that case it is recommended that you call the base _post_down_hooks as a dependency of that task
131
131
  end
132
132
 
133
+ # Define an empty _pre_stop_hooks handler which can be overridden by the user
134
+ task :_pre_stop_hooks do
135
+ # The user may define custom _pre_stop_hooks tasks to add any pre-stop actions the stop process
136
+ # Define this process in the appropriate namespace to add them only to a specific stop
137
+ # In that case it is recommended that you call the base _pre_stop_hooks as a dependency of that task
138
+ end
139
+
140
+ # Define an empty _post_stop_hooks handler which can be overridden by the user
141
+ task :_post_stop_hooks do
142
+ # The user may define custom _post_stop_hooks tasks to add any post-stop actions the stop process
143
+ # Define this process in the appropriate namespace to add them only to a specific stop
144
+ # In that case it is recommended that you call the base _post_stop_hooks as a dependency of that task
145
+ end
146
+
133
147
  # Define an empty _pre_reload_hooks handler which can be overridden by the user
134
148
  task :_pre_reload_hooks do
135
149
  # The user may define custom _pre_reload_hooks tasks to add any pre-reload actions the reload process
@@ -108,7 +108,7 @@ module Dev
108
108
  namespace application do
109
109
  return if exclude.include?(:down)
110
110
 
111
- desc "Stops the #{application} container"
111
+ desc "Shut down the #{application} container and remove associated resources"
112
112
  task down: %w(init_docker _pre_down_hooks) do
113
113
  LOG.debug "In #{application} down"
114
114
 
@@ -125,6 +125,25 @@ module Dev
125
125
  end
126
126
  end
127
127
 
128
+ # Create the rake task which runs a docker compose stop for the application name
129
+ def create_stop_task!
130
+ application = @name
131
+ exclude = @exclude
132
+
133
+ DEV_COMMANDS_TOP_LEVEL.instance_eval do
134
+ namespace application do
135
+ return if exclude.include?(:stop)
136
+
137
+ desc "Stops the #{application} container"
138
+ task stop: %w(init_docker _pre_stop_hooks) do
139
+ LOG.debug "In #{application} stop"
140
+ Dev::Docker::Compose.new(services: [application]).stop
141
+ Rake::Task[:_post_stop_hooks].execute
142
+ end
143
+ end
144
+ end
145
+ end
146
+
128
147
  # Create the rake task which stops, cleans, and starts the application
129
148
  def create_reload_task!
130
149
  application = @name
@@ -76,6 +76,30 @@ module Dev
76
76
  end
77
77
  end
78
78
 
79
+ # Create the rake task which stops all running containers
80
+ def create_stop_task!
81
+ exclude = @exclude
82
+
83
+ DEV_COMMANDS_TOP_LEVEL.instance_eval do
84
+ return if exclude.include?(:stop)
85
+
86
+ desc 'Stops all running containers'
87
+ task stop: %w(init_docker _pre_stop_hooks) do
88
+ LOG.debug('In base stop')
89
+
90
+ containers = ::Docker::Container.all(filters: {status: %w(restarting running)}.to_json)
91
+ containers.each do |container|
92
+ next if container&.info&.dig('Names')&.any? { |name| name.start_with?('/windows_tcp') }
93
+
94
+ LOG.info "Stopping container #{container.id[0, 12]}"
95
+ container.stop(timeout: 120)
96
+ end
97
+
98
+ Rake::Task[:_post_stop_hooks].execute
99
+ end
100
+ end
101
+ end
102
+
79
103
  # Create the rake task which runs a docker compose down followed by an up
80
104
  def create_reload_task!
81
105
  exclude = @exclude
@@ -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 = '1.4.0'.freeze
9
+ VERSION = '1.4.1.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: 1.4.0
4
+ version: 1.4.1.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-05-01 00:00:00.000000000 Z
11
+ date: 2023-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -453,9 +453,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
453
453
  version: '2.7'
454
454
  required_rubygems_version: !ruby/object:Gem::Requirement
455
455
  requirements:
456
- - - ">="
456
+ - - ">"
457
457
  - !ruby/object:Gem::Version
458
- version: '0'
458
+ version: 1.3.1
459
459
  requirements: []
460
460
  rubygems_version: 3.1.6
461
461
  signing_key: