Skip to content

Instantly share code, notes, and snippets.

@kimlindholm
Created November 16, 2014 09:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kimlindholm/e034151035de1955321f to your computer and use it in GitHub Desktop.
Save kimlindholm/e034151035de1955321f to your computer and use it in GitHub Desktop.
watchr script for Teaspoon
# Usage:
# gem install watchr ruby-fsevent
# watchr spec/js_spec.watchr
# --------------------------------------------------
# Rules
# --------------------------------------------------
watch('spec/javascripts/.*_spec\.(coffee|js)') { |md| teaspoon md[0] }
# --------------------------------------------------
# Signal Handling
# --------------------------------------------------
Signal.trap('QUIT') { teaspoon } # Ctrl-\
Signal.trap('INT' ) { abort("\n") } # Ctrl-C
# --------------------------------------------------
# Helpers
# --------------------------------------------------
def teaspoon(filename = nil)
if filename.nil?
print "Running all specs... "; STDOUT.flush
system("spring rake teaspoon") # or "rake teaspoon"
else
print "Running #{filename}... "; STDOUT.flush
system("spring rake teaspoon files=#{filename}")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment