Sha256: e037fdb025c8aa1f878fce7d0ef648e5332f450093bb67d3a6b647efbc862810

Contents?: true

Size: 1.23 KB

Versions: 5

Compression:

Stored size: 1.23 KB

Contents

namespace :airbrake do
  desc <<-DESC
    Notify Airbrake of the deployment by running the notification on the REMOTE machine.
      - Run remotely so we use remote API keys, environment, etc.
  DESC
  task :deploy do
    on roles(:all) do |host|
      rails_env = fetch(:rails_env, "production")
      airbrake_env = fetch(:airbrake_env, fetch(:rails_env, "production"))
      local_user = ENV['USER'] || ENV['USERNAME']
      executable = RUBY_PLATFORM.downcase.include?('mswin') ? fetch(:rake, 'rake.bat') : fetch(:rake, 'bundle exec rake ')
      current_revision = capture("cd #{repo_path} && git rev-parse HEAD")
      repository = ENV['REPO'] || ENV['REPONAME']

      notify_command = "airbrake:deploy TO=#{airbrake_env} REVISION=#{current_revision} REPO=#{repo_url} USER=#{Airbrake::Capistrano::shellescape(local_user)}"
      notify_command << " API_KEY=#{ENV['API_KEY']}" if ENV['API_KEY']
      info "Notifying Airbrake of Deploy (#{notify_command})"
      result = ""
      within release_path do
        execute :rake, notify_command, :once => true do |ch, stream, data| 
          result << data
        end
      end
      # TODO: Check if SSL is active on account via result content.
      info "Airbrake Notification Complete."
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
airbrake-4.0.0 lib/airbrake/tasks/airbrake.cap
airbrake-3.2.1 lib/airbrake/tasks/airbrake.cap
airbrake-3.2.0 lib/airbrake/tasks/airbrake.cap
airbrake-3.1.17 lib/airbrake/tasks/airbrake.cap
airbrake-3.1.16 lib/airbrake/tasks/airbrake.cap