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
# RAILSLOVE.com template | |
# | |
# with help and ideas from: | |
# http://gist.github.com/33337 By Peter Cooper | |
# http://github.com/jeremymcanally/rails-templates/tree/master/suspenders.rb Suspenders by Thoughtbot Nathan Esquenazi | |
if yes?("symlink local rails copy to vendor?") | |
path = ask("what's the directory of your local rails copy?") | |
inside('vendor') { run "ln -s #{path} rails" } |
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 'cucumber/rake/task' | |
namespace :cucumber do | |
Cucumber::Rake::Task.new(:webrat) do |t| | |
t.fork = true # Explicitly fork for cucumber 0.3.4 and rails | |
t.cucumber_opts = "--format progress" | |
t.step_list = %w{features/support/env.rb features/support/webrat.rb features/step_definitions} | |
t.feature_list = %w{features/webrat} | |
end | |
task :webrat => 'db:test:prepare' |
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
module SimpleCachingTTL | |
CACHETIME = 24 * 3600 # Once per day | |
def cache(text, path) | |
FileUtils.mkdir_p(File.dirname(path)) | |
File.open(path, 'w') { |f| f.write( text ) } | |
text | |
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
module I18n | |
module Backend | |
class SnippetBackend < Simple | |
protected | |
def init_translations | |
load_translations(*I18n.load_path.flatten) | |
load_translations_from_database | |
@initialized = true | |
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
# download and git methods swiped from http://github.com/Sutto/rails-template/blob/07b044072f3fb0b40aea27b713ca61515250f5ec/rails_template.rb | |
require 'open-uri' | |
def download(from, to = from.split("/").last) | |
#run "curl -s -L #{from} > #{to}" | |
file to, open(from).read | |
rescue | |
puts "Can't get #{from} - Internet down?" | |
exit! |
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
# download, from_repo, and commit_state methods swiped from | |
# http://github.com/Sutto/rails-template/blob/07b044072f3fb0b40aea27b713ca61515250f5ec/rails_template.rb | |
require 'open-uri' | |
def download(from, to = from.split("/").last) | |
#run "curl -s -L #{from} > #{to}" | |
file to, open(from).read | |
rescue | |
puts "Can't get #{from} - Internet 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
# paste into .irbrc | |
require 'benchmark' | |
def time(&block) | |
result = nil | |
Benchmark.bm do |bm| | |
bm.report { result = yield } | |
end | |
result |
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 'rubygems' | |
require 'spork' | |
Spork.prefork do | |
# Sets up the Rails environment for Cucumber | |
ENV["RAILS_ENV"] ||= "cucumber" | |
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment') | |
require 'webrat' |
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
# Sets up a Rails app with Cucumber (Rspec, Webrat, Factorygirl), | |
# Authlogic and Haml | |
# Also copies polished(?) config files and some basic step definitions | |
gem "rspec", :version => ">= 1.2.6", :lib => 'spec' | |
gem "rspec-rails", :version => ">= 1.2.6", :lib => 'spec/rails' | |
gem "cucumber", :version => ">= 0.3.9" | |
gem "thoughtbot-factory_girl", :lib => "factory_girl", :source => "http://gems.github.com" | |
gem "webrat", :version => ">= 0.4.3" | |
gem "Selenium", :version => ">= 1.1.14", :lib => 'selenium' |
OlderNewer