module MorpheusHeroku::Deploy

Constants

DEPLOY_ENV

Public Instance Methods

production() click to toggle source
# File lib/morpheus-heroku/deploy.rb, line 7
def production
  fetch_active_remotes!
  ensure_local_remote_is_up_to_date!
  deploy_to_heroku!
  run_database_migrations!
  restart_server!
  tag_release!
  update_git!
end

Private Instance Methods

deploy_to_heroku!() click to toggle source
# File lib/morpheus-heroku/deploy.rb, line 31
def deploy_to_heroku!
  Helper.bash_run(command: "git push heroku #{git_branch}:master --force")
end
ensure_local_remote_is_up_to_date!() click to toggle source
# File lib/morpheus-heroku/deploy.rb, line 27
def ensure_local_remote_is_up_to_date!
  Helper.bash_run(command: "git pull origin #{git_branch}")
end
fetch_active_remotes!() click to toggle source
# File lib/morpheus-heroku/deploy.rb, line 19
def fetch_active_remotes!
  Helper.bash_run(command: "git fetch")
end
git_branch() click to toggle source
# File lib/morpheus-heroku/deploy.rb, line 23
def git_branch
  @branch ||= `git branch | grep -e "^*"`.strip.gsub("* ", "")
end
restart_server!() click to toggle source
# File lib/morpheus-heroku/deploy.rb, line 51
def restart_server!
  Helper.heroku_run(command: "heroku restart")
end
run_database_migrations!() click to toggle source
# File lib/morpheus-heroku/deploy.rb, line 35
def run_database_migrations!
  Helper.heroku_run(command: "heroku run rake db:migrate")
end
tag_name() click to toggle source
# File lib/morpheus-heroku/deploy.rb, line 43
def tag_name
  "heroku_#{DEPLOY_ENV}_#{Time.now.to_s(:db).gsub(/[- :]/, "_")}"
end
tag_release!() click to toggle source
# File lib/morpheus-heroku/deploy.rb, line 39
def tag_release!
  Helper.bash_run(command: "git tag #{tag_name}")
end
update_git!() click to toggle source
# File lib/morpheus-heroku/deploy.rb, line 47
def update_git!
  Helper.bash_run(command: "git push origin --tags")
end