Sha256: ed61a5c64ae36c34e39916d378fad9f15822af2583561927b7eafe8df0919274

Contents?: true

Size: 1.25 KB

Versions: 10

Compression:

Stored size: 1.25 KB

Contents

require 'errplane'

Capistrano::Configuration.instance(:must_exist).load do
  after 'deploy',            'deploy:notify_errplane'
  after 'deploy:migrations', 'deploy:notify_errplane'

  namespace :deploy do
    desc 'Notify Errplane of the deployment'
    task :notify_errplane, :except => {:no_release => true} do
      set(:deploying_user) { `whoami`.strip }
      set(:deploying_user_name) { `bash -c 'git config --get user.name'`.strip }
      set(:deploying_user_email) { `bash -c 'git config --get user.email'`.strip }

      puts "Notifying Errplane of the deployment.."
      framework_env = fetch(:rails_env, fetch(:errplane_env, 'production'))
      load File.join(Dir.pwd, "config/initializers/errplane.rb")

      Errplane.configuration.logger = Logger.new("/dev/null")
      Errplane.configuration.environment = framework_env

      context = {
        :environment => framework_env,
        :revision => current_revision,
        :repository => repository,
        :branch => (branch rescue nil),
        :scm => scm,
        :remote_user => (user rescue nil),
        :local_user => deploying_user,
        :scm_user_name => deploying_user_name,
        :scm_user_email => deploying_user_email
      }

      Errplane.report_deployment(context)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
errplane-0.6.9 lib/errplane/capistrano.rb
errplane-0.6.8 lib/errplane/capistrano.rb
errplane-0.6.7 lib/errplane/capistrano.rb
errplane-0.6.6 lib/errplane/capistrano.rb
errplane-0.6.5 lib/errplane/capistrano.rb
errplane-0.6.4 lib/errplane/capistrano.rb
errplane-0.6.3 lib/errplane/capistrano.rb
errplane-0.6.2 lib/errplane/capistrano.rb
errplane-0.6.1 lib/errplane/capistrano.rb
errplane-0.6.0 lib/errplane/capistrano.rb