Class: Consolle::RailsCommands

Inherits:
Thor
  • Object
show all
Defined in:
lib/consolle/cli.rb

Overview

Rails convenience commands subcommand

Instance Method Summary collapse

Instance Method Details

#dbObject



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/consolle/cli.rb', line 34

def db
  code = <<~RUBY
    config = ActiveRecord::Base.connection_db_config
    puts "Adapter:  \#{config.adapter}"
    puts "Database: \#{config.database}"
    puts "Host:     \#{config.host || 'localhost'}" if config.respond_to?(:host)
    puts "Pool:     \#{config.pool}" if config.respond_to?(:pool)
    puts "Connected: \#{ActiveRecord::Base.connected?}"
    nil
  RUBY
  execute_rails_code(code)
end

#envObject



29
30
31
# File 'lib/consolle/cli.rb', line 29

def env
  execute_rails_code('Rails.env')
end

#reloadObject



24
25
26
# File 'lib/consolle/cli.rb', line 24

def reload
  execute_rails_code('reload!')
end