Class: Merb::BootLoader::BuildFramework
- Inherits:
-
Merb::BootLoader
- Object
- Merb::BootLoader
- Merb::BootLoader::BuildFramework
- Defined in:
- lib/merb-core/bootloader.rb
Overview
Build the framework paths.
By default, the following paths will be used:
- application
-
Merb.root/app/controller/application.rb
- config
-
Merb.root/config
- lib
-
Merb.root/lib
- log
-
Merb.root/log
- view
-
Merb.root/app/views
- model
-
Merb.root/app/models
- controller
-
Merb.root/app/controllers
- helper
-
Merb.root/app/helpers
- mailer
-
Merb.root/app/mailers
- part
-
Merb.root/app/parts
To override the default, set Merb::Config in your initialization file. Merb::Config takes a Hash whose key is the name of the path, and whose values can be passed into Merb.push_path (see Merb.push_path for full details).
Notes
All paths will default to Merb.root, so you can get a flat-file structure by doing Merb::Config = {}.
Example
Merb::Config[:framework] = {
:view => Merb.root / "views",
:model => Merb.root / "models",
:lib => Merb.root / "lib",
:public => [Merb.root / "public", nil]
:router => [Merb.root / "config", "router.rb"]
}
That will set up a flat directory structure with the config files and controller files under Merb.root, but with models, views, and lib with their own folders off of Merb.root.
Class Method Summary collapse
-
.build_framework ⇒ Object
This method should be overridden in init.rb before Merb.start to set up a different framework structure.
-
.run ⇒ Object
Builds the framework directory structure.
Methods inherited from Merb::BootLoader
after, after_app_loads, before, before_app_loads, default_framework, finished?, inherited, move_klass
Class Method Details
.build_framework ⇒ Object
This method should be overridden in init.rb before Merb.start to set up a different framework structure.
227 228 229 230 231 232 233 234 235 236 237 238 239 |
# File 'lib/merb-core/bootloader.rb', line 227 def build_framework if File.exists?(Merb.root / "config" / "framework.rb") require Merb.root / "config" / "framework" elsif File.exists?(Merb.root / "framework.rb") require Merb.root / "framework" else Merb::BootLoader.default_framework end (Merb::Config[:framework] || {}).each do |name, path| path = Array(path) Merb.push_path(name, path.first, path.length == 2 ? path[1] : "**/*.rb") end end |
.run ⇒ Object
Builds the framework directory structure.
221 222 223 |
# File 'lib/merb-core/bootloader.rb', line 221 def run build_framework end |