Last active
August 18, 2017 16:13
-
-
Save markburns/2a4188b69d585a62465d55f76374221b to your computer and use it in GitHub Desktop.
useful bash scripts for finding files/changed files/running specs etc
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 | |
git rev-parse --abbrev-ref HEAD | tail -2 |
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 | |
while read line | |
do | |
dirname $line | |
done |
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 | |
while read line | |
do | |
if [ -e $line ] | |
then | |
echo $line | |
fi | |
done < "${1:-/dev/stdin}" | |
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 | |
while read line | |
do | |
if [ -d "$line" ] | |
then | |
echo "$line" | |
fi | |
done < "${1:-/dev/stdin}" |
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 | |
if [ ! -e .base-branch ]; then | |
branch=master | |
else | |
branch=$(cat .base-branch) | |
fi | |
set -o verbose | |
show-changed-files $branch | grep "\.rb$" | exists | xargs rubocop -a | grep "no offenses detected" || (echo "rubocop failed" && exit 1) |
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 | |
ls spec/**/*_spec.rb | grep $1 | xargs zeus 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 | |
show-changed-files | directory-from-file | sort | uniq |
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 | |
main=${1:-master} | |
git diff --name-only $(current-branch) $(git merge-base $(current-branch) $main) | exists |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment