Sha256: 0a38c0a878b3ac4033decd300972c97327017d336821d8c8e4c02aa3e02036aa

Contents?: true

Size: 1016 Bytes

Versions: 1

Compression:

Stored size: 1016 Bytes

Contents

require 'net/http'

Capistrano::Configuration.instance(:must_exist).load do
  if 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("#{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

1 entries across 1 versions & 1 rubygems

Version Path
capistrano-git-plugins-0.0.9 lib/capistrano/git/plugins/deploy_reporter.rb