capistrano-ec2_role_tag 0.0.6 → 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: 81dfdf6c725196bb1be1e49acf1bf8f083926b5e
4
- data.tar.gz: 96b2d2232b3cd9df6ae7c553c4ea3811a3f6b3b9
3
+ metadata.gz: 00fb0df60ed2fa773aad2bf3502ca9a575f61166
4
+ data.tar.gz: 6df770a8817a2f70bf6c339dea3e93c12b53d17c
5
5
  SHA512:
6
- metadata.gz: 1dd79fc390e21b72c3badf676c40190bda5912e77a006ef554bca790f0158d9843dd84bb496c21efa4156ed941bc20860154e842ab53b630d07dc59a8b90ad9b
7
- data.tar.gz: 3bdbc0470ec737b1de31902f247151dc74eb14405a36c29b745daca290887f873d01a1eccd4c0efd98e1b8dd5ec600fe409d342888a087d1cdd3e700f5d29c99
6
+ metadata.gz: 719c12e9124970003dc5aad3f5a22683b30269e0d715107b9e38a7687abb51469224e8247def734d9f78ae84a8e4c5f02228ff5d35d10117d83782254f197ab1
7
+ data.tar.gz: 6c4a578dd10caf7a57eed2c5b876dde2292492572db60713348d06c89fc1b0b46107275fee3444ff40907f7391f935fab2bb7acb07a1e1faa637afe5c6c7d9a0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## [In git](https://github.com/heosuax/capistrano-ec2_role_tag/compare/v0.0.2...HEAD)
2
2
 
3
+ ## [v0.1.0](https://github.com/heosuax/capistrano-ec2_role_tag/tree/v0.1.0)
4
+
5
+ ### New Features
6
+ * Support capistrano 3
7
+ * Using aws-sdk v2
8
+
3
9
  ## [v0.0.2](https://github.com/heosuax/capistrano-ec2_role_tag/tree/v0.0.2)
4
10
 
5
11
  ### New Features
data/Gemfile.lock CHANGED
@@ -1,26 +1,25 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- capistrano-ec2_role_tag (0.0.2)
5
- aws-sdk (~> 1)
6
- capistrano (~> 2)
4
+ capistrano-ec2_role_tag (0.1.0)
5
+ aws-sdk (~> 2)
6
+ capistrano (~> 3)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- aws-sdk (1.66.0)
12
- aws-sdk-v1 (= 1.66.0)
13
- aws-sdk-v1 (1.66.0)
14
- json (~> 1.4)
15
- nokogiri (>= 1.4.4)
11
+ aws-sdk (2.2.4)
12
+ aws-sdk-resources (= 2.2.4)
13
+ aws-sdk-core (2.2.4)
14
+ jmespath (~> 1.0)
15
+ aws-sdk-resources (2.2.4)
16
+ aws-sdk-core (= 2.2.4)
16
17
  binding_of_caller (0.7.2)
17
18
  debug_inspector (>= 0.0.1)
18
- capistrano (2.15.7)
19
- highline
20
- net-scp (>= 1.0.0)
21
- net-sftp (>= 2.0.0)
22
- net-ssh (>= 2.0.14)
23
- net-ssh-gateway (>= 1.1.0)
19
+ capistrano (3.4.0)
20
+ i18n
21
+ rake (>= 10.0.0)
22
+ sshkit (~> 1.3)
24
23
  coderay (1.1.0)
25
24
  columnize (0.9.0)
26
25
  coveralls (0.8.10)
@@ -41,23 +40,17 @@ GEM
41
40
  docile (1.1.5)
42
41
  domain_name (0.5.25)
43
42
  unf (>= 0.0.5, < 1.0.0)
44
- highline (1.7.8)
45
43
  http-cookie (1.0.2)
46
44
  domain_name (~> 0.5)
45
+ i18n (0.7.0)
46
+ jmespath (1.1.3)
47
47
  json (1.8.3)
48
48
  method_source (0.8.2)
49
49
  mime-types (2.99)
50
- mini_portile2 (2.0.0)
51
50
  net-scp (1.2.1)
52
51
  net-ssh (>= 2.6.5)
53
- net-sftp (2.1.2)
54
- net-ssh (>= 2.6.5)
55
52
  net-ssh (3.0.1)
56
- net-ssh-gateway (1.2.0)
57
- net-ssh (>= 2.6.5)
58
53
  netrc (0.11.0)
59
- nokogiri (1.6.7)
60
- mini_portile2 (~> 2.0.0.rc2)
61
54
  pry (0.10.3)
62
55
  coderay (~> 1.1.0)
63
56
  method_source (~> 0.8.1)
@@ -92,6 +85,9 @@ GEM
92
85
  simplecov-html (~> 0.10.0)
93
86
  simplecov-html (0.10.0)
94
87
  slop (3.6.0)
88
+ sshkit (1.8.1)
89
+ net-scp (>= 1.1.2)
90
+ net-ssh (>= 2.8.0)
95
91
  term-ansicolor (1.3.2)
96
92
  tins (~> 1.0)
97
93
  thor (0.19.1)
@@ -105,14 +101,14 @@ PLATFORMS
105
101
  ruby
106
102
 
107
103
  DEPENDENCIES
108
- bundler (>= 1.3.5)
104
+ bundler (~> 1.3, >= 1.3.5)
109
105
  capistrano-ec2_role_tag!
110
106
  coveralls (>= 0.7.0)
111
107
  pry
112
108
  pry-debugger
113
109
  pry-doc
114
110
  pry-stack_explorer
115
- rake
111
+ rake (>= 10.0.0)
116
112
  redcarpet (>= 3)
117
113
  rspec (~> 2.14, >= 2.14.1)
118
114
  rubygems-tasks (~> 0.2, >= 0.2.4)
data/README.md CHANGED
@@ -11,8 +11,8 @@
11
11
  Extend capistrano in AWS EC2 by getting private dns name of servers by stage, role
12
12
 
13
13
  ```ruby
14
- app_hosts = ec2_by_role("appworker")
15
- worker_hosts = ec2_by_role("backgroundworker")
14
+ app_hosts = Capistrano::Configuration.ec2_by_role("appworker")
15
+ worker_hosts = Capistrano::Configuration.ec2_by_role("backgroundworker")
16
16
  ```
17
17
 
18
18
  ## Installation
@@ -27,13 +27,17 @@ Just `require 'capistrano-ec2_role_tag'` in `Capfile` and then use it as:
27
27
 
28
28
  In `config/deploy/staging.rb` or `config/deploy/production.rb`
29
29
  ```ruby
30
- app_hosts = ec2_by_role("appworker")
31
- worker_hosts = ec2_by_role("backgroundworker")
30
+ app_hosts = Capistrano::Configuration.ec2_by_role("appworker")
31
+ worker_hosts = Capistrano::Configuration.ec2_by_role("backgroundworker")
32
32
 
33
33
  role :web, *allhost
34
34
  ...
35
35
  ```
36
36
 
37
+ ## TODO
38
+
39
+ * Support authentication by API key
40
+
37
41
  ## Contributing
38
42
 
39
43
  1. Fork it ( https://github.com/heosuax/capistrano-ec2_role_tag/fork )
@@ -7,10 +7,11 @@ Gem::Specification.new do |spec|
7
7
  spec.platform = Gem::Platform::RUBY
8
8
  spec.name = 'capistrano-ec2_role_tag'
9
9
  spec.version = Capistrano::Ec2RoleTag::VERSION
10
- spec.summary = "Plugin to load server by AWS EC2 role"
11
- spec.description = spec.summary
10
+ spec.summary = "Capistrano plugin to dynamically load server by AWS EC2 role"
11
+ spec.description = "Capistrano plugin to dynamically load server by AWS EC2 role. \
12
+ Support a helper in capistrano deploy stage configuration file to get internal dns name by role and stage."
12
13
 
13
- spec.required_ruby_version = '>= 1.9.3'
14
+ spec.required_ruby_version = '>= 2'
14
15
  spec.required_rubygems_version = '>= 1.8.0'
15
16
 
16
17
  spec.license = 'MIT'
@@ -25,10 +26,10 @@ Gem::Specification.new do |spec|
25
26
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
26
27
 
27
28
  spec.add_development_dependency 'bundler', '~> 1.3', '>= 1.3.5'
28
- spec.add_development_dependency 'rake', '~> 0'
29
+ spec.add_development_dependency 'rake', '~> 10.0', '>= 10.0.0'
29
30
  spec.add_development_dependency 'rspec', '~> 2.14', '>= 2.14.1'
30
31
  spec.add_development_dependency 'rubygems-tasks', '~> 0.2', '>= 0.2.4'
31
32
 
32
- spec.add_runtime_dependency 'aws-sdk', '~> 1'
33
- spec.add_runtime_dependency 'capistrano', '~> 2'
33
+ spec.add_runtime_dependency 'aws-sdk', '~> 2'
34
+ spec.add_runtime_dependency 'capistrano', '~> 3'
34
35
  end
@@ -1,13 +1,13 @@
1
- require 'aws-sdk-v1'
1
+ require 'aws-sdk'
2
2
 
3
3
  module Capistrano
4
4
  module Ec2RoleTag
5
5
  class AwsEc2Loader
6
6
  def initialize(options = {})
7
7
  if options[:region].nil?
8
- @ec2 = AWS::EC2::Client.new(region: 'us-west-2')
8
+ @ec2 = Aws::EC2::Client.new(region: 'us-west-2')
9
9
  else
10
- @ec2 = AWS::EC2::Client.new(region: options[:region])
10
+ @ec2 = Aws::EC2::Client.new(region: options[:region])
11
11
  end
12
12
  end
13
13
  def fetch(options = {})
@@ -15,17 +15,11 @@ module Capistrano
15
15
  {filters: [
16
16
  {name: "tag:Stage", values: [options[:stage].to_s]},
17
17
  {name: "tag:Role", values: [options[:role].to_s]},
18
- {name: "instance-state-name", values: ["running"]}
18
+ {name: "state", values: ["running"]}
19
19
  ]})
20
- return [] if apps.reservation_set.empty?
21
-
22
- result = []
23
- apps.reservation_set.each do |reservation|
24
- next if reservation.instances_set.empty?
25
- result += reservation.instances_set.map {|instance| instance.private_dns_name }
26
- end
27
-
28
- return result
20
+ return [] if apps.reservations.empty?
21
+ return [] if apps.reservations[0].instances.empty?
22
+ return apps.reservations[0].instances.map{|instance| instance.private_dns_name }
29
23
  end
30
24
  end
31
25
  end
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Ec2RoleTag
3
- VERSION = "0.0.6"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
@@ -13,11 +13,13 @@ module Capistrano
13
13
  end
14
14
  end
15
15
  class Configuration
16
- def ec2_by_role(role)
17
- if Capistrano::Ec2RoleTag.provider.nil?
18
- Capistrano::Ec2RoleTag.configure { |configure| configure.stage = fetch(:stage) }
16
+ class << self
17
+ def ec2_by_role(role)
18
+ if Capistrano::Ec2RoleTag.provider.nil?
19
+ Capistrano::Ec2RoleTag.configure { |configure| configure.stage = fetch(:stage) }
20
+ end
21
+ Capistrano::Ec2RoleTag.provider.fetch(role)
19
22
  end
20
- Capistrano::Ec2RoleTag.provider.fetch(role)
21
23
  end
22
24
  end
23
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-ec2_role_tag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - An Vo Nguyen Thien
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-15 00:00:00.000000000 Z
11
+ date: 2015-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -36,14 +36,20 @@ dependencies:
36
36
  requirements:
37
37
  - - ~>
38
38
  - !ruby/object:Gem::Version
39
- version: '0'
39
+ version: '10.0'
40
+ - - '>='
41
+ - !ruby/object:Gem::Version
42
+ version: 10.0.0
40
43
  type: :development
41
44
  prerelease: false
42
45
  version_requirements: !ruby/object:Gem::Requirement
43
46
  requirements:
44
47
  - - ~>
45
48
  - !ruby/object:Gem::Version
46
- version: '0'
49
+ version: '10.0'
50
+ - - '>='
51
+ - !ruby/object:Gem::Version
52
+ version: 10.0.0
47
53
  - !ruby/object:Gem::Dependency
48
54
  name: rspec
49
55
  requirement: !ruby/object:Gem::Requirement
@@ -90,29 +96,31 @@ dependencies:
90
96
  requirements:
91
97
  - - ~>
92
98
  - !ruby/object:Gem::Version
93
- version: '1'
99
+ version: '2'
94
100
  type: :runtime
95
101
  prerelease: false
96
102
  version_requirements: !ruby/object:Gem::Requirement
97
103
  requirements:
98
104
  - - ~>
99
105
  - !ruby/object:Gem::Version
100
- version: '1'
106
+ version: '2'
101
107
  - !ruby/object:Gem::Dependency
102
108
  name: capistrano
103
109
  requirement: !ruby/object:Gem::Requirement
104
110
  requirements:
105
111
  - - ~>
106
112
  - !ruby/object:Gem::Version
107
- version: '2'
113
+ version: '3'
108
114
  type: :runtime
109
115
  prerelease: false
110
116
  version_requirements: !ruby/object:Gem::Requirement
111
117
  requirements:
112
118
  - - ~>
113
119
  - !ruby/object:Gem::Version
114
- version: '2'
115
- description: Plugin to load server by AWS EC2 role
120
+ version: '3'
121
+ description: Capistrano plugin to dynamically load server by AWS EC2 role. Support
122
+ a helper in capistrano deploy stage configuration file to get internal dns name
123
+ by role and stage.
116
124
  email:
117
125
  - an.vo@codebox.vn
118
126
  executables: []
@@ -150,7 +158,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
150
158
  requirements:
151
159
  - - '>='
152
160
  - !ruby/object:Gem::Version
153
- version: 1.9.3
161
+ version: '2'
154
162
  required_rubygems_version: !ruby/object:Gem::Requirement
155
163
  requirements:
156
164
  - - '>='
@@ -161,7 +169,7 @@ rubyforge_project:
161
169
  rubygems_version: 2.4.8
162
170
  signing_key:
163
171
  specification_version: 4
164
- summary: Plugin to load server by AWS EC2 role
172
+ summary: Capistrano plugin to dynamically load server by AWS EC2 role
165
173
  test_files:
166
174
  - spec/capistrano-ec2_role_tag_spec.rb
167
175
  - spec/spec_helper.rb