Skip to content

Instantly share code, notes, and snippets.

@Oshuma
Created August 22, 2010 08:25
Show Gist options
  • Save Oshuma/543528 to your computer and use it in GitHub Desktop.
Save Oshuma/543528 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
def run_specs
system('rake spec')
end
# Ctrl-\
Signal.trap('QUIT') do
puts "\n--- Running all specs ---\n"
run_specs
end
# Ctrl-C
Signal.trap('INT') { abort("\n") }
if __FILE__ == $0
system("watchr #{$0}")
else
run_specs
[
'lib/(.*/)?.*\.rb',
'spec/(.*/)?.*_spec\.rb'
].each do |pattern|
watch(pattern) { |md| run_specs }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment