Skip to content

Instantly share code, notes, and snippets.

@squarism
Created August 24, 2013 17:09
Show Gist options
  • Save squarism/6329245 to your computer and use it in GitHub Desktop.
Save squarism/6329245 to your computer and use it in GitHub Desktop.
Wtchr for Rspec
#!/usr/bin/env bash
# wtchrspec shell script - @squarism
# INSTALL
# gem install watchr
# cp wtchrspec ~/bin
# chmod u+x ~/bin/wtchrspec
# Run with: wtchrspec foo.rb
# The test and class need to be in the same file.
# See the walrus destroyallsoftware screencast for an example:
# describe Foo; end
# class Foo; end
# This makes for quick hacking better than writing a huge "main"
# 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 = 'rspec ' << p << '/${FILE}'; \
o = \`#{cmd}\`; \
puts o }"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment