Module: GritService::Helpers

Included in:
Service::Git, Service::Repo
Defined in:
lib/grit_service/base.rb

Instance Method Summary collapse

Instance Method Details

#service(method) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/grit_service/base.rb', line 18

def service(method)
  define_method(method) do |git_dir, *args|
    GritService.log.debug("#{GritService.git(git_dir)}: #{method}(#{args.inspect})")
    begin
      GritService.git(git_dir).send(method, *args)
    rescue Exception => e
      GritService.log.error(e.to_s)
      e.backtrace.each {|line| GritService.log.error(line)}
      raise e
    end
  end
end