vagrant-shell-commander 0.1.3 → 0.1.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.lock
CHANGED
data/README.md
CHANGED
@@ -15,15 +15,15 @@ As usual with vagrant plugins:
|
|
15
15
|
|
16
16
|
To execute a command on all the machines:
|
17
17
|
|
18
|
-
$ vagrant sh -c
|
18
|
+
$ vagrant sh -c free
|
19
19
|
|
20
20
|
Restrict the machine to run:
|
21
21
|
|
22
|
-
$ vagrant sh -c
|
22
|
+
$ vagrant sh -c free machine1
|
23
23
|
|
24
|
-
Specify the working directory:
|
24
|
+
Specify the working directory (remember to quote multiword commands):
|
25
25
|
|
26
|
-
$ vagrant sh -c 'ls -al' -d
|
26
|
+
$ vagrant sh -c 'ls -al' -d /srv/www
|
27
27
|
|
28
28
|
Get help:
|
29
29
|
|
@@ -11,7 +11,9 @@ module VagrantShellCommander
|
|
11
11
|
|
12
12
|
return unless argv
|
13
13
|
|
14
|
-
|
14
|
+
if [nil, ''].include? cli_options[:values][:cmd]
|
15
|
+
env.ui.info cli_options[:parser]
|
16
|
+
else
|
15
17
|
with_target_vms(argv) do |machine|
|
16
18
|
manage_machine(machine, cli_options)
|
17
19
|
end
|
@@ -21,6 +23,8 @@ module VagrantShellCommander
|
|
21
23
|
|
22
24
|
private
|
23
25
|
|
26
|
+
|
27
|
+
|
24
28
|
# Executes actions for a given machine
|
25
29
|
#
|
26
30
|
# @param [Vagrant::Machine] subject vm
|
@@ -29,7 +33,7 @@ module VagrantShellCommander
|
|
29
33
|
#
|
30
34
|
def manage_machine(machine, cli_options)
|
31
35
|
if machine.state.id != :running
|
32
|
-
env.ui.
|
36
|
+
env.ui.warn("Machine #{machine.name} is not running.")
|
33
37
|
return
|
34
38
|
end
|
35
39
|
|
data/spec/command_spec.rb
CHANGED
@@ -37,7 +37,7 @@ describe VagrantShellCommander::Command do
|
|
37
37
|
|
38
38
|
describe 'command execution' do
|
39
39
|
let(:machine) {double}
|
40
|
-
let(:ui) {double(info: true)}
|
40
|
+
let(:ui) {double(info: true, warn: true)}
|
41
41
|
let(:env) {double(ui: ui)}
|
42
42
|
let(:machine_name) {'machine_name'}
|
43
43
|
|
@@ -57,7 +57,7 @@ describe VagrantShellCommander::Command do
|
|
57
57
|
end
|
58
58
|
|
59
59
|
it 'reports information about state' do
|
60
|
-
ui.should_receive(:
|
60
|
+
ui.should_receive(:warn).with("Machine #{machine_name} is not running.")
|
61
61
|
end
|
62
62
|
|
63
63
|
it 'dows not try to execute the command' do
|
@@ -98,19 +98,22 @@ describe VagrantShellCommander::Command do
|
|
98
98
|
communicate.should_receive(:execute).with("cd #{dir} && #{cmd}")
|
99
99
|
end
|
100
100
|
|
101
|
-
describe '
|
101
|
+
describe 'shows help' do
|
102
|
+
let(:parser) {'parser'}
|
103
|
+
|
102
104
|
after(:each) do
|
103
105
|
subject.should_not_receive(:with_target_vms)
|
106
|
+
ui.should_receive(:info).with(parser)
|
104
107
|
end
|
105
108
|
|
106
109
|
it 'an empty command' do
|
107
110
|
VagrantShellCommander::OptionManager.stub_chain(:new, :execute).
|
108
|
-
and_return(parser:
|
111
|
+
and_return(parser: parser, values: {cmd: '', dir: dir})
|
109
112
|
end
|
110
113
|
|
111
114
|
it 'non present command' do
|
112
115
|
VagrantShellCommander::OptionManager.stub_chain(:new, :execute).
|
113
|
-
and_return(parser:
|
116
|
+
and_return(parser: parser, values: {dir: dir})
|
114
117
|
end
|
115
118
|
end
|
116
119
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-shell-commander
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.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-
|
12
|
+
date: 2013-07-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|