Class: ConsoleKit::TenantOrchestrator

Inherits:
Object
  • Object
show all
Defined in:
lib/console_kit/tenant_orchestrator.rb

Overview

Orchestrates tenant lifecycle, selection, and configuration

Class Method Summary collapse

Class Method Details

.auto_select?Boolean

Returns:

  • (Boolean)


7
# File 'lib/console_kit/tenant_orchestrator.rb', line 7

def auto_select? = (tenants.size == 1) || !$stdin.tty?

.cancel_switchObject



42
# File 'lib/console_kit/tenant_orchestrator.rb', line 42

def cancel_switch = Output.print_warning('Tenant switch cancelled.')

.current_tenantObject



9
# File 'lib/console_kit/tenant_orchestrator.rb', line 9

def current_tenant = Setup.current_tenant

.current_tenant=(val) ⇒ Object



11
12
13
# File 'lib/console_kit/tenant_orchestrator.rb', line 11

def current_tenant=(val)
  Setup.current_tenant = val
end

.reapplyObject



15
16
17
18
19
20
21
22
# File 'lib/console_kit/tenant_orchestrator.rb', line 15

def reapply
  return unless tenant_setup_successful?

  Output.silence do
    TenantConfigurator.current_tenant_key = nil
    TenantConfigurator.configure_tenant(current_tenant)
  end
end

.resetObject



24
25
26
27
28
# File 'lib/console_kit/tenant_orchestrator.rb', line 24

def reset
  return warn_no_tenants unless tenants?

  perform_reset
end

.runObject



30
31
32
33
34
35
36
# File 'lib/console_kit/tenant_orchestrator.rb', line 30

def run
  return if tenant_setup_successful?

  perform_setup
rescue StandardError => e
  handle_error(e)
end

.select_tenant_keyObject



40
# File 'lib/console_kit/tenant_orchestrator.rb', line 40

def select_tenant_key = auto_select? ? tenants.keys.first : TenantSelector.select

.skip_tenant_messageObject



43
# File 'lib/console_kit/tenant_orchestrator.rb', line 43

def skip_tenant_message = Output.print_info('No tenant selected. Loading without tenant configuration.')

.tenantsObject



38
# File 'lib/console_kit/tenant_orchestrator.rb', line 38

def tenants = ConsoleKit.configuration.tenants

.tenants?Boolean

Returns:

  • (Boolean)


39
# File 'lib/console_kit/tenant_orchestrator.rb', line 39

def tenants? = tenants&.any?

.warn_no_tenantsObject



41
# File 'lib/console_kit/tenant_orchestrator.rb', line 41

def warn_no_tenants = Output.print_warning('Cannot reset tenant: No tenants configured.')