Skip to content

Instantly share code, notes, and snippets.

@poppen
Created September 8, 2011 01:25
Show Gist options
  • Select an option

  • Save poppen/1202371 to your computer and use it in GitHub Desktop.

Select an option

Save poppen/1202371 to your computer and use it in GitHub Desktop.
# encoding: utf-8
# spork を起動します
$spork_pid = spawn('spork') unless $spork_pid
# 15 秒待ちます.単に待っていると時間が長く感じるので,カウントダウンしています.
15.times do |i|
puts 15-i
sleep 1
end
# autotest を起動します: -c (Red->Green の時に全テストを行わない),-f (起動時に全テストを行わない)
$autotest_pid = spawn('autotest', '-c', '-f', '-s', 'rspec2') unless $autotest_pid
# config 以下,spec/spec_helper.rb,spec/spork.watchr を監視します.
watch('config/.*\.rb|spec/spec_helper.rb|spec/spork.watchr') do |m|
# autotest のプロセスを殺します.
puts "killing autotest... (pid:#{$autotest_pid})"
Process.kill(9, $autotest_pid)
# spork を殺して再起動します.
puts "killing spork... (pid:#{$spork_pid})"
Process.kill(2, $spork_pid)
$spork_pid = spawn('spork')
# 15 秒待ちます.単に待っていると時間が長く感じるので,カウントダウンしています.
15.times do |i|
puts 15-i
sleep 1
end
# autotest を起動します
$autotest_pid = spawn('autotest', '-c', '-f', '-s', 'rspec2')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment