Skip to content

Commit

Permalink
Merge pull request airbrake#118 from exviva/load_initializer_conditio…
Browse files Browse the repository at this point in the history
…nally

Fallback to loading whole environment if initializer does not exist
  • Loading branch information
shime committed Sep 9, 2012
2 parents a3a1a92 + fff8cf8 commit ec07ea7
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/airbrake/shared_tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down

0 comments on commit ec07ea7

Please sign in to comment.