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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 35b782be8674d1202475c5feb01d7db1f60cc44c405728e0d209b36ed73dbf36
4
- data.tar.gz: 12b35c703f133f94e98a958100369fa8a55b2f6c5a00ba05fd15f7f45260606a
3
+ metadata.gz: 2c315c2e992cf5b44e419f99fbca24d590b67bde002ff99c87eace906039d479
4
+ data.tar.gz: eea04176308d22f38e5c4ae44ce4bf9fff10f5e45f33ac5a1904b794e602791f
5
5
  SHA512:
6
- metadata.gz: 14993ab00ee2a4c16050dac6e8697164b8ee107d19b0aa6258b4ae69cdc416f8bf3ebc44183b8d74002e717393ded177756ecc73d482f396a4a1c7a92da0c7b9
7
- data.tar.gz: 56a7b7c237a810666872fc34b3e376cf7a87bd75b1793602b0fb3d217abc5d0ae786d1515dab745a747af7528b2ad4d03293f178c229143bc3af22365289508c
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)
@@ -38,10 +38,7 @@ module EcsRails
38
38
  attr_reader :client, :filter
39
39
 
40
40
  def connecting_to_cluster(cluster_name)
41
- puts('')
42
41
  puts("Connecting to cluster '#{cluster_name}':")
43
- puts('')
44
- puts('=' * 50)
45
42
  end
46
43
 
47
44
  def ask_for_cluster(clusters)
@@ -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 = nil
17
- @aws_secret_access_key = nil
18
- @container_name = nil
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)
@@ -43,10 +43,7 @@ module EcsRails
43
43
  attr_reader :client, :cluster, :service_filter
44
44
 
45
45
  def connecting_to_service(service_name)
46
- puts('')
47
46
  puts("Connecting to service '#{service_name}':")
48
- puts('')
49
- puts('=' * 50)
50
47
  end
51
48
 
52
49
  def ask_for_service(services)
@@ -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.each_with_index do |task, index|
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EcsRails
4
- VERSION = '0.0.2'
4
+ VERSION = '0.0.3'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecs-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franck D'agostini