Skip to content

Instantly share code, notes, and snippets.

@tkm-kj
Created February 25, 2017 05:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tkm-kj/9d5577f70a800c09e9c6e4af5d106ef8 to your computer and use it in GitHub Desktop.
Save tkm-kj/9d5577f70a800c09e9c6e4af5d106ef8 to your computer and use it in GitHub Desktop.
git commit完了前に実行されるスクリプト
#!/bin/sh
exec ruby -S -x $0 "$@"
#! ruby
class PreCommitExecutor
COMMANDS = ['bundle exec rspec', 'bundle exec rubocop']
def run
status = COMMANDS.map {|cmd| system(cmd) }.all?
exit(status)
end
end
PreCommitExecutor.new.run
@tkm-kj
Copy link
Author

tkm-kj commented Feb 25, 2017

置き場: リポジトリ/.git/hooks/

@tkm-kj
Copy link
Author

tkm-kj commented Feb 25, 2017

hookを流したくない時: -n or --no-verify オプション

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment