This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ApplicationHelper | |
def ul(opts={}, &block) | |
ListBuilder.new(@template, block, opts) | |
end | |
def ul_nav(&block) | |
ul(:class => 'nav', &block) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If we ever end up running God / Starling on other environments than production. | |
# we'll have to find a different way to set the values below. | |
STARLING_PORT = 15151 | |
STARLING_HOST = '<my ip address>' | |
RAILS_ENV = 'production' | |
# Based on example from <http://railscasts.com/episodes/130-monitoring-with-god> | |
RAILS_ROOT = '/var/www/myapp' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'daemons' | |
# This is a bit hacky, but we don't have a clean way to hook into the parsed | |
# options, as Daemons is managing these internally. | |
number = 0 | |
for i in 0..ARGV.length | |
if ARGV[i] == '--number' | |
number = ARGV[i + 1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%table | |
%tr | |
%th name | |
%th date | |
%th status | |
- @contexts.each do |context| | |
%tr{:id => "context_#{context.id}"} | |
%td.name= h(context.name) | |
%td.created_at= context.created_at.to_s(:short) | |
%td.status= link_to context.state_status, "##{context.id}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" | |
"http://www.w3.org/TR/html4/strict.dtd"> | |
<html lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<title>index</title> | |
<meta name="generator" content="TextMate http://macromates.com/"> | |
<meta name="author" content="Aaron Gibralter"> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.2.3/jquery.min.js" type="text/javascript" charset="utf-8"></script> | |
</head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ... | |
if defined?(PhusionPassenger) | |
PhusionPassenger.on_event(:starting_worker_process) do |forked| | |
if forked | |
Rails.cache.instance_variable_get(:@data).reset if Rails.cache.class == ActiveSupport::Cache::MemCacheStore | |
ActionController::Base.session_options[:cache].reset | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def reset_session_id | |
saved_session_data = self.session | |
reset_session | |
self.session = saved_session_data | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SomeMiddleware | |
def initialize(app, session_key) | |
@app = app | |
end | |
def call(env) | |
env['myapp.myvar'] = :something | |
@app.call(env) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "#{File.dirname(__FILE__)}/../vendor/bundler_gems/environment" | |
module Rails | |
class Boot | |
def run | |
load_initializer | |
extend_environment | |
Rails::Initializer.run(:set_load_path) | |
end | |
def extend_environment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on http://yehudakatz.com/2009/11/03/using-the-new-gem-bundler-today/ | |
# Instead of hooking into load_environment which breaks gems that assume a | |
# certain load order (which is bad in its own right, but a reality), I hook | |
# into load_gems... This way, gems that assume load order but work with | |
# config.gem will still work with bundler. | |
require "#{File.dirname(__FILE__)}/../vendor/bundler_gems/environment" | |
module Rails | |
class Boot |