elbow 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile CHANGED
@@ -2,3 +2,4 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in capistrano-ec2.gemspec
4
4
  gemspec
5
+ gem "capistrano", "~> 3.0.1"
data/README.md CHANGED
@@ -6,6 +6,8 @@ In the cloud, your web instances are forever changing. This Gem allows you to de
6
6
  your cap file that a host is using an ELB and it will detect the EC2 instances and deploy
7
7
  your app to each of them.
8
8
 
9
+ ** Version 0.0.4 and above require Capistrano 3 and are not backwards compatible **
10
+
9
11
  ## Installation
10
12
 
11
13
  Add this line to your application's Gemfile:
@@ -22,30 +24,34 @@ Or install it yourself as:
22
24
 
23
25
  ## Usage
24
26
 
25
- In your `deploy.rb`
27
+ In your `config/deploy/yourstage.rb`
26
28
 
27
29
  require 'elbow/capistrano'
28
30
 
29
- `elbow` requires your aws credentials, set them in your `deploy.rb`
31
+ `elbow` requires your aws credentials, set them in your `config/deploy/yourstage.rb`
30
32
 
31
33
  set :aws_access_key_id, 'YOUR_ACCESS_KEY_ID'
32
34
  set :aws_secret_access_key, 'YOUR_SECRET_ACCESS_KEY'
33
35
 
34
36
  Tell `elbow` that a host is using an ELB by specifying the `elastic_load_balancer`
35
- configuration in in your `deploy.rb`. The first argument is the host name followed
37
+ configuration in in your `config/deploy/yourstage.rb`. The first argument is the host name followed
36
38
  by a list of roles.
37
39
 
38
- elastic_load_balancer example.com, :app, :web
40
+ elastic_load_balancer 'your-elb-100028747657.us-east-1.elb.amazonaws.com', roles: %w{web app}, user: 'youruser'
39
41
 
40
42
  The host name is expected to be a CNAME for the ELB public DNS, as such a DNS looked is
41
43
  performed against the host name.
42
44
 
43
45
  By default the ELB is assumed to be in the AWS region `us-east-1`. You can use a
44
- different region by setting the following in your `deploy.rb`
46
+ different region by setting the following in your `config/deploy/yourstage.rb`
45
47
 
46
48
  set :aws_region, 'ap-southeast-2'
47
49
 
48
50
 
51
+ ## License
52
+
53
+ elbow is MIT licensed
54
+
49
55
  ## Contributing
50
56
 
51
57
  1. Fork it
data/elbow.gemspec CHANGED
@@ -7,6 +7,7 @@ Gem::Specification.new do |gem|
7
7
  gem.description = %q{Capistrano plugin for deploying to an AWS Elastic Load Balancer}
8
8
  gem.summary = %q{Use this gem as a plugin to Capistrano to deploy to EC2 instances behind an Elastic Load Balancer}
9
9
  gem.homepage = "https://github.com/srbartlett/elbow"
10
+ gem.license = "MIT"
10
11
 
11
12
  gem.files = `git ls-files`.split($\)
12
13
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
@@ -1,28 +1,27 @@
1
1
  require 'aws-sdk'
2
2
  require 'net/dns'
3
+ require 'capistrano/dsl'
3
4
 
4
- Capistrano::Configuration.instance(:must_exist).load do
5
+ def elastic_load_balancer(name, *args)
5
6
 
6
- def elastic_load_balancer(name, *args)
7
+ include Capistrano::DSL
7
8
 
8
9
  packet = Net::DNS::Resolver.start(name)
9
10
  all_cnames= packet.answer.reject { |p| !p.instance_of? Net::DNS::RR::CNAME }
10
- cname = all_cnames.find { |c| c.name == "#{name}."}.cname[0..-2]
11
+ cname = all_cnames.find { |c| c.name == "#{name}."}
12
+ cname = cname.cname[0..-2]
11
13
 
12
14
  aws_region= fetch(:aws_region, 'us-east-1')
13
15
  AWS.config(:access_key_id => fetch(:aws_access_key_id),
14
- :secret_access_key => fetch(:aws_secret_access_key),
15
- :ec2_endpoint => "ec2.#{aws_region}.amazonaws.com",
16
- :elb_endpoint => "elasticloadbalancing.#{aws_region}.amazonaws.com")
16
+ :secret_access_key => fetch(:aws_secret_access_key),
17
+ :ec2_endpoint => "ec2.#{aws_region}.amazonaws.com",
18
+ :elb_endpoint => "elasticloadbalancing.#{aws_region}.amazonaws.com")
17
19
 
18
20
  load_balancer = AWS::ELB.new.load_balancers.find { |elb| elb.dns_name.downcase == cname.downcase }
19
21
  raise "EC2 Load Balancer not found for #{name} in region #{aws_region}" if load_balancer.nil?
20
22
 
21
23
  load_balancer.instances.each do |instance|
22
- hostname = instance.dns_name || instance.private_ip_address
23
- server(hostname, *args)
24
+ hostname = instance.dns_name || instance.private_ip_address
25
+ server(hostname, *args)
24
26
  end
25
- end
26
-
27
27
  end
28
-
data/lib/elbow/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Elbow
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elbow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-16 00:00:00.000000000 Z
12
+ date: 2014-01-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk
@@ -60,7 +60,8 @@ files:
60
60
  - lib/elbow/capistrano.rb
61
61
  - lib/elbow/version.rb
62
62
  homepage: https://github.com/srbartlett/elbow
63
- licenses: []
63
+ licenses:
64
+ - MIT
64
65
  post_install_message:
65
66
  rdoc_options: []
66
67
  require_paths:
@@ -71,12 +72,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
71
72
  - - ! '>='
72
73
  - !ruby/object:Gem::Version
73
74
  version: '0'
75
+ segments:
76
+ - 0
77
+ hash: -622885483634481077
74
78
  required_rubygems_version: !ruby/object:Gem::Requirement
75
79
  none: false
76
80
  requirements:
77
81
  - - ! '>='
78
82
  - !ruby/object:Gem::Version
79
83
  version: '0'
84
+ segments:
85
+ - 0
86
+ hash: -622885483634481077
80
87
  requirements: []
81
88
  rubyforge_project:
82
89
  rubygems_version: 1.8.23