Sha256: fcb6a946e87deb94440fb3f902c259b52011c993163b26e82717241fb04367ae

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

require 'net/http'

Capistrano::Configuration.instance(:must_exist).load do
  if configuration[:deploy_reporter_domain]
    after 'deploy',            'deploy:report'
    after 'deploy:migrations', 'deploy:report'
  end

  namespace :deploy do
    desc "Report that the deployment was made"
    task :report, :except => { :no_release => true } do
      local_user = ENV['USER'] || ENV['USERNAME']
      puts "\n\n### REPORT DEPLOYMENT: Reporting deployment to deployment tracking system\n\n"
      url = URI.parse("#{configuration[:deploy_reporter_domain]}/deployments")
      req = Net::HTTP::Post.new(url.path)
      req.set_form_data({ 'deployment[deployer]' => local_user, 'deployment[project_name]' => application }, ';')
      res = Net::HTTP.new(url.host, url.port).start {|http| http.request(req) }
      case res
      when Net::HTTPSuccess, Net::HTTPRedirection
        # OK
      else
        res.error!
      end
      # system 'open http://fierce-samurai-448.heroku.com/deployments'
      puts 'Deployment reported.'
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
capistrano-git-plugins-0.0.8 lib/capistrano/git/plugins/deploy_reporter.rb
capistrano-git-plugins-0.0.7 lib/capistrano/git/plugins/deploy_reporter.rb
capistrano-git-plugins-0.0.6 lib/capistrano/git/plugins/deploy_reporter.rb
capistrano-git-plugins-0.0.5 lib/capistrano/git/plugins/deploy_reporter.rb