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

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

Instance Attribute Summary

Attributes inherited from Generic

#app, #user

Instance Method Summary collapse

Methods inherited from Generic

#check_app, #check_auth, #faraday, #handle_error_response, #needs_key?, #restart, #run

Instance Method Details

#git_urlObject



5
6
7
# File 'lib/dpl/provider/heroku/git.rb', line 5

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

#push_appObject



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

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

#write_netrcObject



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

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