Skip to content

Instantly share code, notes, and snippets.

@fujimura
Created March 28, 2013 05:00
Show Gist options
  • Save fujimura/5260779 to your computer and use it in GitHub Desktop.
Save fujimura/5260779 to your computer and use it in GitHub Desktop.
listen_spring.rb
require 'listen'
def run(files_to_run)
puts "Running: #{files_to_run}"
system %|bundle exec spring rspec #{files_to_run}|
end
Listen.to 'spec', filter: /.*_spec\.rb/ do |modified, added, removed|
file_to_run = (modified || added).first
run file_to_run
end
Signal.trap 'INT' do
exit
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment