Skip to content

Instantly share code, notes, and snippets.

View deepthawtz's full-sized avatar
👩‍🎤
singin'

Dylan Clendenin deepthawtz

👩‍🎤
singin'
  • Venmo
  • San Francisco, CA
View GitHub Profile
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)
# 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
# ==== Parameters
# type<Symbol>:: The type of path to retrieve directory for, e.g. :view.
#
# ==== Returns
# String:: The directory for the requested type.
#
# :api: public
def dir_for(type)
Merb.load_paths[type].first
end
# ==== Parameters
# *path::
# The relative path (or list of path components) to a directory under the
# root of the application.
#
# ==== Returns
# String:: The full path including the root.
#
# ==== Examples
# Merb.root = "/home/merb/app"
class Merb::BootLoader::Dependencies < Merb::BootLoader
# ==== Returns
# Array[Gem::Dependency]:: The dependencies registered in init.rb.
#
# :api: plugin
cattr_accessor :dependencies
self.dependencies = []
# Load the init_file specified in Merb::Config or if not specified, the
class Merb::BootLoader::MixinSession < Merb::BootLoader
# Mixin the session functionality; this is done before BeforeAppLoads
# so that SessionContainer and SessionStoreContainer can be subclassed by
# plugin session stores for example - these need to be loaded in a
# before_app_loads block or a BootLoader that runs after MixinSession.
#
# Note: access to Merb::Config is needed, so it needs to run after
# Merb::BootLoader::Dependencies is done.
#
class Merb::BootLoader::BeforeAppLoads < Merb::BootLoader
# Call any before_app_loads hooks that were registered via before_app_loads
# in any plugins.
#
# ==== Returns
# nil
#
# :api: plugin
def self.run
# ==== Parameters
# io<#path>:: An IO containing the full path of the template.
# name<String>:: The name of the method that will be created.
# locals<Array[Symbol]>:: A list of locals to assign from the args passed into the compiled template.
# mod<Module>:: The module that the compiled method will be placed into.
#
# :api: private
def self.compile_template(io, name, locals, mod)
template = ::Erubis::BlockAwareEruby.new(io.read)
_old_verbose, $VERBOSE = $VERBOSE, nil
# Register the default MIME types:
#
# By default, the mime-types include:
# :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
# :js:: to_json, text/javascript ot application/javascript or application/x-javascript
# :json:: to_json, application/json or text/x-json
# Set up cookies support in Merb::Controller and Merb::Request
class Merb::BootLoader::Cookies < Merb::BootLoader
# Set up cookies support in Merb::Controller and Merb::Request
#
# ==== Returns
# nil
#
# :api: plugin
def self.run