ecs-rails 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/ecs +0 -11
- data/lib/ecs-rails/cluster_selector.rb +0 -3
- data/lib/ecs-rails/command.rb +0 -2
- data/lib/ecs-rails/ecs_rails_configuration.rb +4 -4
- data/lib/ecs-rails/service_selector.rb +0 -3
- data/lib/ecs-rails/task_selector.rb +8 -13
- data/lib/ecs-rails/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c315c2e992cf5b44e419f99fbca24d590b67bde002ff99c87eace906039d479
|
4
|
+
data.tar.gz: eea04176308d22f38e5c4ae44ce4bf9fff10f5e45f33ac5a1904b794e602791f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd23d26514639ac9f015bb8af4b82491a0896e670c10b701f642981d8a2872b1230c009f570c5dc6a9a7f787842c7972b2573762de69b7b3ac62289a5c7a8142
|
7
|
+
data.tar.gz: e6f6e8043df16a541c81cdba7cf316c301e8a850082de85a694b0b7c1b8e3c27064e29431857fd66764de7ffeaa01c1f7c6983c9e755fdc32e21ffd4e75df244
|
data/bin/ecs
CHANGED
@@ -1,15 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'byebug'
|
4
|
-
|
5
4
|
require 'optparse'
|
6
5
|
require_relative '../lib/ecs-rails'
|
7
6
|
|
8
|
-
EcsRails.aws_region = ENV['AWS_REGION']
|
9
|
-
EcsRails.aws_access_key_id = ENV['AWS_ACCESS_KEY_ID']
|
10
|
-
EcsRails.aws_secret_access_key = ENV['AWS_SECRET_ACCESS_KEY']
|
11
|
-
EcsRails.container_name = ENV['CONTAINER_NAME'] || 'webapp'
|
12
|
-
|
13
7
|
options = {}
|
14
8
|
OptionParser.new do |opts|
|
15
9
|
opts.banner = "Usage: ecsconsole [options]"
|
@@ -25,9 +19,4 @@ end.parse!
|
|
25
19
|
|
26
20
|
command_keyword = ARGV[0]
|
27
21
|
|
28
|
-
# byebug
|
29
|
-
|
30
|
-
# command = EcsRails::CommandFactory.new(command_keyword, options).command
|
31
|
-
# command.call
|
32
|
-
|
33
22
|
EcsRails::CommandExecutor.call(command_keyword, options)
|
data/lib/ecs-rails/command.rb
CHANGED
@@ -31,12 +31,10 @@ module EcsRails
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def selected_service
|
34
|
-
puts("Selected cluster: #{selected_cluster}")
|
35
34
|
@selected_service ||= EcsRails::ServiceSelector.new(client, selected_cluster, service_name).call
|
36
35
|
end
|
37
36
|
|
38
37
|
def task_id
|
39
|
-
puts("Selected service: #{selected_service}")
|
40
38
|
@task_id ||= EcsRails::TaskSelector.new(client, selected_cluster, selected_service).call
|
41
39
|
end
|
42
40
|
|
@@ -12,10 +12,10 @@ module EcsRails
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def initialize
|
15
|
-
@aws_region = 'us-east-1'
|
16
|
-
@aws_access_key_id =
|
17
|
-
@aws_secret_access_key =
|
18
|
-
@container_name =
|
15
|
+
@aws_region = ENV['AWS_REGION'] || 'us-east-1'
|
16
|
+
@aws_access_key_id = ENV['AWS_ACCESS_KEY_ID']
|
17
|
+
@aws_secret_access_key = ENV['AWS_SECRET_ACCESS_KEY']
|
18
|
+
@container_name = ENV['CONTAINER_NAME'] || 'webapp'
|
19
19
|
end
|
20
20
|
|
21
21
|
def aws_region=(region)
|
@@ -27,20 +27,8 @@ module EcsRails
|
|
27
27
|
puts(" Task: #{task_arns.first}")
|
28
28
|
return task_arns.first
|
29
29
|
else
|
30
|
-
tasks_for_deployment
|
31
|
-
puts("#{index+1}. Task: #{task.task_arn.split('/').last}, Last Status: #{task.last_status}, Desired Status: #{task.desired_status}")
|
32
|
-
end
|
30
|
+
ask_for_task(tasks_for_deployment)
|
33
31
|
end
|
34
|
-
|
35
|
-
selection = $stdin.gets.chomp.to_i
|
36
|
-
puts("Selected task: #{tasks_for_deployment[selection - 1].task_arn}")
|
37
|
-
|
38
|
-
unless selection.between?(1, task_arns.size)
|
39
|
-
puts('Invalid selection.')
|
40
|
-
exit
|
41
|
-
end
|
42
|
-
|
43
|
-
return task_arns[selection - 1]
|
44
32
|
end
|
45
33
|
end
|
46
34
|
end
|
@@ -48,5 +36,12 @@ module EcsRails
|
|
48
36
|
private
|
49
37
|
|
50
38
|
attr_reader :client, :cluster_name, :service_name
|
39
|
+
|
40
|
+
def ask_for_task(tasks)
|
41
|
+
prompt = TTY::Prompt.new
|
42
|
+
choices = tasks.map { |task| task.split('/').last }
|
43
|
+
choice = prompt.enum_select("Select a task:", choices)
|
44
|
+
tasks.grep(Regexp.new(choice)).first
|
45
|
+
end
|
51
46
|
end
|
52
47
|
end
|
data/lib/ecs-rails/version.rb
CHANGED