Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # This is the mechanism for setting up your application layout.
- # There are three application layouts in Merb:
- #
- # 1. Regular app/:type layout of Ruby on Rails fame:
- #
- # app/models for models
- # app/mailers for mailers (special type of controllers)
- # app/parts for parts, Merb components
- # app/views for templates
- # app/controllers for controller
- # lib for libraries
- #
- # 2. Flat application layout:
- #
- # application.rb for models, controllers, mailers, etc
- # config/init.rb for initialization and router configuration
- # config/framework.rb for framework and dependencies configuration
- # views for views
- #
- # 3. Camping-style "very flat" application layout, where the whole Merb
- # application and configs are contained within a single file.
- #
- # ==== Notes
- # Autoloading for lib uses an empty glob by default. If you
- # want to have your libraries under lib use autoload, add
- # the following to Merb init file:
- #
- # Merb.push_path(:lib, Merb.root / "lib", "**/*.rb") # glob set explicity.
- #
- # Then lib/magicwand/lib/magicwand.rb with MagicWand module will
- # be autoloaded when you first access that constant.
- #
- # ==== Examples
- # This method gives you a way to build up your own application
- # structure, for instance, to reflect the structure Rails
- # uses to simplify transition of legacy application, you can
- # set it up like this:
- #
- # Merb.push_path(:model, Merb.root / "app" / "models", "**/*.rb")
- # Merb.push_path(:mailer, Merb.root / "app" / "models", "**/*.rb")
- # Merb.push_path(:controller, Merb.root / "app" / "controllers", "**/*.rb")
- # Merb.push_path(:view, Merb.root / "app" / "views", "**/*.rb")
- #
- # ==== Parameters
- # type<Symbol>:: The type of path being registered (i.e. :view)
- # path<String>:: The full path
- # file_glob<String>::
- # A glob that will be used to autoload files under the path. Defaults to
- # "**/*.rb".
- #
- # @api public
- def push_path(type, path, file_glob = "**/*.rb")
- enforce!(type => Symbol)
- load_paths[type] = [path, file_glob]
- end
Add Comment
Please, Sign In to add comment