Last active
November 9, 2021 07:10
-
-
Save pat/cb5a6f43ad8c6f1b01453d8ee2598ab5 to your computer and use it in GitHub Desktop.
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
function ruby_files() { | |
xargs ls -1 2>/dev/null | grep '\.rb$' | |
} | |
function spec_files() { | |
xargs ls -1 2>/dev/null | grep '_spec\.rb$' | |
} | |
function uncommitted() { | |
# first command is staged changes, second is new files and unstaged changes | |
echo "$(git diff --name-only --cached)\n$(git ls-files --others --exclude-standard --modified)" | |
} | |
function branch_changes() { | |
git diff --name-only main | |
} | |
function uncommitted_rubocop() { | |
uncommitted | ruby_files | xargs bundle exec rubocop | |
} | |
function branch_rubocop() { | |
branch_changes | ruby_files | xargs bundle exec rubocop | |
} | |
function uncommitted_rspec() { | |
bundle exec rspec $(uncommitted | spec_files) | |
} | |
function branch_rspec() { | |
bundle exec rspec $(branch_changes | spec_files) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment