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
@deepthawtz
deepthawtz / compare_gems.sh
Created February 19, 2009 12:01 — forked from rkh/compare_gems.sh
Merb on Ruby 1.9.1
#!/bin/bash
gem1.8 list --local --no-versions > 1.8.txt
gem1.9 list --local --no-versions > 1.9.txt
diff gem1.8.txt gem1.9.txt
@deepthawtz
deepthawtz / gist:71797
Created February 28, 2009 00:28
Merb::Server.daemonize
def daemonize(port)
Merb.logger.warn! "About to fork..." if Merb::Config[:verbose]
fork do
Process.setsid
exit if fork
Merb.logger.warn! "In #{Process.pid}" if Merb.logger
File.umask 0000
STDIN.reopen "/dev/null"
STDOUT.reopen "/dev/null", "a"
STDERR.reopen STDOUT
#!/usr/bin/env ruby
require 'rubygems'
require 'merb-core'
ARGV.push '-H' if ARGV[0] && ARGV[0] =~ /^[^-]/
unless %w[-a --adapter -i --irb-console -r --script-runner].any? { |o| ARGV.index(o) }
ARGV.push *%w[-a mongrel]
end
# Merb::Config wrapped in a class << self (uses optparse)
# Returns the hash of default config values for Merb.
#
# ==== Returns
# Hash:: The defaults for the config.
#
# :api: private
def defaults
@defaults ||= {
# ==== Returns
# Boolean:: True if Merb environment is testing for instance,
# Merb is running with RSpec, Test::Unit of other testing facility.
#
# :api: public
def testing?
$TESTING ||= env?(:test) || Merb::Config[:testing]
end
# ... snip ...
# Set up the logger.
#
# Place the logger inside of the Merb log directory (set up in
# Merb::BootLoader::BuildFramework)
class Merb::BootLoader::Logger < Merb::BootLoader
# Sets Merb.logger to a new logger created based on the config settings.
#
# ==== Returns
# nil
# Adds the inheriting class to the list of subclasses in a position
# specified by the before and after methods.
#
# ==== Parameters
# klass<Class>:: The class inheriting from Merb::BootLoader.
#
# ==== Returns
# nil
#
# :api: plugin
# Execute this boot loader after the specified boot loader.
#
# ==== Parameters
# klass<~to_s>::
# The boot loader class after which this boot loader should be run.
#
# ==== Returns
# nil
#
# :api: plugin
# Load Slice classes before the app's classes are loaded.
#
# This allows the application to override/merge any slice-level classes.
class Merb::Slices::Loader < Merb::BootLoader
before LoadClasses
class << self
# Gather all slices from search path and gems and load their classes.
# 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