class Hyperstack::Railtie::Options
Public Instance Methods
auto_config=(on)
click to toggle source
Calls superclass method
# File lib/hyperstack/rail_tie.rb, line 17 def auto_config=(on) Rails.configuration.tap do |config| if [:on, 'on', true].include?(on) config.eager_load_paths += %W(#{config.root}/app/hyperstack/models) config.eager_load_paths += %W(#{config.root}/app/hyperstack/models/concerns) config.eager_load_paths += %W(#{config.root}/app/hyperstack/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/hyperstack" unless Rails.env.production? config.autoload_paths += %W(#{config.root}/app/hyperstack/models) config.autoload_paths += %W(#{config.root}/app/hyperstack/models/concerns) config.autoload_paths += %W(#{config.root}/app/hyperstack/operations) # config.eager_load_paths += %W(#{config.root}/app/hyperstack/stores) # config.autoload_paths += %W(#{config.root}/app/hyperstack/stores) delete_first config.autoload_paths, "#{config.root}/app/hyperstack" end # possible alternative way in conjunction with below # %w[stores operations models components].each do |hp| # hps = ::Rails.root.join('app', 'hyperstack', hp).to_s # config.assets.paths.delete(hps) # config.assets.paths.unshift(hps) # end config.assets.paths.unshift ::Rails.root.join('app', 'hyperstack').to_s if Rails.const_defined? 'Hyperstack::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/hyperstack/models" delete_first config.eager_load_paths, "#{config.root}/app/hyperstack/models/concerns" delete_first config.autoload_paths, "#{config.root}/app/hyperstack/models" delete_first config.autoload_paths, "#{config.root}/app/hyperstack/models/concerns" # delete_first config.eager_load_paths, "#{config.root}/app/hyperstack/stores" # delete_first config.autoload_paths, "#{config.root}/app/hyperstack/stores" delete_first config.eager_load_paths, "#{config.root}/app/hyperstack/operations" delete_first config.autoload_paths, "#{config.root}/app/hyperstack/operations" delete_first config.assets.paths, ::Rails.root.join('app', 'hyperstack').to_s end end super end
delete_first(a, e)
click to toggle source
# File lib/hyperstack/rail_tie.rb, line 13 def delete_first(a, e) a.delete_at(a.index(e) || a.length) end