Skip to content

Instantly share code, notes, and snippets.

@ylansegal
Last active March 9, 2018 17:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ylansegal/ee2dfa226cc3b79822e52c185fd6308c to your computer and use it in GitHub Desktop.
Save ylansegal/ee2dfa226cc3b79822e52c185fd6308c to your computer and use it in GitHub Desktop.
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