ec2list 0.0.1 → 0.0.2

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: d991ea4312196a6c57cf5f643aa17d859ba0c37a
4
- data.tar.gz: 837e37ee5f9e2211bff9647ee8421a3b5d7f239e
3
+ metadata.gz: 9635dfff71696295a1ca4a44cfe0a3e56bab3907
4
+ data.tar.gz: 5906ee07921a8baeb1f69fb14b2888e4b473fec9
5
5
  SHA512:
6
- metadata.gz: 9dffe387c3cc404c7946dc03fbf27a6dead47e09cc467eb98e366c84e48c63d5b7999d136611df57ebfadb8652cadbfd06e36706e6c472d008a2914406d11ac5
7
- data.tar.gz: d946f35d9f9f8d82850670d5bde44450a5c6fc269389a5b1fa912f275a0076bed9f06758e7f6a3bf5c58394cca7dfc405c7eca2244ea0c20848bc3c4f74e8916
6
+ metadata.gz: a6e859f9a4827d6f6b83e561803edfc490072ca6930978b39eb2e0382191b69a4ea42deabd429b173ca3c33976e3224f57ef311690f01a8bfa5762505a62733e
7
+ data.tar.gz: d6ecf3b56b26946fa1db18a8caeec555a2a96c4398db2496f2376300df77f1b01f355d271e4e944a0a3ecf31bc87130a503f4079c588701b44575de3fb290957
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Ec2list
1
+ # ec2list
2
2
 
3
3
  Show running instances on AWS EC2.
4
4
 
@@ -36,7 +36,7 @@ $ ec2list --profile PROFILE
36
36
 
37
37
  ## Contributing
38
38
 
39
- 1. Fork it ( http://github.com/<my-github-username>/ec2list/fork )
39
+ 1. Fork it ( http://github.com/a2ikm/ec2list/fork )
40
40
  2. Create your feature branch (`git checkout -b my-new-feature`)
41
41
  3. Commit your changes (`git commit -am 'Add some feature'`)
42
42
  4. Push to the branch (`git push origin my-new-feature`)
@@ -8,14 +8,11 @@ module Ec2list
8
8
  end
9
9
 
10
10
  def run
11
- instances = fetch_instances
12
-
13
- if instances.empty?
14
- puts "No running instances"
15
- return
11
+ AWS.memoize do
12
+ fetch_instances.each do |instance|
13
+ print_instance(instance)
14
+ end
16
15
  end
17
-
18
- print_instances(instances)
19
16
  end
20
17
 
21
18
  private
@@ -23,21 +20,16 @@ module Ec2list
23
20
  def fetch_instances
24
21
  AWS::EC2.new.
25
22
  instances.
26
- select { |instance| instance.status == :running }.
27
- to_a
23
+ select { |instance| instance.status == :running }
28
24
  end
29
25
 
30
- def print_instances(instances)
31
- puts "Name,Private IP,Public IP"
32
-
33
- instances.each do |instance|
34
- tags = instance.tags.to_h
35
- puts [
36
- tags["Name"],
37
- instance.private_ip_address,
38
- instance.public_ip_address,
39
- ].join(",")
40
- end
26
+ def print_instance(instance)
27
+ tags = instance.tags
28
+ puts [
29
+ tags[:Name],
30
+ instance.private_ip_address,
31
+ instance.public_ip_address,
32
+ ].join("\t")
41
33
  end
42
34
 
43
35
  def build_options(argv)
@@ -1,3 +1,3 @@
1
1
  module Ec2list
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ec2list
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masato Ikeda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-08 00:00:00.000000000 Z
11
+ date: 2014-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws_config