Module: DataShift::ThorBehavior
- Includes:
- Logging
- Defined in:
- lib/tasks/thor_behaviour.rb
Instance Method Summary collapse
Methods included from Logging
#logdir, #logdir=, #logger, #verbose
Instance Method Details
#start_connections ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/tasks/thor_behaviour.rb', line 11 def start_connections if File.exist?(File.('config/environment.rb')) begin require File.('config/environment.rb') rescue StandardError => e logger.error("Failed to initialise ActiveRecord : #{e.}") raise ConnectionError, "Failed to initialise ActiveRecord : #{e.}" end else raise PathError, 'Are you a RAILS Project ? No config/environment.rb found - cannot initialise ActiveRecord' # TODO: make this more robust ? e.g what about when using active record but not in Rails app, Sinatra etc end end |