guard-spork 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +1 -1
- data/README.md +7 -4
- data/lib/guard/spork.rb +0 -5
- data/lib/guard/spork/runner.rb +7 -18
- data/lib/guard/spork/spork_instance.rb +6 -12
- data/lib/guard/spork/version.rb +1 -1
- metadata +14 -14
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
Guard::Spork allows to automatically & intelligently start/reload your RSpec/Cucumber/Test::Unit [Spork](https://github.com/timcharper/spork) server(s).
|
4
4
|
|
5
5
|
* Compatible with Spork 0.8.4 & 0.9.0.rcX.
|
6
|
-
* Tested against Ruby 1.8.7, 1.9.2, REE and the latest versions
|
6
|
+
* Tested against Ruby 1.8.7, 1.9.2, REE and the latest versions Rubinius.
|
7
7
|
|
8
8
|
## Install
|
9
9
|
|
@@ -13,9 +13,13 @@ Install the gem:
|
|
13
13
|
|
14
14
|
$ gem install guard-spork
|
15
15
|
|
16
|
-
Add it to your Gemfile (inside
|
16
|
+
Add it to your Gemfile (inside development group):
|
17
17
|
|
18
|
-
|
18
|
+
```ruby
|
19
|
+
group :development do
|
20
|
+
gem 'guard-spork'
|
21
|
+
end
|
22
|
+
```
|
19
23
|
|
20
24
|
Add guard definition to your Guardfile with:
|
21
25
|
|
@@ -79,7 +83,6 @@ guard 'spork', :cucumber => false, :bundler => false do
|
|
79
83
|
end
|
80
84
|
```
|
81
85
|
|
82
|
-
|
83
86
|
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:
|
84
87
|
|
85
88
|
``` ruby
|
data/lib/guard/spork.rb
CHANGED
@@ -11,11 +11,6 @@ module Guard
|
|
11
11
|
def initialize(watchers=[], options={})
|
12
12
|
super
|
13
13
|
@runner = Runner.new(options)
|
14
|
-
|
15
|
-
# This class will be reinitialized by Guard when the Guardfile
|
16
|
-
# is reevaluated, so we must always begin by trying to clean
|
17
|
-
# up after any hypothetical predecessor
|
18
|
-
runner.reevaluate
|
19
14
|
end
|
20
15
|
|
21
16
|
def start
|
data/lib/guard/spork/runner.rb
CHANGED
@@ -34,23 +34,12 @@ module Guard
|
|
34
34
|
|
35
35
|
def kill_global_sporks
|
36
36
|
if options[:aggressive_kill]
|
37
|
-
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def kill_global_sporks!
|
42
|
-
kill_pids ps_spork_pids
|
43
|
-
end
|
44
|
-
|
45
|
-
def reevaluate
|
46
|
-
if ENV['SPORK_PIDS']
|
47
|
-
kill_pids(ENV['SPORK_PIDS'].split(',').map(&:to_i))
|
48
|
-
ENV.delete('SPORK_PIDS')
|
49
|
-
launch_sporks("reload")
|
37
|
+
kill_pids ps_spork_pids
|
50
38
|
end
|
51
39
|
end
|
52
40
|
|
53
41
|
private
|
42
|
+
|
54
43
|
def initialize_spork_instances
|
55
44
|
@spork_instances = []
|
56
45
|
[:rspec, :cucumber, :test_unit].each do |type|
|
@@ -61,7 +50,11 @@ module Guard
|
|
61
50
|
|
62
51
|
def kill_pids(pids)
|
63
52
|
UI.debug "Killing Spork servers with PID: #{pids.join(', ')}"
|
64
|
-
pids.each { |pid| Process.kill("KILL", pid) }
|
53
|
+
pids.each { |pid| ::Process.kill("KILL", pid) }
|
54
|
+
end
|
55
|
+
|
56
|
+
def ps_spork_pids
|
57
|
+
`ps aux | awk '/spork/&&!/awk/{print $2;}'`.split("\n").map { |pid| pid.to_i }
|
65
58
|
end
|
66
59
|
|
67
60
|
def find_instances(type = nil)
|
@@ -106,10 +99,6 @@ module Guard
|
|
106
99
|
false
|
107
100
|
end
|
108
101
|
|
109
|
-
def ps_spork_pids
|
110
|
-
`ps aux | awk '/spork/&&!/awk/{print $2;}'`.split("\n").map { |pid| pid.to_i }
|
111
|
-
end
|
112
|
-
|
113
102
|
def should_use?(what)
|
114
103
|
if options[what].nil?
|
115
104
|
send("detect_#{what}")
|
@@ -27,11 +27,10 @@ module Guard
|
|
27
27
|
@pid = fork do
|
28
28
|
env_exec env, command
|
29
29
|
end
|
30
|
-
store_pid
|
31
30
|
end
|
32
31
|
|
33
32
|
def stop
|
34
|
-
Process.kill('KILL', pid)
|
33
|
+
::Process.kill('KILL', pid)
|
35
34
|
end
|
36
35
|
|
37
36
|
def alive?
|
@@ -71,17 +70,12 @@ module Guard
|
|
71
70
|
end
|
72
71
|
end
|
73
72
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
73
|
+
private
|
74
|
+
|
75
|
+
def use_bundler?
|
76
|
+
options[:bundler]
|
77
|
+
end
|
78
78
|
|
79
|
-
def store_pid
|
80
|
-
# We need to store away the PIDs somewhere safe since
|
81
|
-
# Guard will destroy our class instances when Guardfile is
|
82
|
-
# reevaluated without telling us beforehand
|
83
|
-
ENV['SPORK_PIDS'] = [ENV['SPORK_PIDS'], pid.to_s].compact.join(",")
|
84
|
-
end
|
85
79
|
end
|
86
80
|
end
|
87
81
|
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.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,22 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-01-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: guard
|
16
|
-
requirement: &
|
16
|
+
requirement: &70289442836600 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.
|
21
|
+
version: 0.10.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70289442836600
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: spork
|
27
|
-
requirement: &
|
27
|
+
requirement: &70289442835940 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 0.8.4
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70289442835940
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: bundler
|
38
|
-
requirement: &
|
38
|
+
requirement: &70289442835200 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '1.0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70289442835200
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec
|
49
|
-
requirement: &
|
49
|
+
requirement: &70289442834340 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '2.6'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70289442834340
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: guard-rspec
|
60
|
-
requirement: &
|
60
|
+
requirement: &70289442833400 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: '0.4'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70289442833400
|
69
69
|
description: Guard::Spork automatically manage Spork DRb servers.
|
70
70
|
email:
|
71
71
|
- thibaud@thibaud.me
|
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
100
|
version: 1.3.6
|
101
101
|
requirements: []
|
102
102
|
rubyforge_project: guard-spork
|
103
|
-
rubygems_version: 1.8.
|
103
|
+
rubygems_version: 1.8.12
|
104
104
|
signing_key:
|
105
105
|
specification_version: 3
|
106
106
|
summary: Guard gem for Spork
|