Class: RGitHook::Hook

Inherits:
Object show all
Defined in:
lib/rgithook/hook.rb

Overview

Interface from git-commands to RGitHook

Class Method Summary collapse

Class Method Details

.executeObject

::nodoc


4
5
6
7
# File 'lib/rgithook/hook.rb', line 4

def self.execute
  puts "Executing #{File.basename($0)} hook"
  self.send File.basename($0).tr('-','_')
end

.method_missing(method_name) ⇒ Object



22
23
24
25
26
27
# File 'lib/rgithook/hook.rb', line 22

def self.method_missing(method_name)
  RGitHook.new(repo_path).send(method_name)
  0
rescue
  -1
end

.post_receiveObject



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/rgithook/hook.rb', line 9

def self.post_receive
  packs = STDIN.read.split("\n")
  ret_vals = []

  rgithook = RGitHook.new repo_path

  packs.each do |pack|
    oldrev, newrev, ref = pack.split(' ')
    ret_vals << rgithook.post_receive(oldrev,newrev,ref).first[1].to_i
  end
  return ret_vals.max
end