forked from wycats/merb-core
/
bootloading.dox
57 lines (52 loc) · 3 KB
/
bootloading.dox
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
The Merb boot process starts when you run the Merb binary, which calls `Merb.start`. Merb.start performs the
following tasks:
list.
* Loads merb.yml from the root directory or config directory and puts them in the Merb::Config hash
* Parses config arguments from the command-line and adds them to the Merb::Config hash
* Runs the BootLoaders (see below)
* Starts the Merb Rack adapter
The BootLoader is a configurable process, which, by default, runs the following processes:
deflist.
Environment: Sets the Merb environment based on any -e flag passed the merb binary
BuildFramework: Set the framework paths, which can either be set in the Merb::Config[:framework]
variable or defaults to the paths described below.
Dependencies: Load dependencies.rb, which should include any plugins that will be loaded, as well
as an after_app_loaded hook.
Logger: Set up the logger in the `Merb.dir_for(:log)` directory. In test mode, it will be called
`test_logger`. In other modes, it will be set to `merb.#{pid}.log`. The log level will default
to `info` but can be specified via the Merb::Config[:log_level] option.
LoadRouter: The router is loaded from `Merb.dir_for(:config)/router.rb`.
LoadClasses: Files in all of the load paths are `require`d, and classes added during the load of
each files are tracked so they can be removed later during the reloading process.
Templates: All templates under the `_template_root` of any loaded controllers, as well as all
templates under `Merb.dir_for(:view)` are registered as inlined templates.
MimeTypes: Register all MimeTypes (see below for defaults).
AfterAppLoads: Call any `after_app_loads` hooks that were registered in dependencies.rb
MixinSessionContainer: Register the session types and set the app to use one if
`Merb::Config[:session_type]` is set.
ChooseAdapter: Set `Merb.adapter` to be the adapter chosen via Merb::Config[:adapter] (which
can be specified via the `-a foo` command-line parameter).
RackUpApplication: Set up a default rack application. Alternatively, allow for additional configuration
in `Merb.dir_for(:config)/rack.rb`, which will be evaluated in the context of a Rack::Builder.new
block.
ReloadClasses: If Merb::Config[:reload_classes] is set, begin the process of reloading classes
every time a class is modified.
deflist: Default Framework Paths.
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
deflist: MimeTypes.
\:all: no transform, */*
\:yaml: to_yaml, application/x-yaml or text/yaml
\:text: to_text, text/plain
\:html: to_html, text/html or application/xhtml+xml or application/html
\:xml: to_xml, application/xml or text/xml or application/x-xml, adds "Encoding: UTF-8" response header
\:js: to_json, text/javascript ot application/javascript or application/x-javascript
\:json: to_json, application/json or text/x-json