mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 15:23:06 +00:00
Add rubocop binstub that rspects file patterns
Best of both worlds! (Because you can't override the default rubocop includes) The binstub basically, lets me safely `rubocop test/foo_test.rb` instead of `bundle exec rubocop test/foo_test.rb` ```bash # ~/.profile # https://twitter.com/tpope/status/165631968996900865 # tl;dr `mkdir .git/safe` to add `bin` to path, e.g. `bin/rails` PATH=".git/safe/../../bin:$PATH" ```
This commit is contained in:
38
bin/rubocop
Executable file
38
bin/rubocop
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Usage:
|
||||
# bin/rubocop [-A|-t|-h]
|
||||
# bin/rubocop [file or path] [cli options]
|
||||
#
|
||||
# Options:
|
||||
# Autocorrect -A
|
||||
# AutoGenConfig -t
|
||||
# Usage -h,--help,help
|
||||
|
||||
set -e
|
||||
|
||||
case $1 in
|
||||
-A)
|
||||
echo "Rubocop autocorrect is ON" >&2
|
||||
bundle exec rake -f lib/tasks/rubocop.rake rubocop:auto_correct
|
||||
;;
|
||||
|
||||
-t)
|
||||
echo "Rubocop is generating a new TODO" >&2
|
||||
bundle exec rake -f lib/tasks/rubocop.rake rubocop:auto_gen_config
|
||||
;;
|
||||
|
||||
-h|--help|help)
|
||||
sed -ne '/^#/!q;s/.\{1,2\}//;1d;p' < "$0"
|
||||
;;
|
||||
|
||||
*)
|
||||
# with no args, run vanilla rubocop
|
||||
# else assume we're passing in arbitrary arguments
|
||||
if [ -z "$1" ]; then
|
||||
bundle exec rake -f lib/tasks/rubocop.rake rubocop
|
||||
else
|
||||
bundle exec rubocop "$@"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user