vagrant-shell-commander 0.3.1 → 0.3.2
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.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/Gemfile +1 -1
- data/Gemfile.lock +58 -11
- data/README.md +0 -4
- data/Vagrantfile +0 -2
- data/lib/vagrant-shell-commander/action.rb +11 -6
- data/lib/vagrant-shell-commander/plugin.rb +2 -4
- data/lib/vagrant-shell-commander/version.rb +1 -1
- data/spec/action_spec.rb +18 -11
- data/spec/plugin_spec.rb +3 -12
- data/vagrant-shell-commander.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 403a125165298249437e85389ce789910632112c
|
|
4
|
+
data.tar.gz: fd638477217db9608c676f844db41403f048f4eb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2ae90d5c54a55ae0b63ccf8ecb1eb0edc17afafd05ed404d8c4e3ceda3397144e282a81ccd57f6b6e97e118001bb75969c22684257b6c935ccf903f5047d94e2
|
|
7
|
+
data.tar.gz: 2a88eb19682d112a8eca43ddd66463f2b83e31561633666579831f6bdb845d9ceb226273d42aa52a3a08cb3aaa77e9548cbfbd4ac82b1e20384044c5f03ba4a4
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,51 +1,77 @@
|
|
|
1
1
|
GIT
|
|
2
2
|
remote: git://github.com/mitchellh/vagrant.git
|
|
3
|
-
revision:
|
|
4
|
-
tag: v1.
|
|
3
|
+
revision: 970ed5068ede4f6aae4b51e2cabe872aa924cacf
|
|
4
|
+
tag: v1.6.2
|
|
5
5
|
specs:
|
|
6
|
-
vagrant (1.
|
|
7
|
-
bundler (
|
|
6
|
+
vagrant (1.6.2)
|
|
7
|
+
bundler (>= 1.5.2, < 1.7.0)
|
|
8
8
|
childprocess (~> 0.5.0)
|
|
9
9
|
erubis (~> 2.7.0)
|
|
10
10
|
i18n (~> 0.6.0)
|
|
11
|
-
listen (~> 2.
|
|
11
|
+
listen (~> 2.7.1)
|
|
12
12
|
log4r (~> 1.1.9, < 1.1.11)
|
|
13
13
|
net-scp (~> 1.1.0)
|
|
14
|
-
net-ssh (>= 2.6.6, < 2.
|
|
14
|
+
net-ssh (>= 2.6.6, < 2.10.0)
|
|
15
15
|
rb-kqueue (~> 0.2.0)
|
|
16
16
|
wdm (~> 0.1.0)
|
|
17
|
+
winrm (~> 1.1.3)
|
|
17
18
|
|
|
18
19
|
PATH
|
|
19
20
|
remote: .
|
|
20
21
|
specs:
|
|
21
|
-
vagrant-shell-commander (0.3.
|
|
22
|
+
vagrant-shell-commander (0.3.2)
|
|
22
23
|
|
|
23
24
|
GEM
|
|
24
25
|
remote: https://rubygems.org/
|
|
25
26
|
specs:
|
|
27
|
+
akami (1.2.2)
|
|
28
|
+
gyoku (>= 0.4.0)
|
|
29
|
+
nokogiri
|
|
30
|
+
builder (3.2.2)
|
|
26
31
|
cane (2.6.0)
|
|
27
32
|
parallel
|
|
28
33
|
celluloid (0.15.2)
|
|
29
34
|
timers (~> 1.1.0)
|
|
30
|
-
childprocess (0.5.
|
|
35
|
+
childprocess (0.5.3)
|
|
31
36
|
ffi (~> 1.0, >= 1.0.11)
|
|
37
|
+
columnize (0.8.9)
|
|
38
|
+
debugger-linecache (1.2.0)
|
|
39
|
+
debugger2 (1.0.0.beta2)
|
|
40
|
+
columnize (>= 0.3.1)
|
|
41
|
+
debugger-linecache (~> 1.2.0)
|
|
32
42
|
diff-lcs (1.2.4)
|
|
33
43
|
erubis (2.7.0)
|
|
34
44
|
ffi (1.9.3)
|
|
45
|
+
gssapi (1.0.3)
|
|
46
|
+
ffi (>= 1.0.1)
|
|
47
|
+
gyoku (1.1.1)
|
|
48
|
+
builder (>= 2.1.2)
|
|
49
|
+
httpclient (2.3.4.1)
|
|
50
|
+
httpi (0.9.7)
|
|
51
|
+
rack
|
|
35
52
|
i18n (0.6.9)
|
|
36
|
-
listen (2.
|
|
53
|
+
listen (2.7.5)
|
|
37
54
|
celluloid (>= 0.15.2)
|
|
38
55
|
rb-fsevent (>= 0.9.3)
|
|
39
56
|
rb-inotify (>= 0.9)
|
|
57
|
+
little-plugger (1.1.3)
|
|
40
58
|
log4r (1.1.10)
|
|
59
|
+
logging (1.8.1)
|
|
60
|
+
little-plugger (>= 1.1.3)
|
|
61
|
+
multi_json (>= 1.3.6)
|
|
62
|
+
mini_portile (0.6.0)
|
|
41
63
|
multi_json (1.7.7)
|
|
42
64
|
net-scp (1.1.2)
|
|
43
65
|
net-ssh (>= 2.6.5)
|
|
44
|
-
net-ssh (2.
|
|
66
|
+
net-ssh (2.9.1)
|
|
67
|
+
nokogiri (1.6.2.1)
|
|
68
|
+
mini_portile (= 0.6.0)
|
|
69
|
+
nori (1.1.5)
|
|
45
70
|
parallel (0.7.1)
|
|
71
|
+
rack (1.5.2)
|
|
46
72
|
rake (10.1.0)
|
|
47
73
|
rb-fsevent (0.9.4)
|
|
48
|
-
rb-inotify (0.9.
|
|
74
|
+
rb-inotify (0.9.4)
|
|
49
75
|
ffi (>= 0.5.0)
|
|
50
76
|
rb-kqueue (0.2.2)
|
|
51
77
|
ffi (>= 0.5.0)
|
|
@@ -66,13 +92,33 @@ GEM
|
|
|
66
92
|
sexp_processor (~> 4.0)
|
|
67
93
|
ruby_parser (3.1.3)
|
|
68
94
|
sexp_processor (~> 4.1)
|
|
95
|
+
rubyntlm (0.1.1)
|
|
96
|
+
savon (0.9.5)
|
|
97
|
+
akami (~> 1.0)
|
|
98
|
+
builder (>= 2.1.2)
|
|
99
|
+
gyoku (>= 0.4.0)
|
|
100
|
+
httpi (~> 0.9)
|
|
101
|
+
nokogiri (>= 1.4.0)
|
|
102
|
+
nori (~> 1.0)
|
|
103
|
+
wasabi (~> 1.0)
|
|
69
104
|
sexp_processor (4.2.1)
|
|
70
105
|
simplecov (0.7.1)
|
|
71
106
|
multi_json (~> 1.0)
|
|
72
107
|
simplecov-html (~> 0.7.1)
|
|
73
108
|
simplecov-html (0.7.1)
|
|
74
109
|
timers (1.1.0)
|
|
110
|
+
uuidtools (2.1.4)
|
|
111
|
+
wasabi (1.0.0)
|
|
112
|
+
nokogiri (>= 1.4.0)
|
|
75
113
|
wdm (0.1.0)
|
|
114
|
+
winrm (1.1.3)
|
|
115
|
+
gssapi (~> 1.0.0)
|
|
116
|
+
httpclient (~> 2.2, >= 2.2.0.2)
|
|
117
|
+
logging (~> 1.6, >= 1.6.1)
|
|
118
|
+
nokogiri (~> 1.5)
|
|
119
|
+
rubyntlm (~> 0.1.1)
|
|
120
|
+
savon (= 0.9.5)
|
|
121
|
+
uuidtools (~> 2.1.2)
|
|
76
122
|
yard (0.8.6.2)
|
|
77
123
|
|
|
78
124
|
PLATFORMS
|
|
@@ -81,6 +127,7 @@ PLATFORMS
|
|
|
81
127
|
DEPENDENCIES
|
|
82
128
|
bundler (~> 1.3)
|
|
83
129
|
cane
|
|
130
|
+
debugger2
|
|
84
131
|
rake
|
|
85
132
|
reek
|
|
86
133
|
rspec
|
data/README.md
CHANGED
|
@@ -58,7 +58,3 @@ This can be handy if, for example, you want an application to start on boot and
|
|
|
58
58
|
4. Commit your changes (`git commit -am 'Add some feature'`)
|
|
59
59
|
5. Push to the branch (`git push origin my-new-feature`)
|
|
60
60
|
6. Create new Pull Request
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
[](https://bitdeli.com/free "Bitdeli Badge")
|
|
64
|
-
|
data/Vagrantfile
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require "log4r"
|
|
2
|
+
|
|
1
3
|
module VagrantPlugins
|
|
2
4
|
module ShellCommander
|
|
3
5
|
# Action for shell command hooking
|
|
@@ -11,8 +13,9 @@ module VagrantPlugins
|
|
|
11
13
|
# @return nil
|
|
12
14
|
#
|
|
13
15
|
def initialize(app, env)
|
|
14
|
-
@app
|
|
15
|
-
@
|
|
16
|
+
@app = app
|
|
17
|
+
@env = env
|
|
18
|
+
@logger = Log4r::Logger.new("vagrant::plugins::shell-commander::action")
|
|
16
19
|
end
|
|
17
20
|
|
|
18
21
|
# Call method of this middleware
|
|
@@ -21,11 +24,13 @@ module VagrantPlugins
|
|
|
21
24
|
# @return nil
|
|
22
25
|
#
|
|
23
26
|
def call(env)
|
|
27
|
+
@logger.debug("hook fired for action #{@env[:action_name]}, machine_action: #{@env[:machine_action]}")
|
|
24
28
|
@app.call(env)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
if @env[:machine] && @env[:machine].state.id != :poweroff &&
|
|
30
|
+
! @env[:machine].config.sh.after_share_folders.nil?
|
|
31
|
+
@env[:machine].action(:ssh_run,
|
|
32
|
+
ssh_run_command: @env[:machine].config.sh.after_share_folders,
|
|
33
|
+
ssh_opts: {extra_args: []})
|
|
29
34
|
end
|
|
30
35
|
end
|
|
31
36
|
end
|
|
@@ -13,10 +13,8 @@ module VagrantPlugins
|
|
|
13
13
|
Config
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
hook.append(Action)
|
|
19
|
-
end
|
|
16
|
+
action_hook :sh_hook do |hook|
|
|
17
|
+
hook.after(Vagrant::Action::Builtin::Provision, Action)
|
|
20
18
|
end
|
|
21
19
|
end
|
|
22
20
|
end
|
data/spec/action_spec.rb
CHANGED
|
@@ -2,13 +2,13 @@ require 'spec_helper'
|
|
|
2
2
|
|
|
3
3
|
describe VagrantPlugins::ShellCommander::Action do
|
|
4
4
|
let(:app) {double(call: true)}
|
|
5
|
-
let(:
|
|
6
|
-
let(:env) {double(:[] => machine)}
|
|
5
|
+
let(:state) {double(id: :poweron)}
|
|
7
6
|
let(:cmd) {'cmd'}
|
|
8
7
|
let(:sh) {double(after_share_folders: cmd)}
|
|
9
8
|
let(:config) {double(sh: sh)}
|
|
10
|
-
let(:machine_env) {double(config: config)}
|
|
9
|
+
let(:machine_env) {double(config: config, state: state, action: true)}
|
|
11
10
|
let(:action_env) {{machine: machine_env}}
|
|
11
|
+
let(:env) {double(:[] => machine_env)}
|
|
12
12
|
let(:subject) {described_class.new(app, env)}
|
|
13
13
|
|
|
14
14
|
describe "#call" do
|
|
@@ -20,23 +20,30 @@ describe VagrantPlugins::ShellCommander::Action do
|
|
|
20
20
|
|
|
21
21
|
describe "SSHRun call" do
|
|
22
22
|
it "should call SSHRun action of the current machine with the after_boot option as command" do
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
expect(machine).to receive(:action).with(:ssh_run, ssh_run_command: cmd, ssh_opts: {:extra_args=>[]})
|
|
23
|
+
expect(machine_env).to receive(:action).with(:ssh_run, ssh_run_command: cmd, ssh_opts: {extra_args: []})
|
|
26
24
|
|
|
27
25
|
subject.call(action_env)
|
|
28
26
|
end
|
|
29
27
|
|
|
30
|
-
it "should not call SSHRun action if
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
it "should not call SSHRun action if after_share_folder option is nil" do
|
|
29
|
+
machine_env = double(config: config, state: state)
|
|
30
|
+
action_env = {machine: machine_env}
|
|
31
|
+
|
|
32
|
+
expect(machine_env).not_to receive(:action)
|
|
33
|
+
|
|
34
|
+
subject.call(action_env)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it "should not call SSHRun action if machine is not powered on" do
|
|
38
|
+
state = double(id: :poweroff)
|
|
39
|
+
machine_env = double(config: config, state: state, action: true)
|
|
34
40
|
action_env = {machine: machine_env}
|
|
35
41
|
|
|
36
|
-
expect(
|
|
42
|
+
expect(machine_env).not_to receive(:action)
|
|
37
43
|
|
|
38
44
|
subject.call(action_env)
|
|
39
45
|
end
|
|
46
|
+
|
|
40
47
|
end
|
|
41
48
|
end
|
|
42
49
|
end
|
data/spec/plugin_spec.rb
CHANGED
|
@@ -18,20 +18,11 @@ describe VagrantPlugins::ShellCommander::Plugin do
|
|
|
18
18
|
context 'action hooks' do
|
|
19
19
|
let(:hook) {double(append: true, prepend: true)}
|
|
20
20
|
|
|
21
|
-
it
|
|
22
|
-
hook_proc = described_class.components.action_hooks[:
|
|
21
|
+
it 'should define an action hook for after share folders' do
|
|
22
|
+
hook_proc = described_class.components.action_hooks[:__all_actions__][0]
|
|
23
23
|
hook = double
|
|
24
|
-
expect(hook).to receive(:
|
|
24
|
+
expect(hook).to receive(:after).with(Vagrant::Action::Builtin::Provision, VagrantPlugins::ShellCommander::Action)
|
|
25
25
|
hook_proc.call(hook)
|
|
26
26
|
end
|
|
27
|
-
|
|
28
|
-
it "should define an action hook for machine_action_reload" do
|
|
29
|
-
hook_proc = described_class.components.action_hooks[:machine_action_reload][0]
|
|
30
|
-
hook = double
|
|
31
|
-
expect(hook).to receive(:append).with(VagrantPlugins::ShellCommander::Action)
|
|
32
|
-
hook_proc.call(hook)
|
|
33
|
-
end
|
|
34
|
-
|
|
35
27
|
end
|
|
36
|
-
|
|
37
28
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: vagrant-shell-commander
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Federico Gimenez Nieto
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-
|
|
11
|
+
date: 2014-05-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -108,6 +108,20 @@ dependencies:
|
|
|
108
108
|
- - ">="
|
|
109
109
|
- !ruby/object:Gem::Version
|
|
110
110
|
version: '0'
|
|
111
|
+
- !ruby/object:Gem::Dependency
|
|
112
|
+
name: debugger2
|
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - ">="
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: '0'
|
|
118
|
+
type: :development
|
|
119
|
+
prerelease: false
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - ">="
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: '0'
|
|
111
125
|
description: Vagrant plugin for executing shell commands on guests machines and hooking
|
|
112
126
|
them in the boot process
|
|
113
127
|
email:
|