Sha256: b30bc84156a568d81f1f81ddc836092b339a849e2768dc9d241c7f28de6eefc0
Contents?: true
Size: 1.57 KB
Versions: 51
Compression:
Stored size: 1.57 KB
Contents
require 'capistrano' module Rollbar module Capistrano def self.load_into(configuration) configuration.load do after 'deploy', 'rollbar:deploy' after 'deploy:migrations', 'rollbar:deploy' after 'deploy:cold', 'rollbar:deploy' namespace :rollbar do desc 'Send the deployment notification to Rollbar.' task :deploy, :except => { :no_release => true } do require 'net/http' require 'rubygems' require 'json' _cset(:rollbar_user) { ENV['USER'] || ENV['USERNAME'] } _cset(:rollbar_env) { fetch(:rails_env, 'production') } _cset(:rollbar_token) { abort("Please specify the Rollbar access token, set :rollbar_token, 'your token'") } unless configuration.dry_run uri = URI.parse('https://api.rollbar.com/api/1/deploy/') params = { :local_username => rollbar_user, :access_token => rollbar_token, :environment => rollbar_env, :revision => current_revision } request = Net::HTTP::Post.new(uri.request_uri) request.body = ::JSON.dump(params) Net::HTTP.start(uri.host, uri.port, :use_ssl => true) do |http| http.request(request) end end logger.info('Rollbar notification complete') end end end end end end if Capistrano::Configuration.instance Rollbar::Capistrano.load_into(Capistrano::Configuration.instance) end
Version data entries
51 entries across 51 versions & 1 rubygems