generators/airbrake/airbrake_generator.rb in airbrake-3.0.9 vs generators/airbrake/airbrake_generator.rb in airbrake-3.1.0
- old
+ new
@@ -58,12 +58,16 @@
puts "... Done."
puts "Heroku's Airbrake API Key is '#{ENV['HOPTOAD_API_KEY']}'"
end
end
+ def heroku_var(var,app_name = nil)
+ app = app_name ? "--app #{app_name}" : ''
+ `heroku config #{app} | grep -E "#{var.upcase}" | awk '{ print $3; }'`.strip
+ end
+
def heroku_api_key
- app = options[:app] ? " --app #{options[:app]}" : ''
- `heroku console#{app} 'puts ENV[%{HOPTOAD_API_KEY}]'`.split("\n").first
+ heroku_var("(hoptoad|airbrake)_api_key",options[:app]).split.find {|x| x unless x.blank?}
end
def heroku?
options[:heroku] ||
system("grep HOPTOAD_API_KEY config/initializers/airbrake.rb") ||