elba 0.0.4 → 0.0.5
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.lock +9 -11
- data/Rakefile +3 -3
- data/elba.gemspec +1 -1
- data/lib/elba/cli.rb +28 -0
- data/lib/elba.rb +1 -1
- data/spec/lib/elba/cli_spec.rb +43 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/support/mocks.rb +4 -0
- metadata +6 -6
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
elba (0.0.
|
4
|
+
elba (0.0.5)
|
5
5
|
fog
|
6
|
-
thor
|
6
|
+
thor (>= 0.15)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: http://housetripgems.herokuapp.com/
|
@@ -13,11 +13,11 @@ GEM
|
|
13
13
|
timers (~> 1.1.0)
|
14
14
|
coderay (1.0.9)
|
15
15
|
diff-lcs (1.2.4)
|
16
|
-
excon (0.
|
16
|
+
excon (0.31.0)
|
17
17
|
ffi (1.9.0)
|
18
|
-
fog (1.
|
18
|
+
fog (1.19.0)
|
19
19
|
builder
|
20
|
-
excon (~> 0.
|
20
|
+
excon (~> 0.31.0)
|
21
21
|
formatador (~> 0.2.0)
|
22
22
|
mime-types
|
23
23
|
multi_json (~> 1.0)
|
@@ -25,7 +25,6 @@ GEM
|
|
25
25
|
net-ssh (>= 2.1.3)
|
26
26
|
nokogiri (~> 1.5)
|
27
27
|
ruby-hmac
|
28
|
-
unicode (~> 0.4.4)
|
29
28
|
formatador (0.2.4)
|
30
29
|
guard (2.2.2)
|
31
30
|
formatador (>= 0.2.4)
|
@@ -42,13 +41,13 @@ GEM
|
|
42
41
|
rb-inotify (>= 0.9)
|
43
42
|
lumberjack (1.0.4)
|
44
43
|
method_source (0.8.2)
|
45
|
-
mime-types (1
|
46
|
-
mini_portile (0.5.
|
47
|
-
multi_json (1.
|
44
|
+
mime-types (2.1)
|
45
|
+
mini_portile (0.5.2)
|
46
|
+
multi_json (1.9.0)
|
48
47
|
net-scp (1.1.2)
|
49
48
|
net-ssh (>= 2.6.5)
|
50
49
|
net-ssh (2.7.0)
|
51
|
-
nokogiri (1.6.
|
50
|
+
nokogiri (1.6.1)
|
52
51
|
mini_portile (~> 0.5.0)
|
53
52
|
pry (0.9.12.2)
|
54
53
|
coderay (~> 1.0.5)
|
@@ -72,7 +71,6 @@ GEM
|
|
72
71
|
slop (3.4.6)
|
73
72
|
thor (0.18.1)
|
74
73
|
timers (1.1.0)
|
75
|
-
unicode (0.4.4)
|
76
74
|
|
77
75
|
PLATFORMS
|
78
76
|
ruby
|
data/Rakefile
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
#!/usr/bin/env rake
|
2
|
-
require
|
3
|
-
require
|
2
|
+
require "bundler/gem_tasks"
|
3
|
+
require "rspec/core/rake_task"
|
4
4
|
|
5
|
-
desc
|
5
|
+
desc "Run all specs"
|
6
6
|
RSpec::Core::RakeTask.new(:spec) do |t|
|
7
7
|
t.pattern = "spec/**/*_spec.rb"
|
8
8
|
end
|
data/elba.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.add_development_dependency "pry-nav"
|
23
23
|
|
24
24
|
s.add_dependency "fog"
|
25
|
-
s.add_dependency "thor"
|
25
|
+
s.add_dependency "thor", '>= 0.15'
|
26
26
|
|
27
27
|
s.files = `git ls-files`.split("\n")
|
28
28
|
s.test_files = `git ls-files -- spec/*/*_spec*`.split("\n")
|
data/lib/elba/cli.rb
CHANGED
@@ -71,6 +71,34 @@ module Elba
|
|
71
71
|
end
|
72
72
|
|
73
73
|
|
74
|
+
desc "attached BALANCER", "Prints the list of instances attached to a balancer"
|
75
|
+
option :porcelain, type: :boolean, aliases: :p, desc: "Prints the list in a machine readable format"
|
76
|
+
def attached(balancer_name = nil, porcelain = options[:porcelain])
|
77
|
+
unless balancer_name
|
78
|
+
error "You must specify an ELB"
|
79
|
+
return
|
80
|
+
end
|
81
|
+
|
82
|
+
elb = find_elb(name: balancer_name)
|
83
|
+
|
84
|
+
unless elb
|
85
|
+
error "Could not find balancer"
|
86
|
+
return
|
87
|
+
end
|
88
|
+
|
89
|
+
instances = elb.reload.instances
|
90
|
+
|
91
|
+
if porcelain
|
92
|
+
say instances.join(' ')
|
93
|
+
else
|
94
|
+
say " * #{elb.id}"
|
95
|
+
instances.each do |instance_id|
|
96
|
+
success " - #{instance_id}"
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
|
74
102
|
desc "attach INSTANCES", "Attaches given instances ids to a load balancer"
|
75
103
|
option :to, type: :string, aliases: :t, desc: "Specifies which load balancer to use"
|
76
104
|
def attach(*instances)
|
data/lib/elba.rb
CHANGED
data/spec/lib/elba/cli_spec.rb
CHANGED
@@ -62,6 +62,48 @@ describe Elba::Cli do
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
+
describe 'attached' do
|
66
|
+
let(:output) { capture(:stdout) { perform } }
|
67
|
+
let(:perform) { subject.attached elb.id }
|
68
|
+
|
69
|
+
before do
|
70
|
+
silence(:stdout) { subject.client.attach(instance1.id, elb) }
|
71
|
+
silence(:stdout) { subject.client.attach(instance2.id, elb) }
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'prints the list of instances attached to an ELB' do
|
75
|
+
output.should include " * #{elb.id}"
|
76
|
+
output.should include " - #{instance1.id}"
|
77
|
+
output.should include " - #{instance2.id}"
|
78
|
+
end
|
79
|
+
|
80
|
+
context 'no balancer name is passed' do
|
81
|
+
let(:perform) { subject.attached }
|
82
|
+
|
83
|
+
it 'exits' do
|
84
|
+
output.should include 'You must specify an ELB'
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
context "the balancer can't be found" do
|
89
|
+
let(:perform) { subject.attached 'yolo' }
|
90
|
+
|
91
|
+
it 'exits' do
|
92
|
+
output.should include 'Could not find balancer'
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
context '--porcelain' do
|
97
|
+
before do
|
98
|
+
subject.stub options: { porcelain: true }
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'prints the list of instances attached to an ELB without decoration' do
|
102
|
+
output.should include "#{instance1.id} #{instance2.id}"
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
65
107
|
describe 'attach' do
|
66
108
|
shared_examples_for "asking user" do
|
67
109
|
before do
|
@@ -114,7 +156,7 @@ describe Elba::Cli do
|
|
114
156
|
end
|
115
157
|
|
116
158
|
it 'which load balancer to use' do
|
117
|
-
allow(subject).to receive(:ask)
|
159
|
+
allow(subject).to receive(:ask).and_return("0")
|
118
160
|
|
119
161
|
output.should_not include "No load balancer available"
|
120
162
|
output.should_not include "Using default load balancer"
|
data/spec/spec_helper.rb
CHANGED
data/spec/support/mocks.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elba
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2014-
|
14
|
+
date: 2014-03-28 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|
@@ -132,7 +132,7 @@ dependencies:
|
|
132
132
|
requirements:
|
133
133
|
- - ! '>='
|
134
134
|
- !ruby/object:Gem::Version
|
135
|
-
version: '0'
|
135
|
+
version: '0.15'
|
136
136
|
type: :runtime
|
137
137
|
prerelease: false
|
138
138
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -140,7 +140,7 @@ dependencies:
|
|
140
140
|
requirements:
|
141
141
|
- - ! '>='
|
142
142
|
- !ruby/object:Gem::Version
|
143
|
-
version: '0'
|
143
|
+
version: '0.15'
|
144
144
|
description: Command-line interface for Amazon's ELB
|
145
145
|
email:
|
146
146
|
- marcusleemitchell@gmail.com
|
@@ -184,7 +184,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
184
184
|
version: '0'
|
185
185
|
segments:
|
186
186
|
- 0
|
187
|
-
hash:
|
187
|
+
hash: -3701415436554715604
|
188
188
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
189
189
|
none: false
|
190
190
|
requirements:
|
@@ -193,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
193
193
|
version: '0'
|
194
194
|
segments:
|
195
195
|
- 0
|
196
|
-
hash:
|
196
|
+
hash: -3701415436554715604
|
197
197
|
requirements: []
|
198
198
|
rubyforge_project:
|
199
199
|
rubygems_version: 1.8.25
|