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 'right_aws' | |
s3_credentials = { | |
:source_key => "...", | |
:source_secret => "...", | |
:source_bucket => "...", | |
:destination_key => "...", | |
:destination_secret => "...", | |
:destination_bucket => "..." | |
} |
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
### Show stack trace for 500 errors | |
### (adapted from https://gist.github.com/1079020) | |
# Given an application, yield to a block to handle exceptions | |
class ExceptionRaiserApp | |
def initialize(app) | |
@app = app | |
end | |
def call(env) |
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
# spec/requests/page_cache_spec.rb | |
require 'spec_helper' | |
describe "Page cache" do | |
# Testing with local cache instead of Memcached for speed | |
before(:each) do | |
ActionController::Base.perform_caching = true | |
ActionController::Base.cache_store = :file_store, "tmp/cache" | |
FileUtils.rm_rf(Dir['tmp/cache']) |
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 'net/telnet' | |
cache_dump_limit = 100 | |
localhost = Net::Telnet::new("Host" => "localhost", "Port" => 11211, "Timeout" => 3) | |
slab_ids = [] | |
localhost.cmd("String" => "stats items", "Match" => /^END/) do |c| | |
matches = c.scan(/STAT items:(\d+):/) | |
slab_ids = matches.flatten.uniq | |
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
#!/bin/sh | |
set_path="cd /home/rails/my_app/current" | |
case "$1" in | |
start) | |
echo -n "Starting delayed_job: " | |
su - rails -c "$set_path; RAILS_ENV=production script/delayed_job start" >> log/delayed_job.log 2>&1 | |
echo "done." | |
;; | |
stop) |
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
guard 'spork', :rspec_env => { 'RAILS_ENV' => 'test' }, :wait => 60, :notify_on_start => true do | |
watch('config/application.rb') | |
watch('config/environment.rb') | |
watch(%r{^config/environments/.+\.rb$}) | |
watch(%r{^config/initializers/.+\.rb$}) | |
watch('Gemfile') | |
watch('Gemfile.lock') | |
watch('spec/spec_helper.rb') { :rspec } | |
watch(%r{^spec/support/(requests|controllers|mailers|models)_helpers\.rb}) { :rspec } | |
watch(%r{^spec/acceptance/support/(.*)\.rb}) { :rspec } |
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
RSpec.configure do |config| | |
config.around do |example| | |
# For examples using capybara-webkit for example. | |
# Remove this if you don't use it or anything similar | |
if example.metadata[:js] | |
example.run | |
ActiveRecord::Base.connection.tables.each do |table| | |
ActiveRecord::Base.connection.execute("TRUNCATE TABLE #{table};") | |
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
# https://gist.github.com/1623632 | |
# bundler bootstrap | |
require 'bundler/capistrano' | |
# main details | |
set :application, "123" | |
role :web, "#{application}.cloud.voupe.net" # #{application}.cloud.voupe.net | |
role :app, "#{application}.cloud.voupe.net" | |
role :db, "#{application}.cloud.voupe.net", :primary => true |
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
# Add these two gems | |
gem 'ice_cube', '0.9.3' | |
gem 'squeel', '1.0.16' |