Last active
March 9, 2018 17:56
-
-
Save ylansegal/ee2dfa226cc3b79822e52c185fd6308c to your computer and use it in GitHub Desktop.
Ruby dev scripts
This file contains 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 | |
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 $@ |
This file contains 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 | |
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