Class: DPL::Provider::Heroku::Git
Instance Attribute Summary
#context, #options
Instance Method Summary
collapse
#cleanup, context, #create_key, #error, experimental, #initialize, #log, #needs_key?, new, npm_g, #option, pip, requires, #setup_git_credentials, #setup_git_ssh, #sha, shell, #uncleanup
Constructor Details
This class inherits a constructor from DPL::Provider
Instance Method Details
#api ⇒ Object
8
9
10
11
|
# File 'lib/dpl/provider/heroku/git.rb', line 8
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
|
#check_app ⇒ Object
21
22
23
24
25
|
# File 'lib/dpl/provider/heroku/git.rb', line 21
def check_app
info = api.get_app(option(:app)).body
options[:git] ||= info['git_url']
log "found app #{info['name']}"
end
|
#check_auth ⇒ Object
17
18
19
|
# File 'lib/dpl/provider/heroku/git.rb', line 17
def check_auth
log "authenticated as %s" % user
end
|
#deploy ⇒ Object
49
50
51
52
53
54
55
|
# File 'lib/dpl/provider/heroku/git.rb', line 49
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
|
#push_app ⇒ Object
35
36
37
|
# File 'lib/dpl/provider/heroku/git.rb', line 35
def push_app
context.shell "git push #{option(:git)} HEAD:refs/heads/master -f"
end
|
#remove_key ⇒ Object
31
32
33
|
# File 'lib/dpl/provider/heroku/git.rb', line 31
def remove_key
api.delete_key(option(:key_name))
end
|
#restart ⇒ Object
45
46
47
|
# File 'lib/dpl/provider/heroku/git.rb', line 45
def restart
api.post_ps_restart option(:app)
end
|
#run(command) ⇒ Object
39
40
41
42
43
|
# File 'lib/dpl/provider/heroku/git.rb', line 39
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
|
#setup_key(file) ⇒ Object
27
28
29
|
# File 'lib/dpl/provider/heroku/git.rb', line 27
def setup_key(file)
api.post_key File.read(file)
end
|
#user ⇒ Object
13
14
15
|
# File 'lib/dpl/provider/heroku/git.rb', line 13
def user
@user ||= api.get_user.body["email"]
end
|