derelict 0.2.2.travis.82 → 0.2.2.travis.84
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/derelict/virtual_machine.rb +5 -2
- data/spec/derelict/virtual_machine_spec.rb +24 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YjJlNzVkODdiMWY5MWFhMDg3MmQ4ODQxZDg3NTFlZmI1ZDNiYzdkMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
Y2Y1MjBiOWU0ZjNmNzdhYTJhZTQ4Y2Y2Mjk3MmUzNjA4NDgzYzI0Yg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NWVmNDFiZDM3NTkxOGE5MzIwZjU2ZWNjZDBlMzZlZjQ5MTAzNWQ3M2NjZWMw
|
10
|
+
ZDBkZGU3YTQ4YThkMmQ3NDBhYWM0YjFmZjk0M2MzMjk5ZDA5NDIwOTZmYzUz
|
11
|
+
MmQ2MzM0NjQwMWRhZjQyYTIyYjVkMTFiYmFhM2JiOGU1M2Y4NDA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZDBiOGJiYTNhNzI2MWIzNmI1NWM5YWUyNWIwNDhiYWZhNjIwYmE2M2VkN2Qw
|
14
|
+
MmMxMzM1NmNiOWIyMDhhMWY0NzM1NGJkNDdkNDhmNDQ3YWU5MGY4NDcwZjVh
|
15
|
+
OTIwNzE2Y2FhMzE3MDFkYTc4MmFiYjg4MTgwNGU1NjgwY2RkYTQ=
|
@@ -99,11 +99,14 @@ module Derelict
|
|
99
99
|
logger.info message unless message.nil?
|
100
100
|
|
101
101
|
# Set defaults for the options hash
|
102
|
-
options = {:log => false}.merge args.first
|
102
|
+
options = {:log => false, :color => false}.merge args.first
|
103
103
|
|
104
104
|
# Execute the command, optionally logging output
|
105
105
|
log_block = options[:log] ? shell_log_block : nil
|
106
|
-
|
106
|
+
|
107
|
+
args = [command, name, *arguments_for(command)]
|
108
|
+
args << "--color" if options[:color]
|
109
|
+
connection.execute! *args, &log_block
|
107
110
|
end
|
108
111
|
end
|
109
112
|
|
@@ -124,8 +124,9 @@ describe Derelict::VirtualMachine do
|
|
124
124
|
end
|
125
125
|
|
126
126
|
context "with correct number of arguments" do
|
127
|
+
let(:args) { [:up, name] }
|
127
128
|
before do
|
128
|
-
expect(connection).to receive(:execute!).with(
|
129
|
+
expect(connection).to receive(:execute!).with(*args).and_yield("foo").and_return result
|
129
130
|
end
|
130
131
|
|
131
132
|
context "with external logging disabled" do
|
@@ -145,6 +146,12 @@ describe Derelict::VirtualMachine do
|
|
145
146
|
" INFO virtualmachine: Bringing up Derelict::VirtualMachine 'testvm' from test\n",
|
146
147
|
" INFO external: foo\n",
|
147
148
|
]}
|
149
|
+
|
150
|
+
context "with color enabled" do
|
151
|
+
let(:options) { {:log => true, :color => true} }
|
152
|
+
let(:args) { [:up, name, '--color'] }
|
153
|
+
it { should be result }
|
154
|
+
end
|
148
155
|
end
|
149
156
|
end
|
150
157
|
end
|
@@ -154,8 +161,9 @@ describe Derelict::VirtualMachine do
|
|
154
161
|
let(:result) { double("result") }
|
155
162
|
subject { vm.halt! options }
|
156
163
|
|
164
|
+
let(:args) { [:halt, name] }
|
157
165
|
before do
|
158
|
-
expect(connection).to receive(:execute!).with(
|
166
|
+
expect(connection).to receive(:execute!).with(*args).and_yield("foo").and_return result
|
159
167
|
end
|
160
168
|
|
161
169
|
context "with external logging disabled" do
|
@@ -175,6 +183,12 @@ describe Derelict::VirtualMachine do
|
|
175
183
|
" INFO virtualmachine: Halting Derelict::VirtualMachine 'testvm' from test\n",
|
176
184
|
" INFO external: foo\n",
|
177
185
|
]}
|
186
|
+
|
187
|
+
context "with color enabled" do
|
188
|
+
let(:options) { {:log => true, :color => true} }
|
189
|
+
let(:args) { [:halt, name, '--color'] }
|
190
|
+
it { should be result }
|
191
|
+
end
|
178
192
|
end
|
179
193
|
end
|
180
194
|
|
@@ -183,8 +197,9 @@ describe Derelict::VirtualMachine do
|
|
183
197
|
let(:result) { double("result") }
|
184
198
|
subject { vm.destroy! options }
|
185
199
|
|
200
|
+
let(:args) { [:destroy, name, '--force'] }
|
186
201
|
before do
|
187
|
-
expect(connection).to receive(:execute!).with(
|
202
|
+
expect(connection).to receive(:execute!).with(*args).and_yield("foo").and_return result
|
188
203
|
end
|
189
204
|
|
190
205
|
context "with external logging disabled" do
|
@@ -204,6 +219,12 @@ describe Derelict::VirtualMachine do
|
|
204
219
|
" INFO virtualmachine: Destroying Derelict::VirtualMachine 'testvm' from test\n",
|
205
220
|
" INFO external: foo\n",
|
206
221
|
]}
|
222
|
+
|
223
|
+
context "with color enabled" do
|
224
|
+
let(:options) { {:log => true, :color => true} }
|
225
|
+
let(:args) { [:destroy, name, '--force', '--color'] }
|
226
|
+
it { should be result }
|
227
|
+
end
|
207
228
|
end
|
208
229
|
end
|
209
230
|
|