Guest User

Untitled

a guest
Sep 24th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. define :notify_airbrake, :name=>nil, :environment=>nil, :repository=>nil do
  2.  
  3. script "notifying airbrake of deploy" do
  4. interpreter "ruby"
  5. user "deployer"
  6. cwd params[:name]
  7. code <<-EOS
  8. require 'rubygems'
  9. unless File.exist?("#{params[:name]}/config/initializers/airbrake.rb")
  10. puts "!!! airbrake.rb not found. Not notifying Airbrake of the deploy !!!"
  11. exit 0
  12. end
  13.  
  14. # Setup the airbrake api_key
  15. require 'airbrake'
  16. require 'airbrake_tasks'
  17. require "#{params[:name]}/config/initializers/airbrake.rb"
  18.  
  19. revision = `cd #{params[:name]} && git rev-parse HEAD`.chomp
  20.  
  21. print "Airbrake : "
  22.  
  23. AirbrakeTasks.deploy(:rails_env => '#{params[:environment]}',
  24. :scm_revision => revision,
  25. :scm_repository => '#{params[:repository]}',
  26. :local_username => 'chef')
  27. EOS
  28. end
  29. end
Add Comment
Please, Sign In to add comment