cocoapods-sync-githooks is a CocoaPods plugin to sync git hooks. Manage shared githooks scripts through the Pod library, even in different repositories.
Install with gem install
$ gem install cocoapods-sync-githooks
or add cocoapods-sync-githooks
to the Gemfile
:
gem 'cocoapods-sync-githooks'
- Add
cocoapods-sync-githooks
to yourPodfile
:
platform :ios, '9.0'
plugin 'cocoapods-sync-githooks'
target 'SyncGithooksDemo' do
end
- Add pods of git hooks under
Githooks
abstract_target.
abstract_target 'Githooks' do
pod 'githooksA', git: 'https://github.com/dirtmelon/githooksA.git'
pod 'githooksB', git: 'https://github.com/dirtmelon/githooksB.git'
end
- Edit scripts of git hooks in different pods. The git hooks script needs to be placed in the
githooks
directory. You can also put the script in thescripts
directory, then call in the script of git hooks .
// pre-commit, much use ${script_directory} to get correct directory.
ruby ${script_directory}/Test.rb
Demo and git hooks pods: