Class Index [+]

Quicksearch

Merb::BootLoader::BuildFramework

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[:framework] in your initialization file. Merb::Config[:framework] 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[:framework] = {}.

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.

Public Class Methods

build_framework() click to toggle source

Sets up merb paths to support the app’s file layout. First, config/framework.rb is checked, next we look for Merb.root/framework.rb, finally we use the default merb layout (Merb::BootLoader.default_framework)

This method can be overriden to support other application layouts.

Returns

nil

:api: plugin @overridable

     # File lib/merb-core/bootloader.rb, line 323
323:     def build_framework
324:       if File.exists?(Merb.root / "config" / "framework.rb")
325:         require Merb.root / "config" / "framework"
326:       elsif File.exists?(Merb.root / "framework.rb")
327:         require Merb.root / "framework"
328:       else
329:         Merb::BootLoader.default_framework
330:       end
331:       (Merb::Config[:framework] || {}).each do |name, path|
332:         path = Array(path)
333:         Merb.push_path(name, path.first, path.length == 2 ? path[1] : "**/*.rb")
334:       end
335:       nil
336:     end
run() click to toggle source

Builds the framework directory structure.

Returns

nil

:api: plugin

     # File lib/merb-core/bootloader.rb, line 306
306:     def run
307:       $:.push Merb.root unless Merb.root == File.expand_path(Dir.pwd)
308:       STDOUT.puts "Merb root at: #{Merb.root}" unless Merb.testing?
309:       build_framework
310:       nil
311:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.