guard-spork 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,8 +2,8 @@
2
2
 
3
3
  Guard::Spork allows to automatically & intelligently start/reload your RSpec/Cucumber {Spork}[https://github.com/timcharper/spork] server(s).
4
4
 
5
- - Compatible with Spork 0.8.4 & 0.9.0.rc3.
6
- - Tested on Ruby 1.8.6, 1.8.7 & 1.9.2.
5
+ - Compatible with Spork 0.8.4 & 0.9.0.rcXX.
6
+ - Tested on Ruby 1.8.6, 1.8.7, REE, 1.9.2, JRuby & Rubinius.
7
7
 
8
8
  == Install
9
9
 
@@ -61,30 +61,28 @@ Guard::Spork automatically detect RSpec/Cucumber/Bundler presence but you can di
61
61
  ...
62
62
  end
63
63
 
64
- To append additional environment variables for rspec and cucumber you can provided a hash to rspec_env/cucumber_env:
64
+ You can provide additional environment variables for RSpec and Cucumber with the <tt>:rspec_env</tt> and <tt>:cucumber_env</tt> options:
65
65
 
66
- guard 'spork', :cucumber_env => {'RAILS_ENV' => 'cucumber'}, :rspec_env => {'RAILS_ENV' => 'test'} do
66
+ guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'cucumber' }, :rspec_env => { 'RAILS_ENV' => 'test' } do
67
67
  ...
68
68
  end
69
-
70
- <b>IMPORTANT: when using ruby 1.8.x please set the env for both rspec and cucumber as they will overwrite each other and the system env's</b>
71
-
69
+
72
70
  Available options:
73
71
 
74
- :wait => 30 # Seconds to wait for the server to starts, default: 20
75
- :cucumber => false
76
- :rspec => false
77
- :bundler => false # Don't use "bundle exec"
78
- :rspec_port => 1234 # Default: 8989
79
- :cucumber_port => 4321 # Default: 8990
80
- :rspec_env
81
- :cucumber_env
72
+ :wait => 30 # Seconds to wait for the server to starts, default: 20
73
+ :cucumber => false
74
+ :rspec => false
75
+ :bundler => false # Don't use "bundle exec"
76
+ :rspec_port => 1234 # Default: 8989
77
+ :cucumber_port => 4321 # Default: 8990
78
+ :rspec_env => { 'RAILS_ENV' => 'foo' } # Default: nil
79
+ :cucumber_env => { 'RAILS_ENV' => 'bar' } # Default: nil
82
80
 
83
81
  == Common troubleshooting
84
82
 
85
83
  If you can start Spork manually but get the following error message when using Guard::Spork:
86
84
 
87
- Starting Spork for RSpec ERROR: Could not start Spork for RSpec/Cucumber. Make sure you can use it manually first.
85
+ Starting Spork for RSpec ERROR: Could not start Spork for RSpec/Cucumber. Make sure you can use it manually first.
88
86
 
89
87
  Try to increase the value of the <tt>:wait</tt> option before any further investigation.
90
88
 
@@ -37,15 +37,10 @@ module Guard
37
37
 
38
38
  unless pid
39
39
  ignore_control_signals
40
- if env
41
- if RUBY_VERSION > "1.9"
42
- exec(env, cmd)
43
- else
44
- env.each { |key, value| ENV[key] = value }
45
- exec(cmd)
46
- end
40
+ if RUBY_VERSION > "1.9"
41
+ exec(env, cmd)
47
42
  else
48
- exec(cmd)
43
+ swap_env(env || []) { exec(cmd) }
49
44
  end
50
45
  end
51
46
 
@@ -60,6 +55,20 @@ module Guard
60
55
  Signal.trap('TSTP', 'IGNORE')
61
56
  end
62
57
 
58
+ def swap_env(env)
59
+ old_env = {}
60
+ env.each do |key, value|
61
+ old_env[key] = ENV[key]
62
+ ENV[key] = value
63
+ end
64
+
65
+ yield
66
+
67
+ env.each do |key, value|
68
+ ENV[key] = old_env[key]
69
+ end
70
+ end
71
+
63
72
  def reap_children(sig)
64
73
  terminated_children.each do |stat|
65
74
  pid = stat.pid
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module SporkVersion
3
- VERSION = "0.1.8"
3
+ VERSION = "0.1.9"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-spork
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 1
9
- - 8
10
- version: 0.1.8
4
+ prerelease:
5
+ version: 0.1.9
11
6
  platform: ruby
12
7
  authors:
13
8
  - Thibaud Guillaume-Gentil
@@ -26,11 +21,6 @@ dependencies:
26
21
  requirements:
27
22
  - - ">="
28
23
  - !ruby/object:Gem::Version
29
- hash: 19
30
- segments:
31
- - 0
32
- - 2
33
- - 2
34
24
  version: 0.2.2
35
25
  type: :runtime
36
26
  version_requirements: *id001
@@ -42,11 +32,6 @@ dependencies:
42
32
  requirements:
43
33
  - - ">="
44
34
  - !ruby/object:Gem::Version
45
- hash: 55
46
- segments:
47
- - 0
48
- - 8
49
- - 4
50
35
  version: 0.8.4
51
36
  type: :runtime
52
37
  version_requirements: *id002
@@ -58,10 +43,6 @@ dependencies:
58
43
  requirements:
59
44
  - - ~>
60
45
  - !ruby/object:Gem::Version
61
- hash: 15
62
- segments:
63
- - 1
64
- - 0
65
46
  version: "1.0"
66
47
  type: :development
67
48
  version_requirements: *id003
@@ -73,10 +54,6 @@ dependencies:
73
54
  requirements:
74
55
  - - ~>
75
56
  - !ruby/object:Gem::Version
76
- hash: 9
77
- segments:
78
- - 2
79
- - 5
80
57
  version: "2.5"
81
58
  type: :development
82
59
  version_requirements: *id004
@@ -88,10 +65,6 @@ dependencies:
88
65
  requirements:
89
66
  - - ~>
90
67
  - !ruby/object:Gem::Version
91
- hash: 15
92
- segments:
93
- - 0
94
- - 2
95
68
  version: "0.2"
96
69
  type: :development
97
70
  version_requirements: *id005
@@ -125,27 +98,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
125
98
  requirements:
126
99
  - - ">="
127
100
  - !ruby/object:Gem::Version
128
- hash: 57
129
- segments:
130
- - 1
131
- - 8
132
- - 7
133
101
  version: 1.8.7
134
102
  required_rubygems_version: !ruby/object:Gem::Requirement
135
103
  none: false
136
104
  requirements:
137
105
  - - ">="
138
106
  - !ruby/object:Gem::Version
139
- hash: 23
140
- segments:
141
- - 1
142
- - 3
143
- - 6
144
107
  version: 1.3.6
145
108
  requirements: []
146
109
 
147
110
  rubyforge_project: guard-spork
148
- rubygems_version: 1.3.7
111
+ rubygems_version: 1.6.2
149
112
  signing_key:
150
113
  specification_version: 3
151
114
  summary: Guard gem for Spork