Permalink
Browse files

Merge pull request #118 from exviva/load_initializer_conditionally

Fallback to loading whole environment if initializer does not exist
  • Loading branch information...
2 parents a3a1a92 + fff8cf8 commit ec07ea7c32b3b78a80cb851ded1e1dcbd6a4b606 @shime shime committed Sep 9, 2012
Showing with 11 additions and 1 deletion.
  1. +11 −1 lib/airbrake/shared_tasks.rb
@@ -2,7 +2,17 @@
desc "Notify Airbrake of a new deploy."
task :deploy do
require 'airbrake_tasks'
- load File.join(Rails.root, 'config', 'initializers','airbrake.rb') if defined?(Rails.root)
+
+ if defined?(Rails.root)
+ initializer_file = Rails.root.join('config', 'initializers','airbrake.rb')
+
+ if initializer_file.exist?
+ load initializer_file
+ else
+ Rake::Task[:environment].invoke
+ end
+ end
+
AirbrakeTasks.deploy(:rails_env => ENV['TO'],
:scm_revision => ENV['REVISION'],
:scm_repository => ENV['REPO'],

0 comments on commit ec07ea7

Please sign in to comment.