Top Level Namespace

Defined Under Namespace

Modules: App, IOS

Instance Method Summary collapse

Instance Method Details

#install_pre_commit_hook(repository) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/ios/install-hooks.rb', line 6

def install_pre_commit_hook(repository)
  hooks_path = File.join(repository.repo.path, 'hooks')
  hook_type = 'pre-commit'
  hook_path = File.join(hooks_path, hook_type)
  source_hook_path = File.join(File.dirname(File.expand_path(__FILE__)), 'hooks', hook_type)
  unless File.directory?(hooks_path)
    puts "Pasta .git/hooks não encontrada. Certifique-se de estar no diretório raiz do seu repositório Git."
    exit 1
  end
  FileUtils.cp(source_hook_path, hook_path)
  File.chmod(0755, hook_path)
end