Module: RailsDrivers::Setup

Included in:
Railtie
Defined in:
lib/rails_drivers/setup.rb

Constant Summary collapse

DRIVER_PATHS =
%w[
  app
  app/assets
  app/models
  app/views
  app/controllers
  app/mailers
  config/initializers
  db db/migrate
  lib
].freeze

Instance Method Summary collapse

Instance Method Details

#setup_pathsObject

This allows Rails to find models, views, controllers, etc inside of drivers.



20
21
22
23
24
25
26
27
28
# File 'lib/rails_drivers/setup.rb', line 20

def setup_paths
  # This REPLACE_DEFAULT_PATH_WITH_DRIVER constant gets defined by bin/driver when we want
  # to run a command in the context of a driver instead of the main rails app.
  if defined?(REPLACE_DEFAULT_PATH_WITH_DRIVER)
    replace_rails_paths_with_driver(REPLACE_DEFAULT_PATH_WITH_DRIVER)
  else
    add_every_driver_to_rails_paths
  end
end