Skip to content

Instantly share code, notes, and snippets.

View dcuddeback's full-sized avatar

David Cuddeback dcuddeback

  • Boulder, Colorado, United States
View GitHub Profile
@dcuddeback
dcuddeback / gist:1893965
Created February 23, 2012 17:39
Enabling ci_reporter with parallel_tests
# The way the parallel_tests gem loads the test suite is incompatible with how ci_reporter loads the
# test suite. This module reconciles the difference by recognizing when ci_reporter is expected to
# be loaded and then doing it.
module ParallelCIReporter
# Sets up ci_reporter if necessary.
def self.setup_ci_reporter
install_mediator if ci_reporter?
end
@dcuddeback
dcuddeback / scheduled_job.rb
Created January 27, 2012 01:34 — forked from kares/scheduled_job.rb
Recurring Job using Delayed::Job
#
# Recurring Job using Delayed::Job
#
# Setup Your job the "plain-old" DJ (perform) way, include this module
# and Your handler will re-schedule itself every time it succeeds.
#
# Sample :
#
# class MyJob
# include Delayed::ScheduledJob
@dcuddeback
dcuddeback / after_commit_with_transactional_fixtures.rb
Created August 25, 2011 01:36
Patch ActiveRecord to fire after_commit callbacks at the appropriate time during tests with transactional fixtures.
module ActiveRecord
module ConnectionAdapters
module DatabaseStatements
#
# Run the normal transaction method; when it's done, check to see if there
# is exactly one open transaction. If so, that's the transactional
# fixtures transaction; from the model's standpoint, the completed
# transaction is the real deal. Send commit callbacks to models.
#
# If the transaction block raises a Rollback, we need to know, so we don't
class Capybara::Selenium::Driver < Capybara::Driver::Base
def resynchronize
yield
if options[:resynchronize]
Capybara.timeout(options[:resynchronization_timeout], self, "failed to resynchronize, ajax request timed out") do
!ajaxing?
end
end
end
#!/usr/bin/env bash
{
DEFAULT="\033[0m"
CYAN="\033[0;36m"
ruby_string="1.9.2"
gemset_name=$(git remote show -n origin | grep -i url | head -n 1 | sed 's;.*/;;g' | sed 's;\.git$;;')
# setup RVM environment
{
# script contents go here
} >&2
if ! gem list | grep -q bundler; then
gem install bundler
fi
/usr/local/lib/site_ruby/1.8/rubygems.rb:779:in `report_activate_error': Could not find RubyGem bundler (>= 0) (Gem::LoadError)
from /usr/local/lib/site_ruby/1.8/rubygems.rb:214:in `activate'
from /usr/local/lib/site_ruby/1.8/rubygems.rb:1082:in `gem'
from /usr/bin/bundle:18
if ! command -v bundle ; then
gem install bundler
fi
gemset_name=$(git remote show -n origin | grep -i url | head -n 1 | sed 's;.*/;;g' | sed 's;\.git$;;')