awful 0.0.166 → 0.0.167

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/awful/sqs.rb +12 -14
  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: e5763dd9368f72a01140a54165474bf1c5a6e66c
4
- data.tar.gz: daf29fb335285d6b67f53a6f25c23e9913f845b5
3
+ metadata.gz: 707724c618d524adbace4d7cb12ecf78a6636412
4
+ data.tar.gz: 26f835d01f873767fca0758273d5fdc69e024906
5
5
  SHA512:
6
- metadata.gz: f08e8c54685dab14bd355174996c9a7a40189f4dfa58315ff1180e2f80fc114584d10171e328e480e086e8ce4fc9d41b18e5dd1fae0d7059d853b96cfd9c57e5
7
- data.tar.gz: b09457b0392f90092adaf06486e131987bfaf128a7e00fb052a32bf2c2e44f1b78b9d359af9b5f7c51cd1c18a198b181b201af1634aa2fce7262299a8e6e91e9
6
+ metadata.gz: bd3a0d6bf3ad77b66324b679d2cc6a3d7003a474b480496f17e751eb2e84107e8a1bfe08cf07771c62a956e1968d75b4994f86c2875016924cbe77ea949831f3
7
+ data.tar.gz: 50a08de9f3a5181294e9c927594f6fff73d345486c3cb4faa78dcbbe7a0c996c515324e17a220821df0fc9e425599f4edc206d573c869c0d823952afc07b8b64
data/lib/awful/sqs.rb CHANGED
@@ -8,7 +8,7 @@ module Awful
8
8
  class SQS < Cli
9
9
  no_commands do
10
10
  def sqs
11
- @sqs ||= Aws::SQS::Client.new
11
+ @_sqs ||= Aws::SQS::Client.new
12
12
  end
13
13
 
14
14
  def is_url?(str)
@@ -24,22 +24,20 @@ module Awful
24
24
  end
25
25
  end
26
26
 
27
- desc 'ls [PATTERN]', 'list subnets [with any tags matching PATTERN]'
28
- method_option :long, aliases: '-l', type: :boolean, default: false, desc: 'Long listing'
29
- def ls(prefix = nil)
30
- queues = sqs.list_queues(queue_name_prefix: prefix).queue_urls
27
+ desc 'ls [NAMES]', 'list queues, can limit by list of names or URLs'
28
+ method_option :long, aliases: '-l', type: :boolean, default: false, desc: 'long listing'
29
+ method_option :prefix, aliases: '-p', type: :string, default: nil, desc: 'list by prefix'
30
+ def ls(*names)
31
+ if names.empty?
32
+ queues = sqs.list_queues(queue_name_prefix: options[:prefix]).queue_urls
33
+ else
34
+ queues = names.map(&method(:queue_url))
35
+ end
31
36
  attr = %w[QueueArn ApproximateNumberOfMessages ApproximateNumberOfMessagesNotVisible LastModifiedTimestamp]
32
37
  if options[:long]
33
- queues.map do |queue|
34
- sqs.get_queue_attributes(queue_url: queue, attribute_names: attr).attributes
35
- end.output do |list|
38
+ queues.map {|q| sqs.get_queue_attributes(queue_url: q, attribute_names: attr).attributes}.output do |list|
36
39
  print_table list.map { |q|
37
- [
38
- q['QueueArn'].split(':').last,
39
- q['ApproximateNumberOfMessages'],
40
- q['ApproximateNumberOfMessagesNotVisible'],
41
- Time.at(q['LastModifiedTimestamp'].to_i)
42
- ]
40
+ [q['QueueArn'].split(':').last, q['ApproximateNumberOfMessages'], q['ApproximateNumberOfMessagesNotVisible'], Time.at(q['LastModifiedTimestamp'].to_i)]
43
41
  }
44
42
  end
45
43
  else
data/lib/awful/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Awful
2
- VERSION = '0.0.166'
2
+ VERSION = '0.0.167'
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.166
4
+ version: 0.0.167
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ric Lister
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-17 00:00:00.000000000 Z
11
+ date: 2017-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler