soror 0.0.8 → 0.1.0

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: 4e3d60cc5af136386d68b720f81b4646daa38bcb
4
- data.tar.gz: c6f95bb345ce5ed90d7374b0e22929c8209b9ee0
3
+ metadata.gz: 4bff2dc21e2da2264062e8b5df495aa0d6de4a07
4
+ data.tar.gz: 1929169d3c2f4062dcc9b37c2f6e53e0bb296106
5
5
  SHA512:
6
- metadata.gz: 03c0040dc4ebf8460ff34c0b1ff397bf3ccd3a52f2ceb040cd662dddbad8fa8893bb6df3aed02d8a7b79ee82023d3cb2d71ea4a7a043e1355e15223d6091513f
7
- data.tar.gz: ccdb481f89052bd992d7a4786ed9a8b4d9c3a8ceebd5bf2af3224c43e4717f4a9bd0f94c86620b65c305b85ef36040cfa23e5e57bf027d2ac43f256437372b8d
6
+ metadata.gz: 3986d1d96c69b3de84749185b37f14e6b2d95e41b38a4833aadc002cc316c7311965e36a167bfb78193daa2ac712bc28ca0be27198d25dbf88705e0ab6d0b1b8
7
+ data.tar.gz: 3f1fcb90291200f467b253d60a12b80d57d7491f8f2207e6b09b4974ecc19bdf4468c44afe169e03a8025c48f1a7b615eb9aed2d9c99a766945434befe9163be
data/README.md CHANGED
@@ -21,10 +21,10 @@ Or install it yourself as:
21
21
  ## Usage
22
22
 
23
23
  ```ruby
24
- # Search for EC2 instances which have the tag `{ "Key": "name", "Value": "soror" }`
24
+ # Search for EC2 instances which have the tag `[{ "Key": "role", "Value": "app" }, { "Key": "stage", "Value": "production" }]`
25
25
  # You can use methods of Aws::EC2::Instance to an element of return value
26
26
  # See http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/Instance.html
27
- Soror::EC2::Instance.search_by(name: 'soror') #=> [<Aws::EC2::Instance>, ...]
27
+ Soror::EC2::Instance.search_by(role: 'app', stage: 'production') #=> [<Aws::EC2::Instance>, ...]
28
28
  ```
29
29
 
30
30
  ### Configuration
@@ -37,10 +37,12 @@ In addition, Soror supports [a new and standardized way to manage credentials](h
37
37
 
38
38
  ## CLI
39
39
 
40
+ `ATTR` is an instance method name of `Aws::EC2::Instance`
41
+
40
42
  ```
41
43
  $ soror --help
42
44
  Usage: soror [options]
43
- -t, --tag='KEY=VALUE'
45
+ --tags='KEY=VAL,KEY=VAL,...'
44
46
  -a, --attributes=ATTR,ATTR,...
45
47
  --[no-]header
46
48
  --profile-name=NAME
@@ -48,13 +50,21 @@ Usage: soror [options]
48
50
  --access-key=KEY
49
51
  --secret-key=KEY
50
52
  --region=REGION
53
+ ```
51
54
 
52
- $ soror --profile-name 'kirikiriyamama' --region 'ap-northeast-1' --tag 'name=soror' --attributes 'instance_id,public_ip_address'
55
+ ### Example
56
+
57
+ ```
58
+ $ soror --tags 'role=app,stage=production' --attributes 'instance_id,public_ip_address' --profile-name 'kirikiriyamama' --region 'ap-northeast-1'
53
59
  instance_id public_ip_address
54
60
  i-xxxxx xxx.xxx.xxx.xxx
55
61
  i-xxxxx xxx.xxx.xxx.xxx
56
62
  ```
57
63
 
64
+ ```
65
+ $ ssh -i ~/.ssh/id_rsa ec2-user@$(soror --tags 'role=app,stage=production' --attributes 'instance_id,public_ip_address' --profile-name 'kirikiriyamama' --region 'ap-northeast-1' --no-header | peco | awk '$0 = $2')
66
+ ```
67
+
58
68
  ## Required permissions
59
69
 
60
70
  ```js
data/bin/soror CHANGED
@@ -8,9 +8,13 @@ Version = Soror::VERSION
8
8
  options = { header: true, attributes: [], config: {}, credentials: {}, tag: {} }
9
9
  OptionParser.new do |opt|
10
10
  opt.on('-t', '--tag=\'KEY=VALUE\'', /\A[^=]+=[^=]+\z/) do |v|
11
+ warn '[DEPRECATION] The option `--tag` will be removed, and `-t` will be assigned to `--tags`. Please use `--tags` instead.'
11
12
  key, val = v.split('=')
12
13
  options[:tag][key] = val
13
14
  end
15
+ opt.on(%q{--tags='KEY=VAL,KEY=VAL,...'}, Array) do |a|
16
+ a.map{ |s| s.split('=') }.each{ |k, v| options[:tag][k] = v }
17
+ end
14
18
  opt.on('-a', '--attributes=ATTR,ATTR,...', Array) { |a| options[:attributes] = a }
15
19
  opt.on('--[no-]header') { |v| options[:header] = v }
16
20
  opt.on('--profile-name=NAME') { |v| options[:credentials][:profile_name] = v }
@@ -20,7 +24,7 @@ OptionParser.new do |opt|
20
24
  opt.on('--region=REGION') { |v| options[:config][:region] = v }
21
25
  opt.parse!(ARGV)
22
26
  end
23
- fail OptionParser::MissingArgument, '--tag' if options[:tag].empty?
27
+ fail OptionParser::MissingArgument, '--tags' if options[:tag].empty?
24
28
  fail OptionParser::InvalidArgument, '--attributes' if options[:attributes].empty?
25
29
 
26
30
  unless options[:credentials].empty?
data/lib/soror/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Soror
2
- VERSION = "0.0.8"
2
+ VERSION = "0.1.0"
3
3
  end
data/lib/soror.rb CHANGED
@@ -4,21 +4,6 @@ require 'soror/ec2'
4
4
  require 'soror/version'
5
5
  require 'yaml'
6
6
 
7
- unless {}.respond_to?(:symbolize_keys)
8
- class Hash
9
- def symbolize_keys
10
- dup.symbolize_keys!
11
- end
12
-
13
- def symbolize_keys!
14
- keys.each do |key|
15
- self[(key.to_sym rescue key) || key] = delete(key)
16
- end
17
- self
18
- end
19
- end
20
- end
21
-
22
7
  module Soror
23
8
  class << self
24
9
  extend Forwardable
@@ -26,10 +11,3 @@ module Soror
26
11
  def_delegators Soror::EC2::Instance, :search_by
27
12
  end
28
13
  end
29
-
30
- File.expand_path('~/.soror').tap do |path|
31
- if File.exists?(path)
32
- warn '[DEPRECATION] Support of `~/.soror` will be removed. Please use such as `~/.aws/credentials` instead.'
33
- Soror.config.update(YAML.load_file(path).symbolize_keys)
34
- end
35
- end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soror
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - kirikiriyamama
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-08 00:00:00.000000000 Z
11
+ date: 2015-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler