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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details



54
55
56
57
58
59
60
61
# File 'lib/console_kit/console_helpers.rb', line 54

def print_tenant_details(tenant, constants)
  ConsoleKit::Output.print_header("Tenant: #{tenant}")
  DETAIL_LABELS.each do |label, key|
    next unless constants.key?(key)

    ConsoleKit::Output.print_info("  #{label.ljust(13)}#{constants[key]}")
  end
end

Instance Method Details

#dashboardObject



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

def dashboard
  ConsoleKit::Connections::Dashboard.display
  self
end

#switch_tenantObject



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

def switch_tenant
  ConsoleKit.reset_current_tenant
  self
end

#tenant_infoObject



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

def tenant_info
  tenant = ConsoleKit::Setup.current_tenant
  return no_tenant_warning unless tenant

  display_tenant_info(tenant)
  nil
end

#tenantsObject



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

def tenants
  names = ConsoleKit.configuration.tenants&.keys || []
  print_available_tenants(names)
  names
end