39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
# File 'lib/honeybadger/cli/heroku.rb', line 39
def install(api_key)
say("Installing Honeybadger #{VERSION} for Heroku")
load_rails(verbose: true)
ENV['HONEYBADGER_LOGGING_LEVEL'] = '2'
ENV['HONEYBADGER_LOGGING_TTY_LEVEL'] = '0'
ENV['HONEYBADGER_LOGGING_PATH'] = 'STDOUT'
ENV['HONEYBADGER_REPORT_DATA'] = 'true'
ENV['HONEYBADGER_API_KEY'] = api_key
app = options[:app] || detect_heroku_app(false)
say("Adding config HONEYBADGER_API_KEY=#{api_key} to Heroku.", :magenta)
unless write_heroku_env({'HONEYBADGER_API_KEY' => api_key}, app)
say('Unable to update heroku config. Do you need to specify an app name?', :red)
exit(1)
end
if env = heroku_var('RAILS_ENV', app, heroku_var('RACK_ENV', app))
say('Installing deploy notification addon', :magenta)
invoke :install_deploy_notification, [], { app: app, api_key: api_key, environment: env }
else
say('Skipping deploy notification installation: we were unable to determine the environment name from your Heroku app.', :yellow)
say("To install manually, try `honeybadger heroku install_deploy_notification#{app ? " -a #{app}" : ""} -k #{api_key} --environment ENVIRONMENT`", :yellow)
end
config = Config.new(rails_framework_opts)
Honeybadger.start(config) unless load_rails_env(verbose: true)
say('Sending test notice')
unless Agent.instance && send_test(false)
say("Honeybadger is installed, but failed to send a test notice. Try `HONEYBADGER_API_KEY=#{api_key} honeybadger test`.", :red)
exit(1)
end
say("Installation complete. Happy 'badgering!", :green)
end
|