Class: TinyRails::Commands::Console

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions, Actions
Defined in:
lib/tiny-rails/commands/console.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Actions

#addon, #application, #enable_asset_pipeline!, #gem, #initializer, #migration, #route

Class Method Details

.source_rootObject

TODO: Move to a base command



8
9
10
# File 'lib/tiny-rails/commands/console.rb', line 8

def self.source_root
  "#{File.expand_path('../../../../templates', __FILE__)}/"
end

Instance Method Details

#guard_inside_tiny_rails_appObject



12
13
14
15
16
17
# File 'lib/tiny-rails/commands/console.rb', line 12

def guard_inside_tiny_rails_app
  unless File.exists?('boot.rb')
    puts "Can't start console from outside a TinyRails application, please change to a TinyRails application directory first.\n"
    exit(1)
  end
end

#start_consoleObject



19
20
21
22
23
# File 'lib/tiny-rails/commands/console.rb', line 19

def start_console
  require './boot.rb'
  require 'rails/commands/console'
  Rails::Console.start(TinyRailsApp)
end