This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
| // Tip: You can go to any result in preview by pressiong ctrl+alt+[result number] | |
| CmdUtils.makeSearchCommand({ | |
| name: ["rails","rails-search"], | |
| homepage: "http://rafagarcia.net/", | |
| author: { name: "Rafa Garcia", email: "rgo@aspgems.com"}, | |
| license: "GPL", | |
| url: "http://apidock.com/rails/search/?query={QUERY}", | |
| description: _("Searches Ruby on Rails terms in Apidock.com"), | |
| icon: "http://apidock.com/images/rails_icon_16.png", | |
| parser: { |
OlderNewer