Class: Hubeye::Server::ListHooks

Inherits:
Object
  • Object
show all
Defined in:
lib/hubeye/server/server.rb

Instance Method Summary collapse

Instance Method Details

#callObject



232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
# File 'lib/hubeye/server/server.rb', line 232

def call
  socket = server.socket
  hooks = server.session.hooks
  if hooks.empty?
    socket.deliver "No hooks"
    return
  end
  pwd = File.expand_path('.')
  format_string = ""
  hooks.each do |repo, hash|
    local_dir = nil
    command = nil
    hash.each do |dir,cmd|
      if dir.nil?
        local_dir = pwd
        command = cmd.join("\n" + (' ' * 8))
      else
        command = cmd
        local_dir = dir
      end
    end
    format_string << <<EOS
remote: #{repo}
dir:    #{local_dir}
cmds:   #{command}\n
EOS
  end
  socket.deliver format_string
end