Class: Jigit::GitHookInstaller
- Inherits:
-
Object
- Object
- Jigit::GitHookInstaller
- Defined in:
- lib/jigit/git/git_hook_installer.rb
Overview
Command to setup the git hook for jigit
Instance Method Summary collapse
-
#initialize(git_hooks_folder = nil, git_path = nil) ⇒ GitHookInstaller
constructor
A new instance of GitHookInstaller.
- #install(hook) ⇒ Object
Constructor Details
#initialize(git_hooks_folder = nil, git_path = nil) ⇒ GitHookInstaller
Returns a new instance of GitHookInstaller.
6 7 8 9 10 |
# File 'lib/jigit/git/git_hook_installer.rb', line 6 def initialize(git_hooks_folder = nil, git_path = nil) @git_hooks_folder = git_hooks_folder ? git_hooks_folder : default_git_hooks_folder @git_path = git_path ? git_path : default_git_path @is_git_hook_file_new = false end |
Instance Method Details
#install(hook) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/jigit/git/git_hook_installer.rb', line 12 def install(hook) @git_hook_name = hook.name @git_hook_file_path = "#{@git_hooks_folder}/#{@git_hook_name}" ensure_git_hook_file_exists ensure_git_hook_file_is_executable write_hook_lines(hook.hook_lines) end |