Skip to content

Instantly share code, notes, and snippets.

@tompata
tompata / ci_advanced.rake
Created September 10, 2013 17:55
More advanced CI rake tasks for running instant and daily builds with Rspec and Cucumber, Cucumber profiles (different screen sizes), re-run options (for failing tests).
CUCUMBER_PROFILES = %w{desktop mobile tablet_landscape tablet_portrait}
if [ :development, :test, :cucumber ].include?( Rails.env.to_sym )
# the 'require' calls are here on a purpose. On staging the rspec and cucumber gems are not
# present and since rake reads up the content of the .rake files, it will fail, because it
# will try to load things, which are not there
require 'rspec/core/rake_task'
require 'cucumber/rake/task'
namespace :ci do
@tompata
tompata / ci.rake
Created September 10, 2013 17:51
A simple CI rake task for running instant and daily builds with Rspec and Cucumber
if [ :development, :test, :cucumber ].include?( Rails.env.to_sym )
# the 'require' calls are here on a purpose. On staging the rspec and cucumber gems are not
# present and since rake reads up the content of the .rake files, it will fail, because it
# will try to load things, which are not there
require 'rspec/core/rake_task'
require 'cucumber/rake/task'
namespace :ci do
namespace :build do
@tompata
tompata / cucumber.yml
Created September 10, 2013 17:41
Cucumber hook and additional environment config for testing different screen resolutions with Capybara, Poltergeist and PhantomJS
<%
CUCUMBER_PROFILES = %w{desktop mobile tablet_landscape tablet_portrait}
rerun = File.file?('tmp/rerun.txt') ? IO.read('tmp/rerun.txt') : ""
rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --tags ~@wip -r features"
%>
default: <%= std_opts %> features
wip: --tags @wip:3 --wip features
rerun: <%= rerun_opts %> --format rerun --out tmp/rerun.txt --strict --tags ~@wip
@tompata
tompata / deploy.rb
Created January 20, 2011 16:33
extended Capistrano Copy strategy with Bundler
# overwrited Copy strategy
# after source.sync it's running bundler with deployment mode, precompiling gems into vendor/bundle
require 'capistrano/recipes/deploy/strategy/copy'
require 'fileutils'
require 'tempfile'
Capistrano::Deploy::Strategy::Copy.class_eval do
def deploy!
@tompata
tompata / Capfile
Created December 7, 2010 13:26
Capistrano with bundler, cron, daemon settings
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
# Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy' # remove this line to skip loading any of the default tasks
after 'deploy:finalize_code', 'deploy:web:disable'
after 'deploy:start', 'deploy:web:enable'
namespace :deploy do