From 9e1d18dee3874fcfbdf8565e94b7ce32176d659a Mon Sep 17 00:00:00 2001 From: Jeremiah Date: Thu, 7 May 2020 16:33:28 -0700 Subject: [PATCH 1/4] Update console.rb --- lib/apartment/console.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/apartment/console.rb b/lib/apartment/console.rb index a2ed609f..a8267d58 100644 --- a/lib/apartment/console.rb +++ b/lib/apartment/console.rb @@ -35,3 +35,11 @@ def tenant_list tenant_list += Apartment.tenant_names tenant_list.uniq end + +def tenant_info_msg + log_level = ActiveRecord::Base.logger.level + ActiveRecord::Base.logger.level = :error + puts "Available Tenants: #{tenant_list}\n" + puts "Use `st 'tenant'` to switch tenants & `tenant_list` to see list\n" + ActiveRecord::Base.logger.level = log_level +end From edcc2079abad06b8178a6b47c4fb3ff8a1dd576c Mon Sep 17 00:00:00 2001 From: Jeremiah Date: Thu, 7 May 2020 16:35:06 -0700 Subject: [PATCH 2/4] Update custom_console.rb --- lib/apartment/custom_console.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/apartment/custom_console.rb b/lib/apartment/custom_console.rb index c3c49c5d..6b38223b 100644 --- a/lib/apartment/custom_console.rb +++ b/lib/apartment/custom_console.rb @@ -4,6 +4,7 @@ module Apartment module CustomConsole begin require 'pry-rails' + require 'apartment/console' rescue LoadError # rubocop:disable Rails/Output puts '[Failed to load pry-rails] If you want to use Apartment custom prompt you need to add pry-rails to your gemfile' @@ -21,6 +22,9 @@ module CustomConsole end Pry.config.prompt = Pry::Prompt[:ros][:value] + Pry.config.hooks.add_hook(:when_started, "startup message") do |target, options, pry| + tenant_info_msg + end end end end From 0e934bd0dda88b3b3964df8fedd8035c7c011755 Mon Sep 17 00:00:00 2001 From: Jeremiah Date: Thu, 7 May 2020 16:38:09 -0700 Subject: [PATCH 3/4] Update custom_console.rb --- lib/apartment/custom_console.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/apartment/custom_console.rb b/lib/apartment/custom_console.rb index 6b38223b..e30111ee 100644 --- a/lib/apartment/custom_console.rb +++ b/lib/apartment/custom_console.rb @@ -22,7 +22,7 @@ module CustomConsole end Pry.config.prompt = Pry::Prompt[:ros][:value] - Pry.config.hooks.add_hook(:when_started, "startup message") do |target, options, pry| + Pry.config.hooks.add_hook(:when_started, "startup message") do tenant_info_msg end end From 03857034f5f8667283ab029792a8a5f86378e2e8 Mon Sep 17 00:00:00 2001 From: Jeremiah Date: Thu, 7 May 2020 16:52:46 -0700 Subject: [PATCH 4/4] Update custom_console.rb --- lib/apartment/custom_console.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/apartment/custom_console.rb b/lib/apartment/custom_console.rb index e30111ee..a81b90cc 100644 --- a/lib/apartment/custom_console.rb +++ b/lib/apartment/custom_console.rb @@ -4,7 +4,6 @@ module Apartment module CustomConsole begin require 'pry-rails' - require 'apartment/console' rescue LoadError # rubocop:disable Rails/Output puts '[Failed to load pry-rails] If you want to use Apartment custom prompt you need to add pry-rails to your gemfile'