class Mdpresent::Heroku

Attributes

heroku[RW]

Public Class Methods

create() click to toggle source
# File lib/mdpresent/heroku.rb, line 39
def create

  # check if git is installed.
  # initialize the repo if not already
  Git.setup_git

  puts "Creating new heroku app..."
  success = Command.execute I18n.t("commands.heroku.create")
  success &&= Command.execute I18n.t("commands.git.initial_add")
  success &&= Command.execute I18n.t("commands.git.initial_commit", date_time: Time.now)
  abort I18n.t("errors.heroku_create_failed") unless success
end
deploy() click to toggle source
# File lib/mdpresent/heroku.rb, line 52
def deploy
  success = Command.execute I18n.t("commands.heroku.deploy")
  abort I18n.t("errors.heroku_deploy_failed") unless success
end
login() click to toggle source
# File lib/mdpresent/heroku.rb, line 25
def login

  # check if heroku remote is already present.
  # return, since heroku create has already been run
  if Git.heroku_remote_present?
    Logger.log("Heroku remote already present. Exiting.")
    puts "Heroku already setup."
    exit 1
  end

  success = Command.execute I18n.t("commands.heroku.login")
  abort I18n.t("errors.heroku_login_failed") unless success
end
open() click to toggle source
# File lib/mdpresent/heroku.rb, line 57
def open
  success = Command.execute I18n.t("commands.heroku.open")
  abort I18n.t("errors.heroku_open_failed") unless success
end
setup() click to toggle source

check that heroku toolbelt is installed heroku login - authenticate with heroku heroku create - create new app and add remote to .git/config

# File lib/mdpresent/heroku.rb, line 11
def setup
  Logger.log("starting the setup...")
  @heroku = Command.path("heroku")
  abort I18n.t :install_heroku_toolbelt unless @heroku

  puts "[S] Found heroku toolbelt..."

  # login to heroku
  login

  # create heroku app
  create
end