Sha256: a1c65ac07db265af3ef7c9207c8da63116b3b24c407d4be9d40aeb62bd2ac7c0
Contents?: true
Size: 1.67 KB
Versions: 4
Compression:
Stored size: 1.67 KB
Contents
module DPL class Provider module Heroku class Anvil < Git requires 'anvil-cli', :load => 'anvil/engine' requires 'excon' # comes with heroku requires 'json' def api raise Error, 'anvil deploy strategy only works with api_key' unless options[:api_key] super end def needs_key? false end def push_app sha = ENV['TRAVIS_COMMIT'] || `git rev-parse HEAD`.strip response = Excon.post release_url, :body => { "slug_url" => slug_url, "description" => "Deploy #{sha} via Travis CI" }.to_json, :headers => { 'Content-Type' => 'application/json', 'Accept' => 'application/json' } print "\nDeploying slug " while response.status == 202 location = response.headers['Location'] response = Excon.get("https://:#{option(:api_key)}@cisaurus.heroku.com#{location}") sleep(1) print '.' end if response.status.between? 200, 299 puts " success!" else raise Error, "deploy failed, anvil response: #{response.body}" end end def slug_url @slug_url ||= begin ::Anvil.headers["X-Heroku-User"] = user ::Anvil.headers["X-Heroku-App"] = option(:app) ::Anvil::Engine.build "." rescue ::Anvil::Builder::BuildError => e raise Error, "deploy failed, anvil build error: #{e.message}" end end def release_url "https://:#{option(:api_key)}@cisaurus.heroku.com/v1/apps/#{option(:app)}/release" end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
dpl-1.4.0 | lib/dpl/provider/heroku/anvil.rb |
dpl-1.3.4 | lib/dpl/provider/heroku/anvil.rb |
dpl-1.3.3 | lib/dpl/provider/heroku/anvil.rb |
dpl-1.3.2 | lib/dpl/provider/heroku/anvil.rb |