class Hatchet::GitApp

used for deploying a test app to heroku via git

Public Instance Methods

git_repo() click to toggle source
# File lib/hatchet/git_app.rb, line 4
def git_repo
  "https://git.heroku.com/#{name}.git"
end
push_without_retry!() click to toggle source
# File lib/hatchet/git_app.rb, line 8
def push_without_retry!
  output = ""

  ShellThrottle.new(platform_api: @platform_api).call do
    begin
      output = git_push_heroku_yall
    rescue FailedDeploy => e
      case e.output
      when /reached the API rate limit/, /429 Too Many Requests/, /HTTP 429/, /HTTP code = 429/
        throw(:throttle)
      else
        raise e unless @allow_failure
        output = e.output
      end
    end
  end

  return output
end
releases() click to toggle source
# File lib/hatchet/git_app.rb, line 28
def releases
  platform_api.release.list(name)
end

Private Instance Methods

git_push_heroku_yall() click to toggle source
# File lib/hatchet/git_app.rb, line 32
        def git_push_heroku_yall
  output = `git push #{git_repo} HEAD:main 2>&1`

  if !$?.success?
    raise FailedDeployError.new(self, "Buildpack: #{@buildpack.inspect}\nRepo: #{git_repo}", output: output)
  end

  if releases.last["status"] == "failed"
    commit! # An empty commit allows us to deploy again
    raise FailedReleaseError.new(self, "Buildpack: #{@buildpack.inspect}\nRepo: #{git_repo}", output: output)
  end

  return output
end