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
#!/bin/bash | |
# How to exit if any command in a bash subshell fails with piping all output | |
set -o pipefail | |
( | |
set -o errexit; | |
echo -n "T"; | |
# false; | |
echo -n "e"; | |
# false; | |
echo -n "s"; |
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
# Helper to execute blocks of shell commands via capistrano run | |
def run_chunk(cmd,options={}) | |
run cmd.split("\n").map {|l| l.strip }.join(" "), options | |
end | |
# Example | |
task :revision, :roles => [:app] do | |
run_chunk %Q{ | |
cd #{current_release}; | |
cp REVISION public/REVISION; |
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
#migration to allow nulls for Authlogic Account Activation Tutorial | |
#http://www.claytonlz.com/index.php/2009/07/authlogic-account-activation-tutorial/ | |
class AllowNullCryptedPassword < ActiveRecord::Migration | |
def self.up | |
change_column :users, :crypted_password, :string, :null => true | |
change_column :users, :password_salt, :string, :null => true | |
end | |
def self.down |
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 | |
# based on http://gist.github.com/29838 | |
# logging to syslog added | |
# added killing orphaned procs | |
# added culling applications to maintain some per application limits | |
# Find bloating passengers and kill them gracefully. Run from cron every so often. | |
# | |
require "rubygems" | |
require "logging" |
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
namespace :bundler do | |
task :install do | |
run("#{sudo} gem install bundler --source=http://gemcutter.org") | |
end | |
task :symlink_vendor do | |
shared_gems = File.join(shared_path, 'vendor/gems') | |
release_gems = "#{release_path}/vendor/gems/" | |
%w(cache gems specifications).each do |sub_dir| | |
shared_sub_dir = File.join(shared_gems, sub_dir) |
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
# Allows Tasks that have no servers to be skipped instead of raising a NoMatchingServersError | |
module Capistrano | |
class Configuration | |
module Connections | |
def execute_on_servers(options={}) | |
raise ArgumentError, "expected a block" unless block_given? | |
if task = current_task | |
servers = find_servers_for_task(task, options) |
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
# bundle update vendor/bundler_gems | |
# Sources | |
source "http://gemcutter.org" | |
source "http://gems.github.com" | |
# Stack | |
gem "rails", "2.3.4" | |
gem "rack", "1.0.1" | |
gem 'mysql', "2.7" |
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
describe Api::ApiController, "base controller" do | |
integrate_views | |
before(:all) do | |
$api_token = User.first.single_access_token | |
end | |
after(:all) do | |
ApplicationGlobals.subscriber = subscriber = Subscriber.find(0) | |
subscriber.create_default_preferences! unless subscriber.preferences_set? |
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
boot.rb patches the initialzer to memoize the Bundler.require | |
the preinitializer runs | |
The environment.rb is loaded | |
logging is required before the Rails::Initializer.run |
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
group :development, :test do | |
gem 'ruby-debug' | |
gem "rspec-rails", ">= 2.0.0.beta.17" | |
end |
OlderNewer