Skip to content

Instantly share code, notes, and snippets.

@dydx
Last active January 5, 2016 04:45
Show Gist options
  • Save dydx/7789a8135441b54f6aab to your computer and use it in GitHub Desktop.
Save dydx/7789a8135441b54f6aab to your computer and use it in GitHub Desktop.
#!/bin/bash
# $> runner.sh <lib> <spec>
# Demo: http://recordit.co/7eR5hp1BP1
watch_dir=$1
watch_dir2=$2
dir_hashes () {
find $1 $2 -type f -exec md5 '{}' ';' | awk '{print $4}'
}
run_rspec () {
clear
bundle exec rspec spec
current_hashes=( $(dir_hashes $watch_dir $watch_dir2) )
}
current_hashes=( $(dir_hashes $watch_dir $watch_dir2) )
while :
do
live_hashes=( $(dir_hashes $watch_dir $watch_dir2) )
[ "${current_hashes[*]}" == "${live_hashes[*]}" ] || run_rspec
sleep 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment