Class: DPL::Provider::Heroku::Git

Inherits:
Generic show all
Defined in:
lib/dpl/provider/heroku/git.rb

Direct Known Subclasses

Anvil, GitSSH

Instance Attribute Summary

Attributes inherited from DPL::Provider

#context, #options

Instance Method Summary collapse

Methods inherited from Generic

#api, #api_options, #check_app, #check_auth, #deploy, #info, #needs_key?, #restart, #run, #user

Methods inherited from DPL::Provider

apt_get, #check_app, #cleanup, #commit_msg, context, #create_key, #default_text_charset, #default_text_charset?, #deploy, #detect_encoding?, #encoding_for, #error, experimental, #initialize, #log, #needs_key?, new, npm_g, #option, pip, requires, #run, #setup_git_credentials, #setup_git_ssh, #sha, shell, #uncleanup, #user_agent, #warn

Constructor Details

This class inherits a constructor from DPL::Provider

Instance Method Details

#git_urlObject



7
8
9
# File 'lib/dpl/provider/heroku/git.rb', line 7

def git_url
  "https://git.heroku.com/#{option(:app)}.git"
end

#push_appObject



11
12
13
14
15
# File 'lib/dpl/provider/heroku/git.rb', line 11

def push_app
  git_remote = options[:git] || git_url
  write_netrc if git_remote.start_with?("https://")
  context.shell "git push #{git_remote} HEAD:refs/heads/master -f"
end

#write_netrcObject



17
18
19
20
21
# File 'lib/dpl/provider/heroku/git.rb', line 17

def write_netrc
  n = Netrc.read
  n['git.heroku.com'] = [user, option(:api_key)]
  n.save
end