ec2-host 0.0.6 → 0.0.7

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: 02bef88973232ed12b815884d0ff5c5e38938921
4
- data.tar.gz: 88e6ecc818e0afae83cc8b10de6671e3cd74b2aa
3
+ metadata.gz: 851fe69dd2022fdf092d8da07aa385ac46f0596c
4
+ data.tar.gz: 398cb4bfeb3ccbc336d718c59e7a80692c5a8caa
5
5
  SHA512:
6
- metadata.gz: a3d2cc71f802293588dcd184dd1fd18a4f5de92fe57f3f1412b1bc2437258063a13b65ba4b953797e7cbb6963b2ed0967644d7211acf3f9b5a7a523bf6406717
7
- data.tar.gz: c511301344134ef8bfabddf0686e8ac19e7cc2dddb85647875ade4bafe1653a2c85e8009f15d4e1a7f3bed4606984fc760372ee9e6204760a422def033ce2c11
6
+ metadata.gz: e24bbafc3aa90f728761c53604342a0d7de772b9dc4ae561b6e11736b7000e6e3aae3d46721f572be93826e0f930471929192e7598448deb761b89d81a3c3310
7
+ data.tar.gz: 6eef10592f5ae93c2bc6441b096365a275946ea89b383ba469d0caabc93445a816e6378279c35429b2789d206028d56bfc67479c6f50bf1cf88d156c5ab31f49
@@ -1,3 +1,9 @@
1
+ # 0.0.7 (2015/08/10)
2
+
3
+ Enhancements:
4
+
5
+ * Add `--json` option
6
+
1
7
  # 0.0.6 (2015/08/10)
2
8
 
3
9
  Enhancements:
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = "ec2-host"
3
- gem.version = '0.0.6'
3
+ gem.version = '0.0.7'
4
4
  gem.author = ['Naotoshi Seo']
5
5
  gem.email = ['sonots@gmail.com']
6
6
  gem.homepage = 'https://github.com/sonots/ec2-host'
@@ -41,6 +41,9 @@ class EC2
41
41
  :aliases => %w[-i],
42
42
  :type => :boolean,
43
43
  :desc => "show host info, not only hostname"
44
+ option :json,
45
+ :type => :boolean,
46
+ :desc => "show detailed host info in json"
44
47
  option :debug,
45
48
  :type => :boolean,
46
49
  :desc => "debug mode"
@@ -49,6 +52,10 @@ class EC2
49
52
  EC2::Host.new(condition).each do |host|
50
53
  $stdout.puts host.info
51
54
  end
55
+ elsif options[:json]
56
+ EC2::Host.new(condition).each do |host|
57
+ $stdout.puts host.json
58
+ end
52
59
  elsif options[:private_ip]
53
60
  EC2::Host.new(condition).each do |host|
54
61
  $stdout.puts host.private_ip_address
@@ -68,7 +75,7 @@ class EC2
68
75
 
69
76
  def condition
70
77
  return @condition if @condition
71
- _condition = HashUtil.except(options, :info, :debug, :private_ip, :public_ip)
78
+ _condition = HashUtil.except(options, :info, :json, :debug, :private_ip, :public_ip)
72
79
  @condition = {}
73
80
  _condition.each do |key, val|
74
81
  if tag = Config.optional_options[key.to_s]
@@ -1,5 +1,6 @@
1
1
  require 'forwardable'
2
2
  require 'hashie/mash'
3
+ require 'json'
3
4
 
4
5
  class EC2
5
6
  class Host
@@ -72,6 +73,17 @@ class EC2
72
73
  end
73
74
  end
74
75
 
76
+ def json
77
+ HashUtil.except(self, :instance).merge(
78
+ instance_id: instance_id,
79
+ private_ip_address: private_ip_address,
80
+ public_ip_address: public_ip_address,
81
+ launch_time: launch_time,
82
+ state: state.name,
83
+ monitoring: monitoring.state,
84
+ ).to_json
85
+ end
86
+
75
87
  # private
76
88
 
77
89
  def role_match?(condition)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ec2-host
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naotoshi Seo