Module: ConsoleKit::ConsoleHelpers

Defined in:
lib/console_kit/console_helpers.rb

Overview

Helper methods available in the Rails console

Constant Summary collapse

DETAIL_LABELS =
{
  'Partner' => :partner_code, 'Shard' => :shard, 'Mongo DB' => :mongo_db,
  'Redis DB' => :redis_db, 'ES Prefix' => :elasticsearch_prefix, 'Environment' => :environment
}.freeze

Instance Method Summary collapse

Instance Method Details

#dashboardObject



19
# File 'lib/console_kit/console_helpers.rb', line 19

def dashboard = ConsoleKit::Connections::Dashboard.display

#switch_tenantObject



6
# File 'lib/console_kit/console_helpers.rb', line 6

def switch_tenant = ConsoleKit.reset_current_tenant

#tenant_infoObject



8
9
10
11
12
13
14
15
16
17
# File 'lib/console_kit/console_helpers.rb', line 8

def tenant_info
  tenant = ConsoleKit::Setup.current_tenant
  unless tenant
    ConsoleKit::Output.print_warning('No tenant is currently configured.')
    return
  end

  constants = ConsoleKit.configuration.tenants[tenant]&.[](:constants) || {}
  print_tenant_details(tenant, constants)
end

#tenantsObject



21
22
23
24
25
# File 'lib/console_kit/console_helpers.rb', line 21

def tenants
  names = ConsoleKit.configuration.tenants&.keys || []
  ConsoleKit::Output.print_list(names, header: 'Available Tenants')
  names
end