awful 0.0.89 → 0.0.90

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
  SHA1:
3
- metadata.gz: e0f93ae8a2a2b8e2a639ddeed62a081aea8a1e8f
4
- data.tar.gz: ebabaca1669e4a03deddf606dce0157555be441b
3
+ metadata.gz: 0af2c04aa7bdcb37394fa8960eebe2d839afa5dc
4
+ data.tar.gz: b26a823916aa559e7dd3c61e3ff30ce5adfe73ac
5
5
  SHA512:
6
- metadata.gz: d6f5147d9f38460a70ca3aa5dfd689238c49c38dbef7481200708d58b1380a66377006204ffd8a112d5d14760ef52b098071cfb0a582d25c597ba554a567d24f
7
- data.tar.gz: 5f2bfc5a22426a90ef8f2a534fb85a822ded2f852ebc9a20a5bd64e30cd0fb8ef44e37460f80abc211eb57aab652b81a54e713c2452fbdfccfd7532e8fb50076
6
+ metadata.gz: 0a87d45f4f50406a40890247b1b08e0c9b49972ded2a10aeabc8ad404ffaa9fe9479c4ab61cc017a45564186128a45b78f9703198014d258eee9c0bff7324901
7
+ data.tar.gz: 4e125878e9629242ccd577e80a2a856afb9a69cf968b392ce2b8dcc6601b565bf415fa9dfd4f4c340df331c5bb8c04b269548d7c8e3abc991a8fae9f4f7f8351
@@ -31,26 +31,47 @@ module Awful
31
31
  def color(string)
32
32
  set_color(string, COLORS.fetch(string.downcase.to_sym, :blue))
33
33
  end
34
+
35
+ ## get list of stacks
36
+ def stack_summaries(next_token = nil)
37
+ response = cf.list_stacks(next_token: next_token)
38
+ summaries = response.stack_summaries
39
+ if response.next_token # recurse to get more data
40
+ summaries += stack_summaries(response.next_token)
41
+ else
42
+ summaries
43
+ end
44
+ end
34
45
  end
35
46
 
36
47
  desc 'ls [PATTERN]', 'list cloudformation stacks matching PATTERN'
37
48
  method_option :long, aliases: '-l', default: false, desc: 'Long listing'
38
49
  method_option :all, aliases: '-a', default: false, desc: 'Show all, including stacks in DELETE_COMPLETE'
39
50
  def ls(name = /./)
40
- stacks = cf.list_stacks.stack_summaries.select do |stack|
41
- stack.stack_name.match(name)
42
- end
51
+ stacks = stack_summaries
43
52
 
44
53
  ## skip deleted stacks unless -a given
45
54
  unless options[:all]
46
55
  stacks = stacks.select { |stack| stack.stack_status != 'DELETE_COMPLETE' }
47
56
  end
48
57
 
49
- stacks.tap do |stacks|
58
+ ## match on given arg
59
+ stacks = stacks.select do |stack|
60
+ stack.stack_name.match(name)
61
+ end
62
+
63
+ stacks.tap do |list|
50
64
  if options[:long]
51
- print_table stacks.map { |s| [s.stack_name, s.creation_time, color(s.stack_status), s.template_description] }
65
+ print_table list.map { |s|
66
+ [
67
+ s.stack_name,
68
+ s.creation_time,
69
+ color(s.stack_status),
70
+ s.template_description,
71
+ ]
72
+ }.sort
52
73
  else
53
- puts stacks.map(&:stack_name)
74
+ puts list.map(&:stack_name).sort
54
75
  end
55
76
  end
56
77
  end
@@ -1,3 +1,3 @@
1
1
  module Awful
2
- VERSION = '0.0.89'
2
+ VERSION = '0.0.90'
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.89
4
+ version: 0.0.90
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-01-28 00:00:00.000000000 Z
11
+ date: 2016-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler