lib/mountain_view/engine.rb in mountain_view-0.8.1 vs lib/mountain_view/engine.rb in mountain_view-0.9.0

- old
+ new

@@ -1,16 +1,20 @@ require "rails" -require "mountain_view" -require "mountain_view/component" module MountainView class Engine < ::Rails::Engine isolate_namespace MountainView initializer "mountain_view.components_path" do |app| MountainView.configure do |c| c.components_path ||= app.root.join("app", "components") end + end + + initializer "mountain_view.load_component_classes", + before: :set_autoload_paths do |app| + component_paths = "#{MountainView.configuration.components_path}/{*}" + app.config.autoload_paths += Dir[component_paths] end initializer "mountain_view.assets" do |app| Rails.application.config.assets.paths << MountainView.configuration.components_path