Skip to content

Commit

Permalink
Back to system to spork command
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaudgg committed Nov 18, 2010
1 parent 6cf04db commit b47d936
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
5 changes: 3 additions & 2 deletions guard-spork.gemspec
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ Gem::Specification.new do |s|
s.add_dependency 'guard', '>= 0.2.0' s.add_dependency 'guard', '>= 0.2.0'
s.add_dependency 'spork', '>= 0.8.4' s.add_dependency 'spork', '>= 0.8.4'


s.add_development_dependency 'bundler', '~> 1.0.3' s.add_development_dependency 'bundler', '~> 1.0.7'
s.add_development_dependency 'rspec', '~> 2.1' s.add_development_dependency 'rspec', '~> 2.1'
s.add_development_dependency 'guard-rspec', '~> 0.1.8'


s.files = Dir.glob('{lib}/**/*') + %w[LICENSE README.rdoc] s.files = Dir.glob('{lib}/**/*') + %w[LICENSE README.rdoc]
s.require_path = 'lib' s.require_path = 'lib'
Expand Down
1 change: 1 addition & 0 deletions lib/guard/spork.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class Spork < Guard
def initialize(watchers = [], options = {}) def initialize(watchers = [], options = {})
super super
@runner = Runner.new(options) @runner = Runner.new(options)

end end


def start def start
Expand Down
6 changes: 3 additions & 3 deletions lib/guard/spork/runner.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ def initialize(options = {})


def launch_sporks(action) def launch_sporks(action)
UI.info "#{action.capitalize}ing Spork for #{sporked_gems} ", :reset => true UI.info "#{action.capitalize}ing Spork for #{sporked_gems} ", :reset => true
IO.popen(spork_command("rspec")) if rspec? system(spork_command("rspec")) if rspec?
IO.popen(spork_command("cucumber")) if cucumber? system(spork_command("cucumber")) if cucumber?
verify_launches(action) verify_launches(action)
end end


Expand All @@ -38,7 +38,7 @@ def spork_command(type)
cmd_parts << "-p #{options[:cucumber_port]}" cmd_parts << "-p #{options[:cucumber_port]}"
end end


cmd_parts << "2>&1" cmd_parts << ">/dev/null 2>&1 < /dev/null &"
cmd_parts.join(" ") cmd_parts.join(" ")
end end


Expand Down
12 changes: 6 additions & 6 deletions spec/guard/spork/runner_spec.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
end end


it "should launch rspec spork server" do it "should launch rspec spork server" do
IO.should_receive(:popen).with("spork -p 8989 2>&1") subject.should_receive(:system).with("spork -p 8989 >/dev/null 2>&1 < /dev/null &")
subject.launch_sporks("start") subject.launch_sporks("start")
end end
end end
Expand All @@ -34,7 +34,7 @@
end end


it "should launch cucumber spork server" do it "should launch cucumber spork server" do
IO.should_receive(:popen).with("spork cu -p 8990 2>&1") subject.should_receive(:system).with("spork cu -p 8990 >/dev/null 2>&1 < /dev/null &")
subject.launch_sporks("start") subject.launch_sporks("start")
end end
end end
Expand All @@ -49,8 +49,8 @@
end end


it "should launch rspec & cucumber spork server" do it "should launch rspec & cucumber spork server" do
IO.should_receive(:popen).with("spork -p 8989 2>&1") subject.should_receive(:system).with("spork -p 8989 >/dev/null 2>&1 < /dev/null &")
IO.should_receive(:popen).with("spork cu -p 8990 2>&1") subject.should_receive(:system).with("spork cu -p 8990 >/dev/null 2>&1 < /dev/null &")
subject.launch_sporks("start") subject.launch_sporks("start")
end end
end end
Expand All @@ -65,8 +65,8 @@
end end


it "should launch rspec & cucumber spork server" do it "should launch rspec & cucumber spork server" do
IO.should_receive(:popen).with("bundle exec spork -p 8989 2>&1") subject.should_receive(:system).with("bundle exec spork -p 8989 >/dev/null 2>&1 < /dev/null &")
IO.should_receive(:popen).with("bundle exec spork cu -p 8990 2>&1") subject.should_receive(:system).with("bundle exec spork cu -p 8990 >/dev/null 2>&1 < /dev/null &")
subject.launch_sporks("start") subject.launch_sporks("start")
end end
end end
Expand Down

0 comments on commit b47d936

Please sign in to comment.