module Commands::Create

Public Instance Methods

create( app_id = Services::AppConfig.get_or_exit('app'), environment_name = Services::AppConfig.get('environment') ) click to toggle source
# File lib/busbar_cli/commands/create.rb, line 24
def create(
  app_id = Services::AppConfig.get_or_exit('app'),
  environment_name = Services::AppConfig.get('environment')
)
  Services::Kube.configure_temporary_profile(options.profile)

  if environment_name.nil? || AppsRepository.find(app_id: app_id).nil?
    Services::AppCreator.call(
      id: app_id,
      buildpack_id: options.buildpack_id,
      repository: options.repository,
      default_branch: options.branch,
      default_env: environment_name,
      environment: nil # Was environment_attributes - changed to comply with server side variable
    )
  else
    Services::EnvironmentCreator.call(
      app_id: app_id,
      name: environment_name,
      buildpack_id: options.buildpack_id,
      public: options.public,
      default_branch: options.branch,
      settings: nil
    )
  end

  puts 'Done!'
end