8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/bugsnag/capistrano.rb', line 8
def self.load_into(configuration)
configuration.load do
after "deploy", "bugsnag:deploy"
after "deploy:migrations", "bugsnag:deploy"
namespace :bugsnag do
desc "Notify Bugsnag that new production code has been deployed"
task :deploy, :except => { :no_release => true }, :on_error => :continue do
rake = fetch(:rake, "rake")
rails_env = fetch(:rails_env, "production")
bugsnag_env = fetch(:bugsnag_env, rails_env)
rake_command = "cd '#{current_path}' && RAILS_ENV=#{rails_env} #{rake} bugsnag:deploy"
new_env = {
"BUGSNAG_RELEASE_STAGE" => bugsnag_env,
"BUGSNAG_REVISION" => fetch(:current_revision, nil),
"BUGSNAG_REPOSITORY" => fetch(:repository, nil),
"BUGSNAG_BRANCH" => fetch(:branch, nil)
}.reject { |_, v| v.nil? }
ALLOWED_ENV_SETTINGS.each { |opt| new_env[opt] = ENV[opt] if ENV[opt] }
rake_command << " #{new_env.map{|k,v| "#{k}=#{v}"}.join(" ")}"
run(rake_command, :once => true)
logger.info "Bugsnag deploy notification complete."
end
end
end
end
|