286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
|
# File 'lib/server/hubeye_server.rb', line 286
def call
cwd = File.expand_path('.')
repo = @matches[1]
dir = @matches[3]
cmd = @matches[4]
if repo != nil and cmd != nil
if @session.hooks[repo]
if dir
if @session.hooks[repo][dir]
@session.hooks[repo][dir] << cmd
else
@session.hooks[repo][dir] = [cmd]
end
else
if @session.hooks[repo][cwd]
@session.hooks[repo][cwd] << cmd
else
@session.hooks[repo][cwd] = [cmd]
end
end
else
if dir
@session.hooks[repo] = {dir => [cmd]}
else
@session.hooks[repo] = {cwd => [cmd]}
end
end
@socket.puts("Hook added")
else
@socket.puts("Format: 'hook add user/repo [dir: /my/dir/repo ] cmd: git pull origin'")
end
end
|