capify-ec2 1.2.0.pre.3 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Changelog.md +29 -0
- data/LICENSE +1 -1
- data/lib/capify-ec2/capistrano.rb +5 -2
- data/lib/capify-ec2/server.rb +2 -2
- data/lib/capify-ec2/version.rb +1 -1
- data/lib/capify-ec2.rb +11 -11
- data/readme.md +3 -3
- metadata +8 -12
data/Changelog.md
CHANGED
@@ -1,3 +1,32 @@
|
|
1
|
+
## 1.2.3 (Jan 24, 2011)
|
2
|
+
|
3
|
+
Features:
|
4
|
+
|
5
|
+
- Remove handling of singular 'role.' It was causing unnecessary difficulties.
|
6
|
+
|
7
|
+
Bugfixes:
|
8
|
+
|
9
|
+
- Options flag not properly recognized.
|
10
|
+
|
11
|
+
## 1.2.2 (Dec 05, 2011)
|
12
|
+
|
13
|
+
Bugfixes:
|
14
|
+
|
15
|
+
- Mismatch between ec2:status and ec2:ssh lead to connecting to the wrong server.
|
16
|
+
|
17
|
+
## 1.2.1 (Dec 02, 2011)
|
18
|
+
|
19
|
+
Bugfixes:
|
20
|
+
|
21
|
+
- Regression bug fixed. Projects weren't being filtered properly.
|
22
|
+
|
23
|
+
## 1.2.0 (Dec 02, 2011)
|
24
|
+
|
25
|
+
Features:
|
26
|
+
|
27
|
+
- Much improved performance
|
28
|
+
- US-West-1 now available (fog upgrade)
|
29
|
+
|
1
30
|
## 1.1.16 (Sep 23, 2011)
|
2
31
|
|
3
32
|
Features:
|
data/LICENSE
CHANGED
@@ -34,7 +34,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
34
34
|
desc "Allows ssh to instance by id. cap ssh <INSTANCE NAME>"
|
35
35
|
task :ssh do
|
36
36
|
server = variables[:logger].instance_variable_get("@options")[:actions][1]
|
37
|
-
instance = numeric?(server) ? CapifyEc2.new.
|
37
|
+
instance = numeric?(server) ? CapifyEc2.new.desired_instances[server.to_i] : CapifyEc2.new.get_instance_by_name(server)
|
38
38
|
port = ssh_options[:port] || 22
|
39
39
|
command = "ssh -p #{port} #{user}@#{instance.dns_name}"
|
40
40
|
puts "Running `#{command}`"
|
@@ -120,7 +120,10 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
120
120
|
options = role[:options]
|
121
121
|
new_options = {}
|
122
122
|
options.each {|key, value| new_options[key] = true if value.to_s == instance.name}
|
123
|
-
instance.
|
123
|
+
instance.options.each do |option|
|
124
|
+
results = option.split(',')
|
125
|
+
results.each {|result| new_options[result.to_sym] = true }
|
126
|
+
end rescue false
|
124
127
|
|
125
128
|
if new_options
|
126
129
|
role role[:name].to_sym, instance.dns_name, new_options
|
data/lib/capify-ec2/server.rb
CHANGED
@@ -7,7 +7,7 @@ module Fog
|
|
7
7
|
class Server
|
8
8
|
def method_missing(method_sym, *arguments, &block)
|
9
9
|
tags.each do |key, value|
|
10
|
-
tag = key.downcase.gsub(/\W/, '')
|
10
|
+
tag = key.downcase.gsub(/\W/, '')
|
11
11
|
return value if method_sym.to_s == tag
|
12
12
|
end if tags
|
13
13
|
super
|
@@ -15,7 +15,7 @@ module Fog
|
|
15
15
|
|
16
16
|
def respond_to?(method_sym, include_private = false)
|
17
17
|
tags.each do |key, value|
|
18
|
-
tag = key.downcase.gsub(/\W/, '')
|
18
|
+
tag = key.downcase.gsub(/\W/, '')
|
19
19
|
return true if method_sym.to_s == tag
|
20
20
|
end if tags
|
21
21
|
super
|
data/lib/capify-ec2/version.rb
CHANGED
data/lib/capify-ec2.rb
CHANGED
@@ -28,32 +28,32 @@ class CapifyEc2
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def display_instances
|
31
|
-
|
31
|
+
desired_instances.each_with_index do |instance, i|
|
32
32
|
puts sprintf "%-11s: %-40s %-20s %-20s %-62s %-20s (%s)",
|
33
33
|
i.to_s.magenta, instance.name, instance.id.red, instance.flavor_id.cyan,
|
34
34
|
instance.dns_name.blue, instance.availability_zone.green, (instance.role rescue "").yellow
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
def project_instances
|
39
|
-
@instances.select {|instance| instance.tags["Project"] == project_tag}
|
38
|
+
def project_instances
|
39
|
+
@instances.select {|instance| instance.tags["Project"] == @ec2_config[:project_tag]}
|
40
40
|
end
|
41
41
|
|
42
|
-
def
|
43
|
-
instances = @ec2_config[:project_tag].nil? ? @instances : project_instances
|
42
|
+
def desired_instances(region = nil)
|
43
|
+
instances = @ec2_config[:project_tag].nil? ? @instances : project_instances
|
44
44
|
end
|
45
45
|
|
46
|
-
def get_instances_by_role(
|
47
|
-
|
46
|
+
def get_instances_by_role(roles)
|
47
|
+
desired_instances.select {|instance| instance.roles == roles.to_s rescue false}
|
48
48
|
end
|
49
49
|
|
50
|
-
def get_instances_by_region(
|
50
|
+
def get_instances_by_region(roles, region)
|
51
51
|
return unless region
|
52
|
-
|
52
|
+
desired_instances.select {|instance| instance.availability_zone.match(region) && instance.roles == roles.to_s rescue false}
|
53
53
|
end
|
54
54
|
|
55
55
|
def get_instance_by_name(name)
|
56
|
-
|
56
|
+
desired_instances.select {|instance| instance.name == name}.first
|
57
57
|
end
|
58
58
|
|
59
59
|
def instance_health(load_balancer, instance)
|
@@ -61,7 +61,7 @@ class CapifyEc2
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def server_names
|
64
|
-
|
64
|
+
desired_instances.map {|instance| instance.name}
|
65
65
|
end
|
66
66
|
|
67
67
|
def elb
|
data/readme.md
CHANGED
@@ -5,8 +5,8 @@ capify-ec2 is used to generate capistrano namespaces using ec2 tags.
|
|
5
5
|
|
6
6
|
eg: If you have three servers on amazon's ec2.
|
7
7
|
|
8
|
-
server-1 Tag:
|
9
|
-
server-2 Tag:
|
8
|
+
server-1 Tag: Roles => "web", Options => "cron, resque"
|
9
|
+
server-2 Tag: Roles => "db"
|
10
10
|
server-3 Tag: Roles => "web, db"
|
11
11
|
|
12
12
|
Installing
|
@@ -194,4 +194,4 @@ Report Issues/Feature requests on [GitHub Issues](http://github.com/forward/capi
|
|
194
194
|
|
195
195
|
## Copyright
|
196
196
|
|
197
|
-
Copyright (c)
|
197
|
+
Copyright (c) 2012 Forward. See [LICENSE](https://github.com/forward/capify-ec2/blob/master/LICENSE) for details.
|
metadata
CHANGED
@@ -1,15 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capify-ec2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 25
|
5
|
+
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 2
|
9
|
-
- 0
|
10
|
-
- pre
|
11
9
|
- 3
|
12
|
-
version: 1.2.
|
10
|
+
version: 1.2.3
|
13
11
|
platform: ruby
|
14
12
|
authors:
|
15
13
|
- Noah Cantor
|
@@ -18,7 +16,7 @@ autorequire:
|
|
18
16
|
bindir: bin
|
19
17
|
cert_chain: []
|
20
18
|
|
21
|
-
date:
|
19
|
+
date: 2012-01-24 00:00:00 +00:00
|
22
20
|
default_executable:
|
23
21
|
dependencies:
|
24
22
|
- !ruby/object:Gem::Dependency
|
@@ -109,14 +107,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
109
107
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
108
|
none: false
|
111
109
|
requirements:
|
112
|
-
- - "
|
110
|
+
- - ">="
|
113
111
|
- !ruby/object:Gem::Version
|
114
|
-
hash:
|
112
|
+
hash: 3
|
115
113
|
segments:
|
116
|
-
-
|
117
|
-
|
118
|
-
- 1
|
119
|
-
version: 1.3.1
|
114
|
+
- 0
|
115
|
+
version: "0"
|
120
116
|
requirements: []
|
121
117
|
|
122
118
|
rubyforge_project: capify-ec2
|