lib/rspactor/runner.rb in guillaumegentil-rspactor-0.4.3 vs lib/rspactor/runner.rb in guillaumegentil-rspactor-0.5.1
- old
+ new
@@ -16,23 +16,28 @@
end
def start
load_dotfile
puts "** RSpactor is now watching at '#{dir}'"
+ Spork.start if options[:spork]
+ Celerity.start(dir) if options[:celerity]
start_interactor
start_listener
end
def start_interactor
@interactor = Interactor.new(self)
- aborted = @interactor.wait_for_enter_key("** Hit <enter> to skip initial spec run", 2)
+ aborted = @interactor.wait_for_enter_key("** Hit <enter> to skip initial spec & cucumber run", 2, false)
@interactor.start_termination_handler
- run_all_specs unless aborted
+ unless aborted
+ run_all_specs
+ run_cucumber_command('~pending', false)
+ end
end
def start_listener
- @inspector = Inspector.new(dir)
+ @inspector = Inspector.new(self)
Listener.new(Inspector::EXTENSIONS) do |files|
changed_files(files) unless git_head_changed?
end.run(dir)
end
@@ -60,17 +65,17 @@
cmd = [ruby_opts, spec_runner, paths, spec_opts].flatten.join(' ')
@last_run_failed = run_command(cmd)
end
end
- def run_cucumber_command(tags = 'current')
- system("clear;") if @options[:clear]
- puts "#{tags} tagged features"
+ def run_cucumber_command(tags = 'current', clear = @options[:clear])
+ system("clear;") if clear
+ puts "** Running all #{tags} tagged features..."
cmd = [ruby_opts, cucumber_runner, cucumber_opts(tags)].flatten.join(' ')
@last_run_failed = run_command(cmd)
- # Workaround for killing jruby process when used with celerity, cucumber and spork
- system("kill $(ps aux | grep jruby | grep -v grep | awk '//{print $2;}')") if options[:kill]
+ # Workaround for killing jruby process when used with celerity and spork
+ Celerity.kill_jruby if options[:celerity] && options[:spork]
end
def last_run_failed?
@last_run_failed == false
end
@@ -94,10 +99,11 @@
end
# specs files
unless files.empty?
system("clear;") if @options[:clear]
+ files.uniq!
puts files.map { |f| f.to_s.gsub(/#{dir}/, '') }.join("\n")
previous_run_failed = last_run_failed?
run_spec_command(files)
@@ -126,10 +132,10 @@
def cucumber_opts(tags)
if File.exist?('features/support/cucumber.opts')
opts = File.read('features/support/cucumber.opts').gsub("\n", ' ')
else
- opts = "--format progress --drb "
+ opts = "--color --format progress --drb "
end
opts << " --tags #{tags}"
opts << cucumber_formatter_opts
opts << " --require features" # because using require option overwrite default require
\ No newline at end of file