class HerokuBuilder::Deployment

Public Instance Methods

checkout(branch) click to toggle source
# File lib/heroku_builder/deployment.rb, line 25
def checkout(branch)
  git.fetch
  git.checkout(branch)
  git.pull('origin', branch)
end
deploy(name, branch, environment) click to toggle source
# File lib/heroku_builder/deployment.rb, line 20
def deploy(name, branch, environment)
  checkout(branch)
  push(name, branch, environment)
end
git() click to toggle source
# File lib/heroku_builder/deployment.rb, line 16
def git
  @git ||= Git.open('.', log: Logger.new(STDOUT))
end
push(name, branch, environment) click to toggle source
# File lib/heroku_builder/deployment.rb, line 8
def push(name, branch, environment)
  remote_branch = "heroku-#{environment}"
  unless remote_exists?(remote_branch)
    git.add_remote(remote_branch, App.new.app(name)['git_url'])
  end
  git.push(remote_branch, "#{branch}:master", force: true)
end
remote_exists?(branch) click to toggle source
# File lib/heroku_builder/deployment.rb, line 4
def remote_exists?(branch)
  git.remotes.any? { |remote| remote.name == branch }
end