class Honeybadger::CLI::Heroku
def install_deploy_notification
def install_deploy_notification app = options.has_key?('app') ? options['app'] : detect_heroku_app(false) rails_env = options['environment'] || heroku_var('RAILS_ENV', app) api_key = options['api_key'] || heroku_var('HONEYBADGER_API_KEY', app) unless api_key =~ /\S/ say("Unable to detect your API key from Heroku.", :red) say('Have you configured multiple Heroku apps? Try using --app APP', :red) unless app exit(1) end unless rails_env =~ /\S/ say("Unable to detect your environment from Heroku. Use --environment ENVIRONMENT.", :red) say('Have you configured multiple Heroku apps? Try using --app APP', :red) unless app exit(1) end cmd = %Q(heroku webhooks:add -i api:release -l notify -u "https://api.honeybadger.io/v1/deploys/heroku?environment=#{rails_env}&api_key=#{api_key}"#{app ? " --app #{app}" : ''}) say("Running: `#{cmd}`") say(run(cmd)) end