Skip to content

Commit

Permalink
[Resolves #41] Add console welcome message
Browse files Browse the repository at this point in the history
- updated custom console to include welcome message
  • Loading branch information
rpbaltazar authored May 11, 2020
2 parents 49acd70 + 0385703 commit c5703b4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/apartment/console.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions lib/apartment/custom_console.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ module CustomConsole
end

Pry.config.prompt = Pry::Prompt[:ros][:value]
Pry.config.hooks.add_hook(:when_started, "startup message") do
tenant_info_msg
end
end
end
end

0 comments on commit c5703b4

Please sign in to comment.