class Hyperloop::Railtie::Options
Public Instance Methods
auto_config=(on)
click to toggle source
Calls superclass method
# File lib/hyperloop/rail_tie.rb, line 13 def auto_config=(on) Rails.configuration.tap do |config| if [:on, 'on', true].include?(on) config.eager_load_paths += %W(#{config.root}/app/hyperloop/models) config.eager_load_paths += %W(#{config.root}/app/hyperloop/models/concerns) config.eager_load_paths += %W(#{config.root}/app/hyperloop/operations) # rails will add everything immediately below app to eager and auto load, so we need to remove it delete_first config.eager_load_paths, "#{config.root}/app/hyperloop" unless Rails.env.production? config.autoload_paths += %W(#{config.root}/app/hyperloop/models) config.autoload_paths += %W(#{config.root}/app/hyperloop/models/concerns) config.autoload_paths += %W(#{config.root}/app/hyperloop/operations) # config.eager_load_paths += %W(#{config.root}/app/hyperloop/stores) # config.autoload_paths += %W(#{config.root}/app/hyperloop/stores) delete_first config.autoload_paths, "#{config.root}/app/hyperloop" end # possible alternative way in conjunction with below # %w[stores operations models components].each do |hp| # hps = ::Rails.root.join('app', 'hyperloop', hp).to_s # config.assets.paths.delete(hps) # config.assets.paths.unshift(hps) # end config.assets.paths.unshift ::Rails.root.join('app', 'hyperloop').to_s if Rails.const_defined? 'Hyperloop::Console' config.assets.precompile += %w( hyper-console-client.css ) config.assets.precompile += %w( hyper-console-client.min.js ) config.assets.precompile += %w( action_cable.js ) if Rails.const_defined? 'ActionCable' end else delete_first config.eager_load_paths, "#{config.root}/app/hyperloop/models" delete_first config.eager_load_paths, "#{config.root}/app/hyperloop/models/concerns" delete_first config.autoload_paths, "#{config.root}/app/hyperloop/models" delete_first config.autoload_paths, "#{config.root}/app/hyperloop/models/concerns" # delete_first config.eager_load_paths, "#{config.root}/app/hyperloop/stores" # delete_first config.autoload_paths, "#{config.root}/app/hyperloop/stores" delete_first config.eager_load_paths, "#{config.root}/app/hyperloop/operations" delete_first config.autoload_paths, "#{config.root}/app/hyperloop/operations" delete_first config.assets.paths, ::Rails.root.join('app', 'hyperloop').to_s end end super end
delete_first(a, e)
click to toggle source
# File lib/hyperloop/rail_tie.rb, line 9 def delete_first(a, e) a.delete_at(a.index(e) || a.length) end