Class: Sambot::Chef::Hooks

Inherits:
Object
  • Object
show all
Defined in:
lib/sambot/chef/hooks.rb

Constant Summary collapse

SCRIPTS =
['pre-push', 'pre-commit'].freeze

Class Method Summary collapse

Class Method Details

.copyObject



9
10
11
12
13
14
15
16
17
# File 'lib/sambot/chef/hooks.rb', line 9

def self.copy
  SCRIPTS.each do |hook|
    working_path = ".git/hooks/#{hook}"
    template_path = Template.new("git_hooks/#{hook}").path
    File.delete(working_path) if File.exist?(working_path)
    FileUtils.cp(template_path, working_path)
    UI.debug("The #{hook} Git hook has been added to the cookbook.")
  end
end