Class: AccuHook::Installation
- Inherits:
-
Object
- Object
- AccuHook::Installation
- Defined in:
- lib/accuhook/command_line.rb
Instance Method Summary collapse
-
#initialize(repo) ⇒ Installation
constructor
A new instance of Installation.
- #install(repo_path) ⇒ Object
Constructor Details
#initialize(repo) ⇒ Installation
Returns a new instance of Installation.
47 48 49 |
# File 'lib/accuhook/command_line.rb', line 47 def initialize(repo) install(repo) end |
Instance Method Details
#install(repo_path) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/accuhook/command_line.rb', line 51 def install(repo_path) repository = Grit::Repo.new(repo_path) repo_hooks = File.join(repo_path, '.git', 'hooks') accurev_repo = File.join(repo_path, '.git', 'accurev.git') accurev_hooks = File.join(repo_path, '.git', 'accurev.git', 'hooks') repository.(accurev_repo, :shared => false, :mirror => true) repository.remote_add("accurev", accurev_repo) FileUtils.mkdir accurev_hooks unless File.exist? accurev_hooks FileUtils.mkdir repo_hooks unless File.exist? repo_hooks FileUtils.install(File.join(File.dirname(__FILE__), "hooks", "post-commit"), repo_hooks, :mode => 0755) FileUtils.install(File.join(File.dirname(__FILE__), "hooks", "post-receive"), accurev_hooks, :mode => 0755) end |