Created
November 16, 2014 09:59
-
-
Save kimlindholm/e034151035de1955321f to your computer and use it in GitHub Desktop.
watchr script for Teaspoon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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