Skip to content

Instantly share code, notes, and snippets.

@thoughtbot
thoughtbot / gist:9175
Created September 6, 2008 16:54
Structured git deployment workflow rake tasks.
module GitCommands
class ShellError < RuntimeError; end
@logging = ENV['LOGGING'] != "false"
def self.run cmd, *expected_exitstatuses
puts "+ #{cmd}" if @logging
output = `#{cmd} 2>&1`
puts output.gsub(/^/, "- ") if @logging
expected_exitstatuses << 0 if expected_exitstatuses.empty?
class ApplicationHelperTest < ActionView::TestCase
include ActionController::UrlWriter
default_url_options[:host] = 'localhost'
end
class << Test::Unit::TestCase
def context name, &block
(@contexts ||= []) << name
(@context_blocks ||= []) << block
saved_setups = (@context_setups ||= []).dup
saved_teardowns = (@context_teardowns ||= []).dup
self.instance_eval(&block)
@context_setups = saved_setups
require 'open-uri'

begin

content = open('http://www.isitchristmas.com/').read

rescue *HTTP_ERRORS => exception

HoptoadNotifier.deliver_exception(exception)

content = 'Christmas is canceled'

end
qrush@crookedkey /h/r/g/r/20090513220338> cat /etc/apache2/sites-available/gemcutter.org
<VirtualHost *:80>
ServerName gemcutter.org
ServerAlias www.gemcutter.org
DocumentRoot /home/rails/gemcutter/current/lib/gemcutter/public
LogLevel warn
ErrorLog /home/rails/gemcutter/shared/log/error.log
CustomLog /home/rails/gemcutter/shared/log/access.log combined
</VirtualHost>
$ time rake test:units test:functionals
Started
.......... (abbreviated... FOR BLOG READING SPEED!!)
415 tests, 898 assertions, 0 failures, 0 errors
29.14s user 3.74s system 87% cpu 37.614 total
$ time rake test:units test:functionals
Started
.......... (abbreviated... FOR BLOG READING SPEED!!)
415 tests, 898 assertions, 0 failures, 0 errors
29.14s user 3.74s system 87% cpu 37.614 total
$ time rake test:units test:functionals
Started
.......... (abbreviated... FOR BLOG READING SPEED!!)
415 tests, 898 assertions, 0 failures, 0 errors
29.14s user 3.74s system 87% cpu 37.614 total
$ script/plugin install git://github.com/jasonm/parallel_specs.git
$ rake db:structure:dump
$ echo "create database myapp_test2;" | mysql -uroot
$ mysql -uroot -Dmyapp_test2 < db/development_structure.sql
$ vim config/database.yml # add some ERB to config/database.yml
test:
adapter: mysql
encoding: utf8
database: myapp_test<%= ENV['TEST_ENV_NUMBER'] %>
username: root