Module: Hookers::Git

Extended by:
Git
Included in:
Git
Defined in:
lib/hookers/git/setup.rb,
lib/hookers/git/commit.rb,
lib/hookers/git/repository.rb

Defined Under Namespace

Classes: Commit, Repository

Instance Method Summary collapse

Instance Method Details

#root_pathObject



8
9
10
11
12
13
14
15
# File 'lib/hookers/git/setup.rb', line 8

def root_path
  path = Dir.pwd

  while (path != "/") and ! Dir.entries(path).include?(".git") do
    path = File.expand_path("..", path)
  end
  path
end

#setupObject



17
18
19
20
21
22
23
24
25
# File 'lib/hookers/git/setup.rb', line 17

def setup
  from_path = "#{Hookers.root}/scripts/git/post-commit"
  to_path = "#{root_path}/.git/hooks/post-commit"

  FileUtils.cp(from_path, to_path)
  FileUtils.chmod 0755, to_path

  "setup successfully"
end