lib/rails/generators/airbrake/airbrake_generator.rb in airbrake-3.1.10 vs lib/rails/generators/airbrake/airbrake_generator.rb in airbrake-3.1.11
- old
+ new
@@ -13,10 +13,13 @@
:desc => "Your Heroku app name (only required if deploying to >1 Heroku app)"
class_option :secure, :type => :boolean,
:desc => "Use SSL connection"
+ class_option :test_mode, :aliases => "-t", :type => :boolean,
+ :desc => "Use Airbrake in test mode"
+
def self.source_root
@_airbrake_source_root ||= File.expand_path("../../../../../generators/airbrake/templates", __FILE__)
end
def install
@@ -91,10 +94,14 @@
def secure?
options[:secure]
end
+ def test_mode?
+ options[:test_mode]
+ end
+
def heroku?
options[:heroku] ||
system("grep AIRBRAKE_API_KEY config/initializers/airbrake.rb") ||
system("grep AIRBRAKE_API_KEY config/environment.rb")
end
@@ -115,9 +122,10 @@
output = <<-eos
Airbrake.configure do |config|
config.api_key = #{api_key_expression}
eos
- output << " config.secure = true" if secure?
- output << "\nend"
+ output << " config.secure = true\n" if secure?
+ output << " config.test_mode = true\n" if test_mode?
+ output << "end"
end
end