Sha256: 63006fb3dfe46de14f2b9f569a25d1913362e1e9d8d988491fb9c18add35855c

Contents?: true

Size: 1.76 KB

Versions: 8

Compression:

Stored size: 1.76 KB

Contents

require 'commander'
require_relative './environments'
require_relative './fetch_emails'

class CreateHerokuApp
  ADMIN_EMAIL = 'admin@renuo.ch'.freeze

  def initialize; end

  def run(args)
    project_name = args[0]
    abort('>> No project name given.') unless project_name
    emails = FetchEmails.new.fetch_emails

    say "# Commands to setup your Heroku application\n".colorize :green
    ENVIRONMENTS.each do |env|
      print_environment_commands(emails, env, project_name)
    end
    print_pipelines_commands(project_name)
  end

  private

  def print_environment_commands(emails, env, project_name)
    heroku_name = "#{project_name}-#{env}"
    say "heroku apps:create --region eu #{heroku_name}"
    say "heroku domains:add #{heroku_name}.renuoapp.ch --app #{heroku_name}"
    say "heroku addons:create heroku-postgresql  --app #{heroku_name}"
    say "heroku addons:create papertrail --app #{heroku_name}"
    say "heroku labs:enable runtime-dyno-metadata --app #{heroku_name}"
    say "heroku pg:backups:schedule DATABASE_URL --at '02:00 Europe/Zurich' --app #{heroku_name}"
    print_ownership_commands(emails, heroku_name)
  end

  def print_pipelines_commands(project_name)
    say "heroku pipelines:create #{project_name} --app #{project_name}-#{MASTER} -s production"
    say "heroku pipelines:add #{project_name} --app #{project_name}-#{DEVELOP} -s staging"
    say "heroku pipelines:add #{project_name} --app #{project_name}-#{TESTING} -s staging"
    say "\n"
  end

  def print_ownership_commands(emails, heroku_name)
    say "\n"
    emails.each do |email|
      say "heroku access:add #{email} --app #{heroku_name}"
    end
    say "heroku access:add #{ADMIN_EMAIL} --app #{heroku_name}"
    say "heroku apps:transfer -a #{heroku_name} #{ADMIN_EMAIL}"
    say "\n"
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
renuo-cli-2.0.0 lib/renuo/cli/app/create_heroku_app.rb
renuo-cli-1.8.0 lib/renuo/cli/app/create_heroku_app.rb
renuo-cli-1.7.3 lib/renuo/cli/app/create_heroku_app.rb
renuo-cli-1.7.2 lib/renuo/cli/app/create_heroku_app.rb
renuo-cli-1.7.1 lib/renuo/cli/app/create_heroku_app.rb
renuo-cli-1.7.0 lib/renuo/cli/app/create_heroku_app.rb
renuo-cli-1.6.0 lib/renuo/cli/app/create_heroku_app.rb
renuo-cli-1.5.0 lib/renuo/cli/app/create_heroku_app.rb