0
# Startup Merb by setting up the Config and starting the server.
0
+ # This is where Merb application environment and root path are set.
0
Merb.environment = Merb::Config[:environment]
0
Merb.root = Merb::Config[:merb_root]
0
- Merb::Server.start(Merb::Config[:port], Merb::Config[:cluster])
0
+ case Merb::Config[:action]
0
+ Merb::Server.kill(Merb::Config[:port], 1)
0
+ Merb::Server.kill(Merb::Config[:port], 9)
0
+ Merb::Server.start(Merb::Config[:port], Merb::Config[:cluster])
0
# Start the Merb environment, but only if it hasn't been loaded yet.
0
# Restart the Merb environment explicitly.
0
attr_accessor :environment, :load_paths, :adapter
0
alias :env :environment
0
Merb.load_paths = Hash.new { [Merb.root] } unless Merb.load_paths.is_a?(Hash)
0
# This is the core mechanism for setting up your application layout
0
# merb-core won't set a default application layout, but merb-more will
0
- # use the app/:type layout
that is in use in Merb 0.5.0
+ # use the app/:type layout
:0
+ # app/models for models
0
+ # app/mailers for mailers (special type of controllers)
0
+ # app/parts for parts, Merb components
0
+ # app/views for templates
0
+ # app/controllers for controller
0
+ # This method gives you a way to build up your own application
0
+ # structure, for instance, to reflect the structure Rails
0
+ # uses to simplify transition of legacy application, you can
0
+ # set it up like this:
0
+ # Merb.push_path(:models, Merb.root / "app" / "models", "**/*.rb")
0
+ # Merb.push_path(:mailers, Merb.root / "app" / "models", "**/*.rb")
0
+ # Merb.push_path(:controllers, Merb.root / "app" / "controllers", "**/*.rb")
0
+ # Merb.push_path(:views, Merb.root / "app" / "views", "**/*.rb")
0
# type<Symbol>:: The type of path being registered (i.e. :view)
0
# path<String>:: The full path
0
load_paths[type] = [path, file_glob]
0
+ # Removes given types of application components
0
+ # from load path Merb uses for autoloading.
0
+ # *args<Array(Symbol)>::
0
+ # components names, for instance, :views, :models
0
+ # Using this combined with Merb::GlobalHelpers.push_path
0
+ # you can make your Merb application use legacy Rails
0
+ # application components.
0
+ # Merb.root = "path/to/legacy/app/root"
0
+ # Merb.remove_paths(:mailers)
0
+ # Merb.push_path(:mailers, Merb.root / "app" / "models", "**/*.rb")
0
+ # Will make Merb use app/models for mailers just like Ruby on Rails does.
0
def remove_paths(*args)
0
args.each {|arg| load_paths.delete(arg)}
0
- # String::
The directory that contains the log file.
0
+ # String::
Path to directory that contains the log file.
0
case Merb::Config[:log_file]
0
when String then File.dirname(Merb::Config[:log_file])
0
- # String:: The
root directory of the Merb framework.
0
+ # String:: The
path of root directory of the Merb framework.
0
def framework_root() @framework_root ||= File.dirname(__FILE__) end
0
+ # Regular expression against which deferred actions
0
+ # are matched by Rack application handler.
0
+ # Concatenates :deferred_actions configuration option
0
if Merb::Config[:deferred_actions].empty?
0
/#{Merb::Config[:deferred_actions].join("|")}/
0
# Allows flat apps by setting no default framework directories and yielding
0
# name<~to_s>:: Name of the session type to register.
0
# file<String>:: The file that defines this session type.
0
# description<String>:: An optional description of the session type.
0
+ # Merb currently supports memory, cookie and memcache session
0
def register_session_type(name, file, description = nil)
0
@registered_session_types ||= Dictionary.new
0
@registered_session_types[name] = {
0
# Boolean:: True if Merb is running via script/frozen-merb or other freezer.
0
+ # Freezing means bundling framework libraries with your application
0
+ # making it independent from environment it runs in. This is a good
0
+ # practice to freeze application framework and gems it uses and
0
+ # very useful when application is run in some sort of sandbox,
0
+ # for instance, shared hosting with preconfigured gems.
0
# Used by script/frozen-merb and other freezers to mark Merb as frozen.
0
+ # See Merb::GlobalHelpers.frozen? for more details on framework freezing.
0
# Load configuration and assign logger.
0
# options<Hash>:: Options to pass on to the Merb config.
0
+ # :host<String>:: host to bind to,
0
+ # :port<Fixnum>:: port to run Merb application on,
0
+ # :adapter<String>:: name of Rack adapter to use,
0
+ # :reload_classes<Boolean>:: whether Merb should reload
0
+ # classes on each request,
0
+ # :environment<String>:: name of environment to use,
0
+ # default is development
0
+ # :merb_root<String>:: Merb application root,
0
+ # :use_mutex<Boolean>:: turns action dispatch synchronization
0
+ # on or off, default is on (true)
0
+ # :session_id_key<String>:: session identifier,
0
+ # default is _session_id
0
+ # :log_delimiter<String>:: what Merb logger uses as delimiter
0
+ # between message sections, default is " ~ "
0
+ # :log_auto_flush<Boolean>:: whether the log should automatically
0
+ # flush after new messages are
0
+ # added, defaults to true.
0
+ # :log_file<IO>:: IO for logger. Default is STDOUT.
0
+ # :log_level<Symbol>:: logger level, default is :warn
0
+ # :disabled_components<Array[Symbol]>::
0
+ # array of disabled component names,
0
+ # for instance, to disable json gem,
0
+ # specify :json. Default is empty array.
0
+ # :deferred_actions<Array(Symbol, String)]>::
0
+ # names of actions that should be deferred
0
+ # no matter what controller they belong to.
0
+ # Default is empty array.
0
+ # Some of these options come from command line on Merb
0
+ # application start, some of them are set in Merb init file
0
+ # or environment-specific.
0
def load_config(options = {})
0
Merb::Config.setup({ :log_file => STDOUT, :log_level => :warn, :log_auto_flush => true }.merge(options))
0
Merb::BootLoader::Logger.run
0
# Load all basic dependencies (selected BootLoaders only).
0
Merb::BootLoader::Dependencies.run
0
Merb::BootLoader::BeforeAppRuns.run
0
- # Reload the framework.
0
+ # Reload application and framework classes.
0
+ # See Merb::BootLoader::ReloadClasses for details.
0
Merb::BootLoader::ReloadClasses.reload
0
- # Boolean:: True if Merb is running via spec_helper.rb or other TEST scenario.
0
+ # Boolean:: True if Merb environment is testing for instance,
0
+ # Merb is running with RSpec, Test::Unit of other testing facility.
0
$TESTING || Merb::Config[:testing]
0
# Ask the question about which environment you're in.
0
# env<Symbol, String>:: Name of the environment to query
0
# Merb.env #=> production
0
# Merb.env?(:production) #=> true
0
# Hash:: The current configuration.
0
+ # See Merb::GlobalHelpers.load_config for configuration
0
# session_secret_key "0d05a226affa226623eb18700"
0
# exception_details true
0
Merb::Config.configure(&block) if block_given?
0
# Disables the given core components, like a Gem for example.
0
def disable(*components)
0
disabled_components.push *components
0
# Array:: All components that should be disabled.
0
def disabled_components=(components)
0
disabled_components.replace components
0
# Array:: All components that have been disabled.
0
def disabled_components
0
Merb::Config[:disabled_components] ||= []
0
# Boolean:: True if all components (or just one) are disabled.
0
def disabled?(*components)
0
components.all? { |c| disabled_components.include?(c) }
0
- # Array:: All Rakefiles for plugins.
0
+ # Array(String):: Paths Rakefiles are loaded from.
0
+ # Recommended way to find out what paths Rakefiles
0
@rakefiles ||= ['merb-core/test/tasks/spectasks']
0
- # *rakefiles:: Rakefiles to add to the list of plugin Rakefiles.
0
+ # *rakefiles:: Rakefile pathss to add to the list of Rakefiles.
0
+ # Recommended way to add Rakefiles load path for plugins authors.
0
def add_rakefiles(*rakefiles)
0
@rakefiles ||= ['merb-core/test/tasks/spectasks']
0
@rakefiles += rakefiles