Class: Hubeye::Server::Strategy::ListHooks

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

Instance Method Summary collapse

Instance Method Details

#callObject



321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
# File 'lib/server/hubeye_server.rb', line 321

def call
  unless @session.hooks.empty?
    pwd = File.expand_path('.')
    format_string = ""
    @session.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.puts(format_string)
  else
    @socket.puts("No hooks")
  end
end