Created
August 24, 2013 17:09
-
-
Save squarism/6329245 to your computer and use it in GitHub Desktop.
Wtchr for Rspec
This file contains hidden or 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
#!/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