Sha256: 340373f0c687b2e32b26c0f0860581019f7d5170a233b970f25f7de506ea0329
Contents?: true
Size: 1.7 KB
Versions: 1
Compression:
Stored size: 1.7 KB
Contents
require 'net/https' # hack to eliminate the SSL certificate verification notification class Net::HTTP alias_method :old_initialize, :initialize def initialize(*args) old_initialize(*args) @ssl_context = OpenSSL::SSL::SSLContext.new @ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE end end Capistrano::Configuration.instance(:must_exist).load do after "deploy", "deploy:track" after "deploy:migrations", "deploy:track" namespace :deploy do desc "Send deployment to deploytracker.com" task :track, :except => { :no_release => true } do rails_env = fetch(:rails_env, "production") executable = RUBY_PLATFORM.downcase.include?('mswin') ? 'rake.bat' : 'rake' puts "[DeployTracker] Tracking Deployment" github_username = `git config --get github.user`.chomp throw "[DeployTracker] Please set your github username with...\n\t`git config --global github.user YOUR_GITHUB_USERNAME`." if github_username.size==0 data = "deploy[github_username]=#{github_username}&deploy[environment]=#{rails_env}&deploy[revision]=#{current_revision}&deploy[repository]=#{repository}&api_key=#{deploy_tracking_api_key}" http = Net::HTTP.new('deploytracking.heroku.com', 443) http.use_ssl = true path = '/deploys' headers = { 'Content-Type' => 'application/x-www-form-urlencoded' } resp, data = begin http.post(path, data, headers) rescue TimeoutError => e throw "[DeployTracker] Connection timed out." end throw "[DeployTracker] Error posting to server." unless resp.is_a?(Net::HTTPSuccess) puts "[DeployTracker] Deployment tracked" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
deploy_tracker-0.0.2 | lib/deploy_tracker/capistrano.rb |