Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Ruby dev scripts
#!/usr/bin/env bash
set -e
if [ $1 ];
then
BRANCH=${1:-"develop"}
shift # Get rid of first parameters, which should not pass on to smart_rspec
else
BRANCH='develop'
fi
(git diff --name-only origin/$BRANCH..HEAD; git ls-files -m --other --exclude-standard) | \
sed -E 's/.*\/(.*)\.rb/\1/' | \
while read name; do \
find spec -name "*$name*_spec.rb"; \
done | \
sort | uniq | \
xargs smart_rspec $@
#!/usr/bin/env bash
NAILGUN_PORT=2113
SPORK_PORT=8989
# Looking for zeus socket
if [ -S ./.zeus.sock ]; then
RSPEC="zeus rspec"
else
# Looking for binstubs
if [ -f ./bin/rspec ]; then
RSPEC="bin/rspec"
else
RSPEC="bundle exec rspec"
fi
# Looking for nailgun
lsof -i :$NAILGUN_PORT > /dev/null
if [ $? == 0 ]; then
RSPEC="jruby --ng --dev -S $RSPEC"
fi
# Looking for spork
lsof -i :$SPORK_PORT > /dev/null
if [ $? == 0 ]; then
RSPEC="$RSPEC --drb"
fi
fi
CMD="$RSPEC $@"
echo $CMD
$CMD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment