Skip to content

Instantly share code, notes, and snippets.

@squarism

squarism/wtchr

Created Feb 10, 2011
Embed
What would you like to do?
A watchr one-liner shell script, perfect for single .rb projects
#!/usr/bin/env bash
# wtchr shell script - @squarism
# INSTALL
# gem install watchr
# cp wtchr ~/bin
# chmod u+x ~/bin/wtchr
# Run with: wtchr foo.rb
##################
# Main, as it were
# the file passed in as argument 1
FILE=$1
# horrifying formatting for bash and gist
watchr -e "system('clear'); \
puts 'Watchr is watching ${FILE}. O_o (wtchr)'; \
puts '-' * 52; \
watch('${FILE}') \
{ system('clear'); \
p=\`pwd\`.strip; \
cmd = 'ruby ' << p << '/${FILE}'; \
o = \`#{cmd}\`; \
puts o }"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment