awful 0.0.137 → 0.0.139

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/awful/ecs.rb +19 -12
  3. data/lib/awful/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fd7f5a4afe16eabf9cd341d1bf623c9b12fb4bdb
4
- data.tar.gz: 2672c70ade9bf706223b7e5e94dd7cce36a18de4
3
+ metadata.gz: 44cbc14484454157636d714889043a28eb9ec88f
4
+ data.tar.gz: f269e807d07a1869f3d115adaedd0b3263588bc4
5
5
  SHA512:
6
- metadata.gz: c217f3fd28a0f5ab734310df7590f3ec368c04f1a6052c8dfe105ec0be8294d543fae422d59a3497f439cdac33cb858ab4e9390b082587f6365221dfac2238eb
7
- data.tar.gz: e6b433c9564d9b143be1ca2e97dbefad9fbe468bf5c079ffb522a51799f51594489e9c9520d0592d8d22f1c1559019dfff4c7b6b0f9d4441843b81d071043334
6
+ metadata.gz: 830faefc88c4eae0b13ae3adcafe8ebc76af3f34e6c030dd7e50af12f28f0b317ec58d44d497e442e1b593349a1530a268b9d028a0d5a84d1eae7de3336c6346
7
+ data.tar.gz: d4b9ec6d61354b9f4c8c8fe324f08c29a540085ccd3019f21172a04a39465a76071003c131e9ea498a6199e3235120ac0399dd2038304094d6bbb761444913d5
data/lib/awful/ecs.rb CHANGED
@@ -34,7 +34,7 @@ module Awful
34
34
  arns = ecs.list_clusters.cluster_arns.select do |arn|
35
35
  arn.split('/').last.match(/#{name}/i)
36
36
  end
37
- ecs.describe_clusters(clusters: arns).clusters.tap do |clusters|
37
+ ecs.describe_clusters(clusters: arns).clusters.output do |clusters|
38
38
  if options[:arns]
39
39
  puts arns
40
40
  elsif options[:long]
@@ -53,6 +53,13 @@ module Awful
53
53
  end
54
54
  end
55
55
 
56
+ desc 'create NAME', 'create a new cluster'
57
+ def create(name)
58
+ ecs.create_cluster(cluster_name: name).cluster.output do |cluster|
59
+ puts YAML.dump(stringify_keys(cluster.to_h))
60
+ end
61
+ end
62
+
56
63
  desc 'instances CLUSTER', 'list instances for CLUSTER'
57
64
  method_option :long, aliases: '-l', default: false, desc: 'Long listing'
58
65
  def instances(cluster)
@@ -62,9 +69,9 @@ module Awful
62
69
 
63
70
  ## get hash of tags for each instance id
64
71
  tags = ec2.describe_instances(instance_ids: container_instances.map(&:ec2_instance_id)).
65
- map(&:reservations).flatten.
66
- map(&:instances).flatten.
67
- each_with_object({}) do |i,h|
72
+ map(&:reservations).flatten.
73
+ map(&:instances).flatten.
74
+ each_with_object({}) do |i,h|
68
75
  h[i.instance_id] = tag_name(i, '--')
69
76
  end
70
77
 
@@ -92,7 +99,7 @@ module Awful
92
99
  arns
93
100
  else
94
101
  arns.map{|a| a.split('/').last}
95
- end.tap(&method(:puts))
102
+ end.output(&method(:puts))
96
103
  end
97
104
 
98
105
  desc 'deregister TASK_DEFINITION', 'mark a task definition as INACTIVE'
@@ -103,7 +110,7 @@ module Awful
103
110
  desc 'dump TASK', 'describe details for TASK definition'
104
111
  method_option :json, aliases: '-j', default: false, desc: 'dump as json instead of yaml'
105
112
  def dump(task)
106
- ecs.describe_task_definition(task_definition: task).task_definition.to_h.tap do |hash|
113
+ ecs.describe_task_definition(task_definition: task).task_definition.to_h.output do |hash|
107
114
  if options[:json]
108
115
  puts JSON.pretty_generate(hash)
109
116
  else
@@ -121,7 +128,7 @@ module Awful
121
128
  if arns.empty?
122
129
  []
123
130
  elsif options[:long]
124
- ecs.describe_tasks(cluster: cluster, tasks: arns).tasks.tap do |tasks|
131
+ ecs.describe_tasks(cluster: cluster, tasks: arns).tasks.output do |tasks|
125
132
  print_table tasks.map { |task|
126
133
  [
127
134
  task.task_arn.split('/').last,
@@ -133,13 +140,13 @@ module Awful
133
140
  }
134
141
  end
135
142
  else
136
- arns.tap(&method(:puts))
143
+ arns.output(&method(:puts))
137
144
  end
138
145
  end
139
146
 
140
147
  desc 'status CLUSTER TASKS', 'describe status for one or more task IDs/ARNs'
141
148
  def status(cluster, *tasks)
142
- ecs.describe_tasks(cluster: cluster, tasks: tasks).tasks.tap do |responses|
149
+ ecs.describe_tasks(cluster: cluster, tasks: tasks).tasks.output do |responses|
143
150
  responses.each do |response|
144
151
  puts YAML.dump(stringify_keys(response.to_h))
145
152
  end
@@ -160,7 +167,7 @@ module Awful
160
167
  ]
161
168
  }
162
169
  else
163
- arns.tap(&method(:puts))
170
+ arns.output(&method(:puts))
164
171
  end
165
172
  end
166
173
 
@@ -179,14 +186,14 @@ module Awful
179
186
  overrides: container_overrides.empty? ? {} : {container_overrides: [container_overrides]}
180
187
  }
181
188
 
182
- ecs.run_task(params).tap do |response|
189
+ ecs.run_task(params).output do |response|
183
190
  puts YAML.dump(stringify_keys(response.to_h))
184
191
  end
185
192
  end
186
193
 
187
194
  desc 'stop_task CLUSTER TASK_ID', 'stop a running task'
188
195
  def stop_task(cluster, id)
189
- ecs.stop_task(cluster: cluster, task: id).task.tap do |response|
196
+ ecs.stop_task(cluster: cluster, task: id).task.output do |response|
190
197
  puts YAML.dump(stringify_keys(response.to_h))
191
198
  end
192
199
  end
data/lib/awful/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Awful
2
- VERSION = '0.0.137'
2
+ VERSION = '0.0.139'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awful
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.137
4
+ version: 0.0.139
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ric Lister
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-25 00:00:00.000000000 Z
11
+ date: 2016-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler