vagrant-host-shell 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile
CHANGED
@@ -1 +1,15 @@
|
|
1
|
-
require
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
|
4
|
+
# Immediately sync all stdout so that tools like buildbot can
|
5
|
+
# immediately load in the output.
|
6
|
+
$stdout.sync = true
|
7
|
+
$stderr.sync = true
|
8
|
+
|
9
|
+
# Change to the directory of this file.
|
10
|
+
Dir.chdir(File.expand_path("../", __FILE__))
|
11
|
+
|
12
|
+
# This installs the tasks that help with gem creation and
|
13
|
+
# publishing.
|
14
|
+
Bundler::GemHelper.install_tasks
|
15
|
+
|
data/lib/vagrant-host-shell.rb
CHANGED
@@ -1,13 +1,19 @@
|
|
1
1
|
module VagrantPlugins::HostShell
|
2
2
|
class Config < Vagrant.plugin('2', :config)
|
3
3
|
attr_accessor :inline
|
4
|
+
attr_accessor :cwd
|
5
|
+
attr_accessor :abort_on_nonzero
|
4
6
|
|
5
7
|
def initialize
|
6
8
|
@inline = UNSET_VALUE
|
9
|
+
@cwd = UNSET_VALUE
|
10
|
+
@abort_on_nonzero = UNSET_VALUE
|
7
11
|
end
|
8
12
|
|
9
13
|
def finalize!
|
10
14
|
@inline = nil if @inline == UNSET_VALUE
|
15
|
+
@cwd = nil if @cwd == UNSET_VALUE
|
16
|
+
@abort_on_nonzero = false if @abort_on_nonzero == UNSET_VALUE
|
11
17
|
end
|
12
18
|
|
13
19
|
def validate(machine)
|
@@ -17,6 +23,14 @@ module VagrantPlugins::HostShell
|
|
17
23
|
errors << ':host_shell provisioner requires inline to be set'
|
18
24
|
end
|
19
25
|
|
26
|
+
unless abort_on_nonzero.is_a?(TrueClass) || abort_on_nonzero.is_a?(FalseClass)
|
27
|
+
errors << ':host_shell provisioner requires abort_on_nonzero to be a boolean'
|
28
|
+
end
|
29
|
+
|
30
|
+
unless cwd.is_a?(String) || cwd.nil?
|
31
|
+
errors << ':host_shell provisioner requires cwd to be a string or nil'
|
32
|
+
end
|
33
|
+
|
20
34
|
{ 'host shell provisioner' => errors }
|
21
35
|
end
|
22
36
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module VagrantPlugins::HostShell::Errors
|
2
|
+
|
3
|
+
class VagrantHostShellError < Vagrant::Errors::VagrantError; end
|
4
|
+
|
5
|
+
class NonZeroStatusError < VagrantHostShellError
|
6
|
+
def initialize(command, exit_code)
|
7
|
+
@command = command
|
8
|
+
@exit_code = exit_code
|
9
|
+
super nil
|
10
|
+
end
|
11
|
+
|
12
|
+
def error_message
|
13
|
+
"Command [#{@command}] exited with non-zero status [#{@exit_code}]"
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -1,14 +1,20 @@
|
|
1
1
|
module VagrantPlugins::HostShell
|
2
2
|
class Provisioner < Vagrant.plugin('2', :provisioner)
|
3
3
|
def provision
|
4
|
-
Vagrant::Util::Subprocess.execute(
|
4
|
+
result = Vagrant::Util::Subprocess.execute(
|
5
5
|
'/bin/bash',
|
6
6
|
'-c',
|
7
7
|
config.inline,
|
8
|
-
:notify => [:stdout, :stderr]
|
8
|
+
:notify => [:stdout, :stderr],
|
9
|
+
:workdir => config.cwd
|
9
10
|
) do |io_name, data|
|
10
11
|
@machine.env.ui.info "[#{io_name}] #{data}"
|
11
12
|
end
|
13
|
+
|
14
|
+
if config.abort_on_nonzero && !result.exit_code.zero?
|
15
|
+
raise VagrantPlugins::HostShell::Errors::NonZeroStatusError.new(config.inline, result.exit_code)
|
16
|
+
end
|
17
|
+
|
12
18
|
end
|
13
19
|
end
|
14
20
|
end
|
data/vagrant-host-shell.gemspec
CHANGED
@@ -7,8 +7,8 @@ require 'vagrant-host-shell/version'
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
8
|
spec.name = "vagrant-host-shell"
|
9
9
|
spec.version = VagrantPlugins::HostShell::VERSION
|
10
|
-
spec.authors = ["Paul Hinze"]
|
11
|
-
spec.email = ["paul.t.hinze@gmail.com"]
|
10
|
+
spec.authors = ["Paul Hinze", "Carlos Brito Lage"]
|
11
|
+
spec.email = ["paul.t.hinze@gmail.com", "carlos@compstak.com"]
|
12
12
|
spec.description = %q{a vagrant provisioner to run commands on the host}
|
13
13
|
spec.summary = %q{a vagrant provisioner to run commands on the host}
|
14
14
|
spec.homepage = ""
|
metadata
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-host-shell
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Paul Hinze
|
9
|
+
- Carlos Brito Lage
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date: 2013-
|
13
|
+
date: 2013-12-05 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: bundler
|
@@ -46,6 +47,7 @@ dependencies:
|
|
46
47
|
description: a vagrant provisioner to run commands on the host
|
47
48
|
email:
|
48
49
|
- paul.t.hinze@gmail.com
|
50
|
+
- carlos@compstak.com
|
49
51
|
executables: []
|
50
52
|
extensions: []
|
51
53
|
extra_rdoc_files: []
|
@@ -58,6 +60,7 @@ files:
|
|
58
60
|
- examples/Vagrantfile
|
59
61
|
- lib/vagrant-host-shell.rb
|
60
62
|
- lib/vagrant-host-shell/config.rb
|
63
|
+
- lib/vagrant-host-shell/errors.rb
|
61
64
|
- lib/vagrant-host-shell/plugin.rb
|
62
65
|
- lib/vagrant-host-shell/provisioner.rb
|
63
66
|
- lib/vagrant-host-shell/version.rb
|
@@ -77,7 +80,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
77
80
|
version: '0'
|
78
81
|
segments:
|
79
82
|
- 0
|
80
|
-
hash:
|
83
|
+
hash: 1738926357149632159
|
81
84
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
85
|
none: false
|
83
86
|
requirements:
|
@@ -86,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
89
|
version: '0'
|
87
90
|
segments:
|
88
91
|
- 0
|
89
|
-
hash:
|
92
|
+
hash: 1738926357149632159
|
90
93
|
requirements: []
|
91
94
|
rubyforge_project:
|
92
95
|
rubygems_version: 1.8.23
|