Sha256: b0624b2b0bff215e41ff2005460ad6a93945f10f1902ba1109eb8ddb6f3f6e2b
Contents?: true
Size: 796 Bytes
Versions: 4
Compression:
Stored size: 796 Bytes
Contents
#!/usr/bin/env ruby require 'bundler/setup' require 'rugged' require 'fileutils' def install_pre_commit_hook(repository) hooks_path = File.join(repository.workdir, '.git', '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 # Copia o script do hook para o diretório .git/hooks FileUtils.cp(source_hook_path, hook_path) File.chmod(0755, hook_path) end repo_path = Dir.pwd repo = Rugged::Repository.new(repo_path) install_pre_commit_hook(repo) puts "Hook pre-commit configurado com sucesso!"
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
shellboxCLI-0.3.1 | lib/ios/install-hooks.rb |
shellboxCLI-0.3.0 | lib/ios/install-hooks.rb |
shellboxCLI-0.2.0 | lib/ios/install-hooks.rb |
shellboxCLI-0.1.15 | lib/ios/install-hooks.rb |