Sha256: 374253e903d506010585807cc0d870fba6226e48f5ecd6d7ac656b7c1d61bf14

Contents?: true

Size: 1.35 KB

Versions: 4

Compression:

Stored size: 1.35 KB

Contents

# frozen_string_literal: true

class CreateHerokuApp
  ADMIN_EMAIL = 'operations@renuo.ch'

  def run(args)
    project_name = args[0]
    abort('>> Project name must be between 2 and 22 characters.') unless project_name&.length&.between?(2, 22)

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

  private

  def print_environment_commands(env, project_name)
    heroku_name = "#{project_name}-#{env}"
    say "heroku apps:create --region eu #{heroku_name} -t staff"
    say "heroku domains:add #{heroku_name}.renuoapp.ch --app #{heroku_name}"
    say "heroku domains:add #{project_name}-#{MASTER}.renuoapp.ch --app #{heroku_name}" if env == MAIN
    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}"
  end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
renuo-cli-4.5.0 lib/renuo/cli/app/create_heroku_app.rb
renuo-cli-4.3.0 lib/renuo/cli/app/create_heroku_app.rb
renuo-cli-4.2.1 lib/renuo/cli/app/create_heroku_app.rb
renuo-cli-4.2.0 lib/renuo/cli/app/create_heroku_app.rb