6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/hubeye/server/strategies/add_hook.rb', line 6
def call
cwd = File.expand_path('.')
repo_name = @matches[1]
directory = @matches[3]
command = @matches[4]
hooks = session.hooks
if repo_name.nil? and command.nil?
socket.deliver "Format: 'hook add user/repo [dir: /my/dir/repo ] cmd: some_cmd'"
return
end
directory = directory || cwd
if hooks[repo_name]
if hooks[repo_name][directory]
hooks[repo_name][directory] << command
else
hooks[repo_name][directory] = [command]
end
else
hooks[repo_name] = {directory => [command]}
end
socket.deliver "Hook added"
end
|