Skip to content

Instantly share code, notes, and snippets.

@jschoolcraft
Created October 19, 2011 14:02
Show Gist options
  • Save jschoolcraft/1298363 to your computer and use it in GitHub Desktop.
Save jschoolcraft/1298363 to your computer and use it in GitHub Desktop.
plugin development sucks less: restart passenger when a file under vendor/plugins changes
# Run me with:
#
# $ watchr plugins.watchr.rb
# --------------------------------------------------
# Convenience Methods
# --------------------------------------------------
def run(cmd)
puts(cmd)
system(cmd)
end
# --------------------------------------------------
# Watchr Rules
# --------------------------------------------------
watch( '^vendor/plugins/.*\.rb' ) { run( "touch tmp/restart.txt" ) }
watch( '^vendor/plugins/.*\.yml' ) { run( "touch tmp/restart.txt" ) }
# Ctrl-C
Signal.trap('INT') { abort("\n") }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment