vagrant-triggers 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -0
- data/.travis.yml +4 -1
- data/CHANGELOG.md +8 -0
- data/Gemfile +0 -0
- data/LICENSE.txt +0 -0
- data/README.md +27 -1
- data/Rakefile +0 -0
- data/lib/vagrant-triggers.rb +0 -0
- data/lib/vagrant-triggers/action.rb +0 -0
- data/lib/vagrant-triggers/action/trigger.rb +0 -0
- data/lib/vagrant-triggers/config.rb +0 -0
- data/lib/vagrant-triggers/config/provisioner.rb +5 -2
- data/lib/vagrant-triggers/config/trigger.rb +0 -0
- data/lib/vagrant-triggers/dsl.rb +5 -3
- data/lib/vagrant-triggers/errors.rb +0 -0
- data/lib/vagrant-triggers/plugin.rb +0 -0
- data/lib/vagrant-triggers/provisioner.rb +0 -0
- data/lib/vagrant-triggers/version.rb +1 -1
- data/locales/en.yml +0 -0
- data/spec/spec_helper.rb +0 -0
- data/spec/vagrant-triggers/action/trigger_spec.rb +0 -0
- data/spec/vagrant-triggers/config/provisioner_spec.rb +17 -2
- data/spec/vagrant-triggers/config/trigger_spec.rb +0 -0
- data/spec/vagrant-triggers/dsl_spec.rb +12 -2
- data/spec/vagrant-triggers/provisioner_spec.rb +0 -0
- data/spec/vagrant-triggers/vagrant_spec.rb +0 -0
- data/vagrant-triggers.gemspec +0 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eab5f910be37b40cbc9319586e7c0c5e4f2248a0
|
4
|
+
data.tar.gz: 998cad1f949056e3632426d3df13a237f4fa8371
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: baa61783466b63533d4c13aa9377998bb8333d25b16824e9026e188714ff508cabe44f3df713b1f80ddcecb5613c3a042f5ba546cf415383706a5cabade943ec
|
7
|
+
data.tar.gz: 9d40978b228fe256578e62b4f1f8935f59f31b316c6abbba4e230ad675dfd2ea59fa523d4697ff58cd32c31a4b057bb7dce7866630214d64eb702a0fdb4c2802
|
data/.gitignore
CHANGED
File without changes
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## 0.5.1 (August 3, 2015)
|
2
|
+
|
3
|
+
BUG FIXES:
|
4
|
+
|
5
|
+
- Change directory to environment root path before running host commands [(#44)](https://github.com/emyl/vagrant-triggers/issues/44)
|
6
|
+
- ```:stdout``` and ```:stderr``` options defaults to true when using provisioner [(#42)](https://github.com/emyl/vagrant-triggers/issues/42)
|
7
|
+
- Properly escape regexp in DSL [(#46)](https://github.com/emyl/vagrant-triggers/issues/46)
|
8
|
+
|
1
9
|
## 0.5.0 (December 29, 2014)
|
2
10
|
|
3
11
|
**BEHAVIOURAL CHANGES:**
|
data/Gemfile
CHANGED
File without changes
|
data/LICENSE.txt
CHANGED
File without changes
|
data/README.md
CHANGED
@@ -76,12 +76,38 @@ For additional details you can take a look to the [VagrantPlugins::Triggers::DSL
|
|
76
76
|
|
77
77
|
Triggers won't run if ```VAGRANT_NO_TRIGGERS``` environment variable is set.
|
78
78
|
|
79
|
+
### Attaching to every command
|
80
|
+
|
81
|
+
The special name `:ALL` can be used as a wildcard for every vagrant command:
|
82
|
+
|
83
|
+
```ruby
|
84
|
+
Vagrant.configure("2") do |config|
|
85
|
+
config.trigger.before :ALL do
|
86
|
+
...
|
87
|
+
end
|
88
|
+
end
|
89
|
+
```
|
90
|
+
|
91
|
+
### Blacklisting commands
|
92
|
+
|
93
|
+
Commands can be blacklisted, so that the `:ALL` wildcard has no effect on them:
|
94
|
+
|
95
|
+
```ruby
|
96
|
+
Vagrant.configure("2") do |config|
|
97
|
+
config.trigger.blacklist :destroy
|
98
|
+
config.trigger.before :ALL do
|
99
|
+
...
|
100
|
+
end
|
101
|
+
end
|
102
|
+
```
|
103
|
+
|
104
|
+
Multiple commands can be blacklisted using an array.
|
105
|
+
|
79
106
|
## A simple example
|
80
107
|
|
81
108
|
Cleanup some temporary files after machine destroy:
|
82
109
|
|
83
110
|
```ruby
|
84
|
-
|
85
111
|
Vagrant.configure("2") do |config|
|
86
112
|
config.trigger.after :destroy do
|
87
113
|
run "rm -Rf tmp/*"
|
data/Rakefile
CHANGED
File without changes
|
data/lib/vagrant-triggers.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -6,7 +6,10 @@ module VagrantPlugins
|
|
6
6
|
attr_reader :trigger_body
|
7
7
|
|
8
8
|
def initialize
|
9
|
-
@options = {
|
9
|
+
@options = {
|
10
|
+
:stderr => true,
|
11
|
+
:stdout => true
|
12
|
+
}
|
10
13
|
end
|
11
14
|
|
12
15
|
def fire(&block)
|
@@ -14,7 +17,7 @@ module VagrantPlugins
|
|
14
17
|
end
|
15
18
|
|
16
19
|
def set_options(options)
|
17
|
-
@options
|
20
|
+
@options.merge!(options)
|
18
21
|
end
|
19
22
|
end
|
20
23
|
end
|
File without changes
|
data/lib/vagrant-triggers/dsl.rb
CHANGED
@@ -41,8 +41,10 @@ module VagrantPlugins
|
|
41
41
|
Bundler.with_clean_env do
|
42
42
|
build_environment
|
43
43
|
@buffer.clear
|
44
|
-
|
45
|
-
|
44
|
+
Dir.chdir(@machine.env.root_path) do
|
45
|
+
result = Vagrant::Util::Subprocess.execute(command[0], *command[1..-1], :notify => [:stdout, :stderr]) do |channel, data|
|
46
|
+
@command_output.call(channel, data, options)
|
47
|
+
end
|
46
48
|
end
|
47
49
|
end
|
48
50
|
info I18n.t("vagrant_triggers.action.trigger.command_finished")
|
@@ -87,7 +89,7 @@ module VagrantPlugins
|
|
87
89
|
# Create the new PATH removing Vagrant bin directory
|
88
90
|
# and appending directories specified through the
|
89
91
|
# :append_to_path option
|
90
|
-
new_path = ENV["VAGRANT_INSTALLER_ENV"] ? ENV["PATH"].gsub(/#{ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"]}.*?#{File::PATH_SEPARATOR}/, "") : ENV["PATH"]
|
92
|
+
new_path = ENV["VAGRANT_INSTALLER_ENV"] ? ENV["PATH"].gsub(/#{Regexp.quote(ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"])}.*?#{Regexp.quote(File::PATH_SEPARATOR)}/, "") : ENV["PATH"]
|
91
93
|
new_path += Array(@options[:append_to_path]).map { |dir| "#{File::PATH_SEPARATOR}#{dir}" }.join
|
92
94
|
ENV["PATH"] = new_path
|
93
95
|
@logger.debug("PATH modified: #{ENV["PATH"]}")
|
File without changes
|
File without changes
|
File without changes
|
data/locales/en.yml
CHANGED
File without changes
|
data/spec/spec_helper.rb
CHANGED
File without changes
|
File without changes
|
@@ -3,6 +3,16 @@ require "spec_helper"
|
|
3
3
|
describe VagrantPlugins::Triggers::Config::Provisioner do
|
4
4
|
let(:config) { described_class.new }
|
5
5
|
|
6
|
+
describe "defaults" do
|
7
|
+
it "should default :stdout option to true" do
|
8
|
+
expect(config.options[:stdout]).to be true
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should default :stderr option to true" do
|
12
|
+
expect(config.options[:stderr]).to be true
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
6
16
|
describe "fire" do
|
7
17
|
it "should record trigger code" do
|
8
18
|
code = Proc.new { "foo" }
|
@@ -13,9 +23,14 @@ describe VagrantPlugins::Triggers::Config::Provisioner do
|
|
13
23
|
|
14
24
|
describe "set_options" do
|
15
25
|
it "should set options" do
|
16
|
-
options = { :foo => "bar"
|
26
|
+
options = { :foo => "bar" }
|
17
27
|
config.set_options(options)
|
18
|
-
expect(config.options).to eq(
|
28
|
+
expect(config.options[:foo]).to eq("bar")
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should override defaults" do
|
32
|
+
config.set_options(:stdout => false)
|
33
|
+
expect(config.options[:stdout]).to be false
|
19
34
|
end
|
20
35
|
end
|
21
36
|
end
|
File without changes
|
@@ -5,7 +5,8 @@ describe VagrantPlugins::Triggers::DSL do
|
|
5
5
|
let(:result) { double("result", :exit_code => 0, :stderr => stderr) }
|
6
6
|
let(:stderr) { double("stderr") }
|
7
7
|
|
8
|
-
let(:machine) { double("machine", :ui => ui) }
|
8
|
+
let(:machine) { double("machine", :env => env, :ui => ui) }
|
9
|
+
let(:env) { double("env", :root_path => ENV["PWD"]) }
|
9
10
|
let(:ui) { double("ui", :info => info) }
|
10
11
|
let(:info) { double("info") }
|
11
12
|
|
@@ -72,6 +73,15 @@ describe VagrantPlugins::Triggers::DSL do
|
|
72
73
|
@options = { :notify => [:stdout, :stderr] }
|
73
74
|
end
|
74
75
|
|
76
|
+
it "should change directory to environment root path" do
|
77
|
+
machine.stub_chain(:env, :root_path).and_return("/")
|
78
|
+
Vagrant::Util::Subprocess.should_receive(:execute) do |command|
|
79
|
+
expect(Dir.pwd).to eq("/")
|
80
|
+
result
|
81
|
+
end
|
82
|
+
@dsl.run(@command)
|
83
|
+
end
|
84
|
+
|
75
85
|
it "should raise an error if executed command exits with non-zero code" do
|
76
86
|
result.stub(:exit_code => 1)
|
77
87
|
expect { @dsl.run(@command) }.to raise_error(VagrantPlugins::Triggers::Errors::CommandFailed)
|
@@ -162,7 +172,7 @@ describe VagrantPlugins::Triggers::DSL do
|
|
162
172
|
File.open("#{ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"]}/bin/#{@command}", "w+", 0700) { |file| }
|
163
173
|
end
|
164
174
|
|
165
|
-
it "should raise a CommandUnavailable error" do
|
175
|
+
it "should raise a CommandUnavailable error", :skip_travis => true do
|
166
176
|
expect { @dsl.run(@command) }.to raise_error(VagrantPlugins::Triggers::Errors::CommandUnavailable)
|
167
177
|
end
|
168
178
|
|
File without changes
|
File without changes
|
data/vagrant-triggers.gemspec
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-triggers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emiliano Ticci
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|