Class: PuppetHerald::App

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/puppet-herald/app.rb

Class Method Summary collapse

Class Method Details

.bug(ex) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/puppet-herald/app.rb', line 23

def self.bug ex
  file = Tempfile.new(['puppet-herald-bug', '.log'])
  filepath = file.path
  file.close
  file.unlink
  message = "v#{PuppetHerald::VERSION}-#{ex.class.to_s}: #{ex.message}"
  contents = message + "\n\n" + ex.backtrace.join("\n") + "\n"
  File.write(filepath, contents)
  bugo = {
    :message  => message,
    :homepage => PuppetHerald::HOMEPAGE,
    :bugfile  => filepath,
    :help     => "Please report this bug to #{PuppetHerald::HOMEPAGE} by passing contents of bug file: #{filepath}"
  }
  return bugo
end