elba 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +47 -40
- data/lib/elba.rb +1 -1
- data/spec/lib/elba/cli_spec.rb +38 -38
- data/spec/lib/elba/client_spec.rb +5 -5
- data/spec/spec_helper.rb +2 -2
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd866bcc1a6504f4b5d01d0f8b345573133ae6c7
|
4
|
+
data.tar.gz: d5d0943d2335c808e7752e0a91f02e606c0d0000
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c5e11737d2636e9012ce2b6876303d07d925d219a2a7fffddde24a639b457c6eaaab8e82ca9667a0b9db4ea23d5ad14db517a642d54efd277713cbf7f5bf527
|
7
|
+
data.tar.gz: 89030cf8555013e3cf07dbc413d36d0f52c9568d599acc16c4f927a9e451a6d2a74f29b4b0b111ba2f7f6780a584f9e26121bceb1c2d7a47968418286f9614c2
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
elba (0.0.
|
4
|
+
elba (0.0.7)
|
5
5
|
fog-aws
|
6
6
|
thor (>= 0.15)
|
7
7
|
|
@@ -9,76 +9,80 @@ GEM
|
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
11
|
builder (3.2.2)
|
12
|
-
celluloid (0.15.2)
|
13
|
-
timers (~> 1.1.0)
|
14
12
|
coderay (1.1.0)
|
15
13
|
diff-lcs (1.2.5)
|
16
14
|
excon (0.45.4)
|
17
|
-
ffi (1.9.
|
15
|
+
ffi (1.9.10)
|
18
16
|
fog-aws (0.7.6)
|
19
17
|
fog-core (~> 1.27)
|
20
18
|
fog-json (~> 1.0)
|
21
19
|
fog-xml (~> 0.1)
|
22
20
|
ipaddress (~> 0.8)
|
23
|
-
fog-core (1.
|
21
|
+
fog-core (1.35.0)
|
24
22
|
builder
|
25
23
|
excon (~> 0.45)
|
26
24
|
formatador (~> 0.2)
|
27
|
-
mime-types
|
28
|
-
net-scp (~> 1.1)
|
29
|
-
net-ssh (>= 2.1.3)
|
30
25
|
fog-json (1.0.2)
|
31
26
|
fog-core (~> 1.0)
|
32
27
|
multi_json (~> 1.10)
|
33
28
|
fog-xml (0.1.2)
|
34
29
|
fog-core
|
35
30
|
nokogiri (~> 1.5, >= 1.5.11)
|
36
|
-
formatador (0.2.
|
37
|
-
guard (2.
|
31
|
+
formatador (0.2.5)
|
32
|
+
guard (2.13.0)
|
38
33
|
formatador (>= 0.2.4)
|
39
|
-
listen (
|
34
|
+
listen (>= 2.7, <= 4.0)
|
40
35
|
lumberjack (~> 1.0)
|
36
|
+
nenv (~> 0.1)
|
37
|
+
notiffany (~> 0.0)
|
41
38
|
pry (>= 0.9.12)
|
39
|
+
shellany (~> 0.0)
|
42
40
|
thor (>= 0.18.1)
|
43
|
-
guard-
|
41
|
+
guard-compat (1.2.1)
|
42
|
+
guard-rspec (4.6.4)
|
44
43
|
guard (~> 2.1)
|
45
|
-
|
44
|
+
guard-compat (~> 1.1)
|
45
|
+
rspec (>= 2.99.0, < 4.0)
|
46
46
|
ipaddress (0.8.0)
|
47
|
-
listen (
|
48
|
-
celluloid (>= 0.15.2)
|
47
|
+
listen (3.0.5)
|
49
48
|
rb-fsevent (>= 0.9.3)
|
50
49
|
rb-inotify (>= 0.9)
|
51
|
-
lumberjack (1.0.
|
50
|
+
lumberjack (1.0.9)
|
52
51
|
method_source (0.8.2)
|
53
|
-
mime-types (2.6.1)
|
54
52
|
mini_portile (0.6.2)
|
55
53
|
multi_json (1.11.2)
|
56
|
-
|
57
|
-
|
58
|
-
net-ssh (2.9.2)
|
59
|
-
nokogiri (1.6.6.2)
|
54
|
+
nenv (0.2.0)
|
55
|
+
nokogiri (1.6.6.4)
|
60
56
|
mini_portile (~> 0.6.0)
|
61
|
-
|
62
|
-
|
63
|
-
|
57
|
+
notiffany (0.0.8)
|
58
|
+
nenv (~> 0.1)
|
59
|
+
shellany (~> 0.0)
|
60
|
+
pry (0.10.3)
|
61
|
+
coderay (~> 1.1.0)
|
62
|
+
method_source (~> 0.8.1)
|
64
63
|
slop (~> 3.4)
|
65
|
-
pry-nav (0.2.
|
66
|
-
pry (
|
67
|
-
rake (10.
|
68
|
-
rb-fsevent (0.9.
|
69
|
-
rb-inotify (0.9.
|
64
|
+
pry-nav (0.2.4)
|
65
|
+
pry (>= 0.9.10, < 0.11.0)
|
66
|
+
rake (10.4.2)
|
67
|
+
rb-fsevent (0.9.6)
|
68
|
+
rb-inotify (0.9.5)
|
70
69
|
ffi (>= 0.5.0)
|
71
|
-
rspec (
|
72
|
-
rspec-core (~>
|
73
|
-
rspec-expectations (~>
|
74
|
-
rspec-mocks (~>
|
75
|
-
rspec-core (
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
70
|
+
rspec (3.4.0)
|
71
|
+
rspec-core (~> 3.4.0)
|
72
|
+
rspec-expectations (~> 3.4.0)
|
73
|
+
rspec-mocks (~> 3.4.0)
|
74
|
+
rspec-core (3.4.1)
|
75
|
+
rspec-support (~> 3.4.0)
|
76
|
+
rspec-expectations (3.4.0)
|
77
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
78
|
+
rspec-support (~> 3.4.0)
|
79
|
+
rspec-mocks (3.4.0)
|
80
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
81
|
+
rspec-support (~> 3.4.0)
|
82
|
+
rspec-support (3.4.1)
|
83
|
+
shellany (0.0.1)
|
84
|
+
slop (3.6.0)
|
85
|
+
thor (0.19.1)
|
82
86
|
|
83
87
|
PLATFORMS
|
84
88
|
ruby
|
@@ -91,3 +95,6 @@ DEPENDENCIES
|
|
91
95
|
pry-nav
|
92
96
|
rake
|
93
97
|
rspec
|
98
|
+
|
99
|
+
BUNDLED WITH
|
100
|
+
1.10.6
|
data/lib/elba.rb
CHANGED
data/spec/lib/elba/cli_spec.rb
CHANGED
@@ -6,7 +6,7 @@ describe Elba::Cli do
|
|
6
6
|
|
7
7
|
before :each do
|
8
8
|
# Use test config
|
9
|
-
subject.
|
9
|
+
allow(subject).to receive(:config) { test_config }
|
10
10
|
|
11
11
|
# Create an ELB
|
12
12
|
subject.client.connection.create_load_balancer([test_config[:region]], 'elba-test')
|
@@ -25,15 +25,15 @@ describe Elba::Cli do
|
|
25
25
|
let(:output) { capture(:stdout) { subject.help } }
|
26
26
|
|
27
27
|
it "can list" do
|
28
|
-
output.
|
28
|
+
expect(output).to include "list"
|
29
29
|
end
|
30
30
|
|
31
31
|
it "can attach" do
|
32
|
-
output.
|
32
|
+
expect(output).to include "attach"
|
33
33
|
end
|
34
34
|
|
35
35
|
it "can detach" do
|
36
|
-
output.
|
36
|
+
expect(output).to include "detach"
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
@@ -43,21 +43,21 @@ describe Elba::Cli do
|
|
43
43
|
subject.list
|
44
44
|
}
|
45
45
|
|
46
|
-
output.
|
47
|
-
output.
|
46
|
+
expect(output).to include "1 ELB found"
|
47
|
+
expect(output).to include " * #{elb.id}"
|
48
48
|
end
|
49
49
|
|
50
50
|
context '--instances' do
|
51
51
|
it 'prints instances attached to each load balancer' do
|
52
|
-
elb.
|
52
|
+
allow(elb).to receive(:instances) { [instance1.id] }
|
53
53
|
|
54
54
|
output = capture(:stdout) {
|
55
55
|
subject.list('--instances')
|
56
56
|
}
|
57
57
|
|
58
|
-
output.
|
59
|
-
output.
|
60
|
-
output.
|
58
|
+
expect(output).to include "1 ELB found"
|
59
|
+
expect(output).to include " * #{elb.id}"
|
60
|
+
expect(output).to include " - #{instance1.id}"
|
61
61
|
end
|
62
62
|
end
|
63
63
|
end
|
@@ -72,16 +72,16 @@ describe Elba::Cli do
|
|
72
72
|
end
|
73
73
|
|
74
74
|
it 'prints the list of instances attached to an ELB' do
|
75
|
-
output.
|
76
|
-
output.
|
77
|
-
output.
|
75
|
+
expect(output).to include " * #{elb.id}"
|
76
|
+
expect(output).to include " - #{instance1.id}"
|
77
|
+
expect(output).to include " - #{instance2.id}"
|
78
78
|
end
|
79
79
|
|
80
80
|
context 'no balancer name is passed' do
|
81
81
|
let(:perform) { subject.attached }
|
82
82
|
|
83
83
|
it 'exits' do
|
84
|
-
output.
|
84
|
+
expect(output).to include 'You must specify an ELB'
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
@@ -89,17 +89,17 @@ describe Elba::Cli do
|
|
89
89
|
let(:perform) { subject.attached 'yolo' }
|
90
90
|
|
91
91
|
it 'exits' do
|
92
|
-
output.
|
92
|
+
expect(output).to include 'Could not find balancer'
|
93
93
|
end
|
94
94
|
end
|
95
95
|
|
96
96
|
context '--porcelain' do
|
97
97
|
before do
|
98
|
-
subject.
|
98
|
+
allow(subject).to receive(:options).and_return({ porcelain: true })
|
99
99
|
end
|
100
100
|
|
101
101
|
it 'prints the list of instances attached to an ELB without decoration' do
|
102
|
-
output.
|
102
|
+
expect(output).to include "#{instance1.id} #{instance2.id}"
|
103
103
|
end
|
104
104
|
end
|
105
105
|
end
|
@@ -113,8 +113,8 @@ describe Elba::Cli do
|
|
113
113
|
it 'which load balancer to use' do
|
114
114
|
allow(subject).to receive(:ask).and_return("0")
|
115
115
|
|
116
|
-
output.
|
117
|
-
output.
|
116
|
+
expect(output).to include "You must specify an ELB"
|
117
|
+
expect(output).to include "successfully"
|
118
118
|
end
|
119
119
|
end
|
120
120
|
|
@@ -123,14 +123,14 @@ describe Elba::Cli do
|
|
123
123
|
let(:output) { capture(:stdout) { perform } }
|
124
124
|
|
125
125
|
it 'exits if no ELB available' do
|
126
|
-
subject.
|
126
|
+
allow(subject).to receive(:elbs) { [] }
|
127
127
|
|
128
|
-
output.
|
128
|
+
expect(output).to include "No load balancer available"
|
129
129
|
end
|
130
130
|
|
131
131
|
it 'uses default ELB when only 1 available' do
|
132
|
-
output.
|
133
|
-
output.
|
132
|
+
expect(output).to include "Using default load balancer: #{elb.id}"
|
133
|
+
expect(output).to include "#{instance1.id} successfully attached to #{elb.id}"
|
134
134
|
end
|
135
135
|
|
136
136
|
it_should_behave_like "asking user"
|
@@ -145,8 +145,8 @@ describe Elba::Cli do
|
|
145
145
|
it 'works and reports success' do
|
146
146
|
allow(subject).to receive(:ask).and_return("0")
|
147
147
|
|
148
|
-
output.
|
149
|
-
output.
|
148
|
+
expect(output).to include "#{instance1.id} successfully attached to #{elb.id}"
|
149
|
+
expect(output).to include "#{instance2.id} successfully attached to #{elb.id}"
|
150
150
|
end
|
151
151
|
end
|
152
152
|
|
@@ -158,16 +158,16 @@ describe Elba::Cli do
|
|
158
158
|
it 'which load balancer to use' do
|
159
159
|
allow(subject).to receive(:ask)
|
160
160
|
|
161
|
-
output.
|
162
|
-
output.
|
163
|
-
output.
|
161
|
+
expect(output).to_not include "No load balancer available"
|
162
|
+
expect(output).to_not include "Using default load balancer"
|
163
|
+
expect(output).to_not include "You must specify an ELB"
|
164
164
|
expect(subject).to_not have_received(:ask)
|
165
165
|
end
|
166
166
|
end
|
167
167
|
|
168
168
|
context '--to elb instance1' do
|
169
169
|
let(:perform) do
|
170
|
-
subject.
|
170
|
+
allow(subject).to receive(:options).and_return({ to: elb.id })
|
171
171
|
subject.attach instance1.id
|
172
172
|
end
|
173
173
|
|
@@ -176,13 +176,13 @@ describe Elba::Cli do
|
|
176
176
|
it_should_behave_like "not asking user"
|
177
177
|
|
178
178
|
it 'works and reports success' do
|
179
|
-
output.
|
179
|
+
expect(output).to include "#{instance1.id} successfully attached to #{elb.id}"
|
180
180
|
end
|
181
181
|
end
|
182
182
|
|
183
183
|
context '--to elb instance1 instance2' do
|
184
184
|
let(:perform) do
|
185
|
-
subject.
|
185
|
+
allow(subject).to receive(:options).and_return({ to: elb.id })
|
186
186
|
subject.attach instance1.id, instance2.id
|
187
187
|
end
|
188
188
|
|
@@ -191,8 +191,8 @@ describe Elba::Cli do
|
|
191
191
|
it_should_behave_like "not asking user"
|
192
192
|
|
193
193
|
it 'works and reports success' do
|
194
|
-
output.
|
195
|
-
output.
|
194
|
+
expect(output).to include "#{instance1.id} successfully attached to #{elb.id}"
|
195
|
+
expect(output).to include "#{instance2.id} successfully attached to #{elb.id}"
|
196
196
|
end
|
197
197
|
end
|
198
198
|
|
@@ -209,7 +209,7 @@ describe Elba::Cli do
|
|
209
209
|
let(:perform) { subject.detach instance1.id }
|
210
210
|
|
211
211
|
it 'works and reports success' do
|
212
|
-
output.
|
212
|
+
expect(output).to include "#{instance1.id} successfully detached from #{elb.id}"
|
213
213
|
end
|
214
214
|
end
|
215
215
|
|
@@ -221,12 +221,12 @@ describe Elba::Cli do
|
|
221
221
|
let(:perform) { subject.detach instance1.id, instance2.id }
|
222
222
|
|
223
223
|
it 'works and reports success' do
|
224
|
-
output.
|
224
|
+
expect(output).to include "#{instance1.id}, #{instance2.id} successfully detached from #{elb.id}"
|
225
225
|
end
|
226
226
|
|
227
227
|
it 'warn if instances not attached to any ELB' do
|
228
228
|
silence(:stdout) { subject.detach instance1.id, instance2.id }
|
229
|
-
output.
|
229
|
+
expect(output).to include "Unable to find any ELB to detach #{instance1.id}, #{instance2.id}"
|
230
230
|
end
|
231
231
|
end
|
232
232
|
|
@@ -244,8 +244,8 @@ describe Elba::Cli do
|
|
244
244
|
let(:output) { capture(:stdout) { subject.detach instance1.id, instance3.id, instance2.id } }
|
245
245
|
|
246
246
|
it 'works like a charm' do
|
247
|
-
output.
|
248
|
-
output.
|
247
|
+
expect(output).to include "#{instance1.id}, #{instance2.id} successfully detached from #{elb.id}"
|
248
|
+
expect(output).to include "#{instance3.id} successfully detached from #{elb2.id}"
|
249
249
|
end
|
250
250
|
end
|
251
251
|
end
|
@@ -6,7 +6,7 @@ describe Elba::Client do
|
|
6
6
|
|
7
7
|
context '.new' do
|
8
8
|
it 'raises an error when missing credentials' do
|
9
|
-
expect { described_class.new }.to raise_error
|
9
|
+
expect { described_class.new }.to raise_error(RuntimeError)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
@@ -44,12 +44,12 @@ describe Elba::Client do
|
|
44
44
|
end
|
45
45
|
|
46
46
|
it '(on success) executes success callback' do
|
47
|
-
capture(:stdout) { perform }.
|
47
|
+
expect(capture(:stdout) { perform }).to include 'yay!'
|
48
48
|
end
|
49
49
|
|
50
50
|
it '(on failure) executes failure callback' do
|
51
51
|
allow(elb).to receive(:register_instances).and_raise(Exception)
|
52
|
-
capture(:stdout) { perform }.
|
52
|
+
expect(capture(:stdout) { perform }).to include 'doh!'
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
@@ -67,12 +67,12 @@ describe Elba::Client do
|
|
67
67
|
end
|
68
68
|
|
69
69
|
it '(on success) executes success callback' do
|
70
|
-
capture(:stdout) { perform }.
|
70
|
+
expect(capture(:stdout) { perform }).to include 'yay!'
|
71
71
|
end
|
72
72
|
|
73
73
|
it '(on failure) executes failure callback' do
|
74
74
|
allow(elb).to receive(:deregister_instances).and_raise(Exception)
|
75
|
-
capture(:stdout) { perform }.
|
75
|
+
expect(capture(:stdout) { perform }).to include 'doh!'
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
data/spec/spec_helper.rb
CHANGED
@@ -5,8 +5,8 @@ require 'elba'
|
|
5
5
|
require 'support/mocks'
|
6
6
|
|
7
7
|
RSpec.configure do |config|
|
8
|
-
config.
|
9
|
-
config.formatter
|
8
|
+
config.color = true
|
9
|
+
config.formatter = :documentation
|
10
10
|
|
11
11
|
config.before(:each) do
|
12
12
|
# Pretend we're running as 'elba'
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcus Mitchell
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-
|
13
|
+
date: 2015-11-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -179,4 +179,3 @@ summary: Command-line interface for Amazon's ELB
|
|
179
179
|
test_files:
|
180
180
|
- spec/lib/elba/cli_spec.rb
|
181
181
|
- spec/lib/elba/client_spec.rb
|
182
|
-
has_rdoc:
|