guard-rake-vagrant 0.0.1 → 0.0.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.
- data/README.md +60 -0
- data/lib/guard/rake/vagrant.rb +11 -7
- data/lib/guard/rake/version.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -2,3 +2,63 @@ guard-rake-vagrant
|
|
2
2
|
==================
|
3
3
|
|
4
4
|
Guard Plugin that uses Rake and Vagrant to converge cookbooks and run integration tests.
|
5
|
+
|
6
|
+
Software & Tools
|
7
|
+
------------
|
8
|
+
|
9
|
+
This gem depends on the well installation of the following software & tools:
|
10
|
+
* Vagrant - Recomended version 1.2.2 - http://downloads.vagrantup.com/tags/v1.2.2
|
11
|
+
* Vagrant Plugins
|
12
|
+
* vagrant-berkshelf (1.3.7)
|
13
|
+
* vagrant-windows (1.5.1)
|
14
|
+
```
|
15
|
+
# vagrant plugin install vagrant-berkshelf
|
16
|
+
# vagrant plugin install vagrant-windows
|
17
|
+
```
|
18
|
+
|
19
|
+
Installation
|
20
|
+
------------
|
21
|
+
|
22
|
+
Add this line to your application's Gemfile:
|
23
|
+
|
24
|
+
gem 'guard-rake-vagrant'
|
25
|
+
|
26
|
+
And then execute:
|
27
|
+
|
28
|
+
$ bundle install
|
29
|
+
|
30
|
+
Or install it yourself as:
|
31
|
+
|
32
|
+
$ gem install guard-rake-vagrant
|
33
|
+
|
34
|
+
Setup
|
35
|
+
------------
|
36
|
+
|
37
|
+
Create a Guardfile:
|
38
|
+
```
|
39
|
+
guard :rake, :task => 'doit' do
|
40
|
+
watch(%r{^test/.+_spec\.rb$})
|
41
|
+
end
|
42
|
+
```
|
43
|
+
|
44
|
+
Create a Rakefile:
|
45
|
+
```
|
46
|
+
require 'rake'
|
47
|
+
require 'rspec/core/rake_task'
|
48
|
+
|
49
|
+
RSpec::Core::RakeTask.new(:doit) do |t|
|
50
|
+
# actions (may reference t)
|
51
|
+
end
|
52
|
+
|
53
|
+
desc "This is the description of my :doit task "
|
54
|
+
```
|
55
|
+
|
56
|
+
And then execute:
|
57
|
+
|
58
|
+
$ bundle exec guard
|
59
|
+
|
60
|
+
|
61
|
+
Authors
|
62
|
+
------------
|
63
|
+
Created and maintained by [Salim Afiune](https://github.com/afiune) (salim@afiunemaya.com.mx) and the community.
|
64
|
+
|
data/lib/guard/rake/vagrant.rb
CHANGED
@@ -23,14 +23,14 @@ module Guard
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def destroy
|
26
|
-
::Guard::UI.info("Guard::Rake::Vagrant is stopping")
|
26
|
+
::Guard::UI.info("Guard::Rake::Vagrant box is stopping")
|
27
27
|
cmd = Mixlib::ShellOut.new("vagrant destroy -f")
|
28
28
|
cmd.live_stream = STDOUT
|
29
29
|
cmd.run_command
|
30
30
|
begin
|
31
31
|
cmd.error!
|
32
32
|
rescue Mixlib::ShellOut::ShellCommandFailed => e
|
33
|
-
::Guard::UI.info("Vagrant
|
33
|
+
::Guard::UI.info("Vagrant box failed #{e.to_s}")
|
34
34
|
throw :task_has_failed
|
35
35
|
ensure
|
36
36
|
# Sometimes, we leave the occasional shell process unreaped!
|
@@ -39,20 +39,24 @@ module Guard
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def provision
|
42
|
-
|
43
|
-
UI.info "Guard::Vagrant provision"
|
42
|
+
UI.info "Guard::Rake::Vagrant box is provisioning"
|
44
43
|
cmd = Mixlib::ShellOut.new("vagrant provision", :timeout => 10800)
|
45
44
|
cmd.live_stream = STDOUT
|
46
45
|
cmd.run_command
|
47
46
|
|
48
47
|
begin
|
49
48
|
cmd.error!
|
50
|
-
Notifier.notify('Vagrant provisioned', :title => 'guard-vagrant', :image => :success)
|
49
|
+
Notifier.notify('Vagrant box provisioned', :title => 'guard-vagrant', :image => :success)
|
51
50
|
rescue Mixlib::ShellOut::ShellCommandFailed => e
|
52
|
-
Notifier.notify('Vagrant provision failed', :title => 'guard-vagrant', :image => :failed)
|
53
|
-
::Guard::UI.info("Vagrant provision failed with #{e.to_s}")
|
51
|
+
Notifier.notify('Vagrant box provision failed', :title => 'guard-vagrant', :image => :failed)
|
52
|
+
::Guard::UI.info("Vagrant box provision failed with #{e.to_s}")
|
54
53
|
throw :task_has_failed
|
55
54
|
end
|
55
|
+
|
56
|
+
if cmd.stdout =~ /VM is not currently running/
|
57
|
+
UI.info "Guard::Rake::Vagrant box is not running"
|
58
|
+
self.up
|
59
|
+
end
|
56
60
|
end
|
57
61
|
end
|
58
62
|
end
|
data/lib/guard/rake/version.rb
CHANGED