guard-spork 0.2.1 → 0.3.0
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.rdoc +112 -103
- data/lib/guard/spork/runner.rb +16 -4
- data/lib/guard/spork/templates/Guardfile +10 -7
- data/lib/guard/spork/version.rb +1 -1
- metadata +14 -16
data/README.rdoc
CHANGED
@@ -1,103 +1,112 @@
|
|
1
|
-
= Guard::Spork
|
2
|
-
http://travis-ci.org/guard/guard-spork.png
|
3
|
-
|
4
|
-
Guard::Spork allows to automatically & intelligently start/reload your RSpec/Cucumber/Test::Unit {Spork}[https://github.com/timcharper/spork] server(s).
|
5
|
-
|
6
|
-
- Compatible with Spork 0.8.4 & 0.9.0.rcXX.
|
7
|
-
- Tested on Ruby 1.8.7, REE, 1.9.2
|
8
|
-
|
9
|
-
== Install
|
10
|
-
|
11
|
-
Please be sure to have {Guard}[https://github.com/guard/guard] installed before continue.
|
12
|
-
|
13
|
-
Install the gem:
|
14
|
-
|
15
|
-
gem install guard-spork
|
16
|
-
|
17
|
-
Add it to your Gemfile (inside test group):
|
18
|
-
|
19
|
-
gem 'guard-spork'
|
20
|
-
|
21
|
-
Add guard definition to your Guardfile with:
|
22
|
-
|
23
|
-
guard init spork
|
24
|
-
|
25
|
-
== Usage
|
26
|
-
|
27
|
-
Please read {Guard usage doc}[https://github.com/guard/guard#readme].
|
28
|
-
|
29
|
-
== Guardfile
|
30
|
-
|
31
|
-
Please read {Guard doc}[https://github.com/guard/guard#readme] for more info about the Guardfile DSL.
|
32
|
-
|
33
|
-
<b>IMPORTANT: place Spork guard before RSpec/Cucumber/Test::Unit guards!</b>
|
34
|
-
|
35
|
-
=== Rails app
|
36
|
-
|
37
|
-
guard 'spork' do
|
38
|
-
watch('config/application.rb')
|
39
|
-
watch('config/environment.rb')
|
40
|
-
watch(%r{^config/environments/.*\.rb$})
|
41
|
-
watch(%r{^config/initializers/.*\.rb$})
|
42
|
-
watch('
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
:
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
:
|
83
|
-
:
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
1
|
+
= Guard::Spork
|
2
|
+
http://travis-ci.org/guard/guard-spork.png
|
3
|
+
|
4
|
+
Guard::Spork allows to automatically & intelligently start/reload your RSpec/Cucumber/Test::Unit {Spork}[https://github.com/timcharper/spork] server(s).
|
5
|
+
|
6
|
+
- Compatible with Spork 0.8.4 & 0.9.0.rcXX.
|
7
|
+
- Tested on Ruby 1.8.7, REE, 1.9.2 & Rubinius.
|
8
|
+
|
9
|
+
== Install
|
10
|
+
|
11
|
+
Please be sure to have {Guard}[https://github.com/guard/guard] installed before continue.
|
12
|
+
|
13
|
+
Install the gem:
|
14
|
+
|
15
|
+
gem install guard-spork
|
16
|
+
|
17
|
+
Add it to your Gemfile (inside test group):
|
18
|
+
|
19
|
+
gem 'guard-spork'
|
20
|
+
|
21
|
+
Add guard definition to your Guardfile with:
|
22
|
+
|
23
|
+
guard init spork
|
24
|
+
|
25
|
+
== Usage
|
26
|
+
|
27
|
+
Please read {Guard usage doc}[https://github.com/guard/guard#readme].
|
28
|
+
|
29
|
+
== Guardfile
|
30
|
+
|
31
|
+
Please read {Guard doc}[https://github.com/guard/guard#readme] for more info about the Guardfile DSL.
|
32
|
+
|
33
|
+
<b>IMPORTANT: place Spork guard before RSpec/Cucumber/Test::Unit guards!</b>
|
34
|
+
|
35
|
+
=== Rails app
|
36
|
+
|
37
|
+
guard 'spork' do
|
38
|
+
watch('config/application.rb')
|
39
|
+
watch('config/environment.rb')
|
40
|
+
watch(%r{^config/environments/.*\.rb$})
|
41
|
+
watch(%r{^config/initializers/.*\.rb$})
|
42
|
+
watch('Gemfile')
|
43
|
+
watch('Gemfile.lock')
|
44
|
+
watch('spec/spec_helper.rb')
|
45
|
+
watch('test/test_helper.rb')
|
46
|
+
end
|
47
|
+
|
48
|
+
=== Running specs over Spork
|
49
|
+
|
50
|
+
Pass the <tt>:cli => "--drb"</tt> option to {Guard::RSpec}[https://github.com/guard/guard-rspec] and/or {Guard::Cucumber}[https://github.com/guard/guard-cucumber] to run them over the Spork DRb server:
|
51
|
+
|
52
|
+
guard 'rspec', :cli => "--drb" do
|
53
|
+
...
|
54
|
+
end
|
55
|
+
|
56
|
+
guard 'cucumber', :cli => "--drb" do
|
57
|
+
...
|
58
|
+
end
|
59
|
+
|
60
|
+
For MiniTest Guard you should pass the `:drb => true` option:
|
61
|
+
|
62
|
+
guard 'minitest', :drb => true do
|
63
|
+
...
|
64
|
+
end
|
65
|
+
|
66
|
+
== Options
|
67
|
+
|
68
|
+
Guard::Spork automatically detect RSpec/Cucumber/Test::Unit/Bundler presence but you can disable any of them with the corresponding options:
|
69
|
+
|
70
|
+
guard 'spork', :cucumber => false, :bundler => false do
|
71
|
+
...
|
72
|
+
end
|
73
|
+
|
74
|
+
You can provide additional environment variables for RSpec, Cucumber, and Test::Unit with the <tt>:rspec_env</tt>, <tt>:cucumber_env</tt>, and <tt>:test_unit_env</tt> options:
|
75
|
+
|
76
|
+
guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'cucumber' }, :rspec_env => { 'RAILS_ENV' => 'test' }, :test_unit_env => { 'RAILS_ENV' => 'test' } do
|
77
|
+
...
|
78
|
+
end
|
79
|
+
|
80
|
+
Available options:
|
81
|
+
|
82
|
+
:wait => 30 # Seconds to wait for the server to starts, default: 20
|
83
|
+
:cucumber => false
|
84
|
+
:rspec => false
|
85
|
+
:test_unit => false
|
86
|
+
:bundler => false # Don't use "bundle exec"
|
87
|
+
:test_unit_port => 1233 # Default: 8988
|
88
|
+
:rspec_port => 1234 # Default: 8989
|
89
|
+
:cucumber_port => 4321 # Default: 8990
|
90
|
+
:test_unit_env => { 'RAILS_ENV' => 'baz' } # Default: nil
|
91
|
+
:rspec_env => { 'RAILS_ENV' => 'foo' } # Default: nil
|
92
|
+
:cucumber_env => { 'RAILS_ENV' => 'bar' } # Default: nil
|
93
|
+
|
94
|
+
== Common troubleshooting
|
95
|
+
|
96
|
+
If you can start Spork manually but get the following error message when using Guard::Spork:
|
97
|
+
|
98
|
+
Starting Spork for RSpec ERROR: Could not start Spork for RSpec/Cucumber. Make sure you can use it manually first.
|
99
|
+
|
100
|
+
Try to increase the value of the <tt>:wait</tt> option before any further investigation.
|
101
|
+
|
102
|
+
== Development
|
103
|
+
|
104
|
+
- Source hosted at {GitHub}[https://github.com/guard/guard-spork]
|
105
|
+
- Report issues/Questions/Feature requests on {GitHub Issues}[https://github.com/guard/guard-spork/issues]
|
106
|
+
|
107
|
+
Pull requests are very welcome! Make sure your patches are well tested. Please create a topic branch for every separate change
|
108
|
+
you make.
|
109
|
+
|
110
|
+
== Authors
|
111
|
+
|
112
|
+
{Thibaud Guillaume-Gentil}[https://github.com/thibaudgg]
|
data/lib/guard/spork/runner.rb
CHANGED
@@ -14,7 +14,7 @@ module Guard
|
|
14
14
|
options[:rspec_env] ||= {}
|
15
15
|
options[:cucumber_env] ||= {}
|
16
16
|
@options = options
|
17
|
-
|
17
|
+
ENV['SPORK_PIDS'] ||= ''
|
18
18
|
|
19
19
|
Signal.trap('CHLD', self.method(:reap_children))
|
20
20
|
end
|
@@ -48,7 +48,7 @@ module Guard
|
|
48
48
|
end
|
49
49
|
|
50
50
|
UI.debug "Spawned Spork server #{pid} ('#{cmd}')"
|
51
|
-
|
51
|
+
add_children(pid)
|
52
52
|
pid
|
53
53
|
end
|
54
54
|
|
@@ -75,7 +75,7 @@ module Guard
|
|
75
75
|
def reap_children(sig)
|
76
76
|
terminated_children.each do |stat|
|
77
77
|
pid = stat.pid
|
78
|
-
if
|
78
|
+
if remove_children(pid)
|
79
79
|
UI.debug "Reaping spork #{pid}"
|
80
80
|
end
|
81
81
|
end
|
@@ -131,8 +131,20 @@ module Guard
|
|
131
131
|
Notifier.notify "#{sporked_gems} NOT #{action}ed", :title => "Spork", :image => :failed
|
132
132
|
end
|
133
133
|
|
134
|
+
def add_children(pid)
|
135
|
+
pids = spork_pids << pid
|
136
|
+
ENV['SPORK_PIDS'] = pids.join(',')
|
137
|
+
end
|
138
|
+
|
139
|
+
def remove_children(pid)
|
140
|
+
pids = spork_pids
|
141
|
+
deleted_pid = pids.delete(pid)
|
142
|
+
ENV['SPORK_PIDS'] = pids.join(',')
|
143
|
+
deleted_pid
|
144
|
+
end
|
145
|
+
|
134
146
|
def spork_pids
|
135
|
-
|
147
|
+
ENV['SPORK_PIDS'].split(',').map { |pid| pid.to_i }
|
136
148
|
end
|
137
149
|
|
138
150
|
def sporked_gems
|
@@ -1,7 +1,10 @@
|
|
1
|
-
guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'test' }, :rspec_env => { 'RAILS_ENV' => 'test' } do
|
2
|
-
watch('config/application.rb')
|
3
|
-
watch('config/environment.rb')
|
4
|
-
watch(%r{^config/environments/.+\.rb$})
|
5
|
-
watch(%r{^config/initializers/.+\.rb$})
|
6
|
-
watch('
|
7
|
-
|
1
|
+
guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'test' }, :rspec_env => { 'RAILS_ENV' => 'test' } do
|
2
|
+
watch('config/application.rb')
|
3
|
+
watch('config/environment.rb')
|
4
|
+
watch(%r{^config/environments/.+\.rb$})
|
5
|
+
watch(%r{^config/initializers/.+\.rb$})
|
6
|
+
watch('Gemfile')
|
7
|
+
watch('Gemfile.lock')
|
8
|
+
watch('spec/spec_helper.rb')
|
9
|
+
watch('test/test_helper.rb')
|
10
|
+
end
|
data/lib/guard/spork/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-spork
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,23 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
13
|
-
default_executable:
|
12
|
+
date: 2011-09-30 00:00:00.000000000Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: guard
|
17
|
-
requirement: &
|
16
|
+
requirement: &70177655971420 !ruby/object:Gem::Requirement
|
18
17
|
none: false
|
19
18
|
requirements:
|
20
19
|
- - ! '>='
|
21
20
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.
|
21
|
+
version: 0.8.2
|
23
22
|
type: :runtime
|
24
23
|
prerelease: false
|
25
|
-
version_requirements: *
|
24
|
+
version_requirements: *70177655971420
|
26
25
|
- !ruby/object:Gem::Dependency
|
27
26
|
name: spork
|
28
|
-
requirement: &
|
27
|
+
requirement: &70177655959080 !ruby/object:Gem::Requirement
|
29
28
|
none: false
|
30
29
|
requirements:
|
31
30
|
- - ! '>='
|
@@ -33,10 +32,10 @@ dependencies:
|
|
33
32
|
version: 0.8.4
|
34
33
|
type: :runtime
|
35
34
|
prerelease: false
|
36
|
-
version_requirements: *
|
35
|
+
version_requirements: *70177655959080
|
37
36
|
- !ruby/object:Gem::Dependency
|
38
37
|
name: bundler
|
39
|
-
requirement: &
|
38
|
+
requirement: &70177655957840 !ruby/object:Gem::Requirement
|
40
39
|
none: false
|
41
40
|
requirements:
|
42
41
|
- - ~>
|
@@ -44,10 +43,10 @@ dependencies:
|
|
44
43
|
version: '1.0'
|
45
44
|
type: :development
|
46
45
|
prerelease: false
|
47
|
-
version_requirements: *
|
46
|
+
version_requirements: *70177655957840
|
48
47
|
- !ruby/object:Gem::Dependency
|
49
48
|
name: rspec
|
50
|
-
requirement: &
|
49
|
+
requirement: &70177655956940 !ruby/object:Gem::Requirement
|
51
50
|
none: false
|
52
51
|
requirements:
|
53
52
|
- - ~>
|
@@ -55,10 +54,10 @@ dependencies:
|
|
55
54
|
version: '2.6'
|
56
55
|
type: :development
|
57
56
|
prerelease: false
|
58
|
-
version_requirements: *
|
57
|
+
version_requirements: *70177655956940
|
59
58
|
- !ruby/object:Gem::Dependency
|
60
59
|
name: guard-rspec
|
61
|
-
requirement: &
|
60
|
+
requirement: &70177655955740 !ruby/object:Gem::Requirement
|
62
61
|
none: false
|
63
62
|
requirements:
|
64
63
|
- - ~>
|
@@ -66,7 +65,7 @@ dependencies:
|
|
66
65
|
version: '0.4'
|
67
66
|
type: :development
|
68
67
|
prerelease: false
|
69
|
-
version_requirements: *
|
68
|
+
version_requirements: *70177655955740
|
70
69
|
description: Guard::Spork automatically manage Spork DRb servers.
|
71
70
|
email:
|
72
71
|
- thibaud@thibaud.me
|
@@ -80,7 +79,6 @@ files:
|
|
80
79
|
- lib/guard/spork.rb
|
81
80
|
- LICENSE
|
82
81
|
- README.rdoc
|
83
|
-
has_rdoc: true
|
84
82
|
homepage: http://rubygems.org/gems/guard-spork
|
85
83
|
licenses: []
|
86
84
|
post_install_message:
|
@@ -101,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
99
|
version: 1.3.6
|
102
100
|
requirements: []
|
103
101
|
rubyforge_project: guard-spork
|
104
|
-
rubygems_version: 1.
|
102
|
+
rubygems_version: 1.8.9
|
105
103
|
signing_key:
|
106
104
|
specification_version: 3
|
107
105
|
summary: Guard gem for Spork
|