Sha256: ab5810c1671fea11cf8e6c9ed8e8c8c5c8fbec2a3e9cd8305e85449f8de8f9f4
Contents?: true
Size: 1.62 KB
Versions: 41
Compression:
Stored size: 1.62 KB
Contents
module DPL class Provider module Heroku class Git < Provider requires 'heroku-api' requires 'rendezvous' def api @api ||= ::Heroku::API.new(:api_key => option(:api_key)) unless options[:user] and options[:password] @api ||= ::Heroku::API.new(:user => options[:user], :password => options[:password]) end def user @user ||= api.get_user.body["email"] end def check_auth log "authenticated as %s" % user end def check_app info = api.get_app(option(:app)).body options[:git] ||= info['git_url'] log "found app #{info['name']}" end def setup_key(file) api.post_key File.read(file) end def remove_key api.delete_key(option(:key_name)) end def push_app context.shell "git push #{option(:git)} HEAD:refs/heads/master -f" end def run(command) data = api.post_ps(option(:app), command, :attach => true).body rendezvous_url = data['rendezvous_url'] Rendezvous.start(:url => rendezvous_url) unless rendezvous_url.nil? end def restart api.post_ps_restart option(:app) end def deploy super rescue ::Heroku::API::Errors::NotFound => error raise Error, "#{error.message} (wrong app #{options[:app].inspect}?)", error.backtrace rescue ::Heroku::API::Errors::Unauthorized => error raise Error, "#{error.message} (wrong API key?)", error.backtrace end end end end end
Version data entries
41 entries across 41 versions & 1 rubygems