Skip to content

Instantly share code, notes, and snippets.

@Oshuma
Created July 13, 2010 07:00
Show Gist options
  • Save Oshuma/473543 to your computer and use it in GitHub Desktop.
Save Oshuma/473543 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
def run_specs
with_rubygems = RUBY_VERSION =~ /1.8/ ? "-r rubygems" : ""
system("rake #{with_rubygems} 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