-
-
Save thomet/729dbb4216c9461eeb77e7aa7bc3e748 to your computer and use it in GitHub Desktop.
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
# Clone this repo into you $ZHS_CUSTOM/plguins folder and enable it as plugin in your ~/.zshrc | |
# | |
# Clone | |
# > git clone https://gist.github.com/729dbb4216c9461eeb77e7aa7bc3e748.git $ZSH_CUSTOM/plugins/gac_spec | |
# | |
# Enable plugin in ~/.zshrc (if you have other plugins enabled, add gac_spec to your list) | |
# plugins=(gac_spec) | |
function changed_ruby_files () { | |
if [ "$1" != "" ] | |
then | |
git diff $1...HEAD --name-only --relative --diff-filter=d | grep "\.rb" | grep -v "_spec" | |
else | |
git diff master...HEAD --name-only --relative --diff-filter=d | grep "\.rb" | grep -v "_spec" | |
fi | |
} | |
function changed_rspec_files () { | |
if [ "$1" != "" ] | |
then | |
git diff $1...HEAD --name-only --relative --diff-filter=d | grep "_spec.rb" | |
else | |
git diff master...HEAD --name-only --relative --diff-filter=d | grep "_spec.rb" | |
fi | |
} | |
# Run all specs I have touched in diff to master | |
function rspecch () { | |
bundle exec rspec $(changed_rspec_files $1) | |
} | |
# Run all specs I have touched in diff to master with output of a lot of times (to check timing for PR) | |
function rspecchp () { | |
bundle exec rspec --profile 1000 $(changed_rspec_files $1) | |
} | |
# Runs flog on all changed files in diff to master | |
function flogch () { | |
flog -m $(changed_ruby_files $1) | |
} | |
# Runs flay on all changed files in diff to master | |
function flaych () { | |
flay -v --diff $(changed_ruby_files $1) | |
} | |
# Runs rubocop on all changed files in diff to master | |
function rubocopch () { | |
rubocop $(changed_ruby_files $1) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment