Commit 07e3a0ebf9832095fc262acb2a805364d1ff7c85

Authored by Luke Baker
2 parents 5d4dda2a 1ff2498c

Merge pull request #20 from vitorbaptista/1ff2498ccd25e6b2c2776cc5f864deae4451fe2e

Upgrading gems so we're able to install in Ubuntu 12.04 without modifications (now with Cucumber!)
Showing 63 changed files with 754 additions and 692 deletions   Show diff stats
1 source :rubygems 1 source :rubygems
2 source "http://gems.github.com" 2 source "http://gems.github.com"
3 3
4 -gem "bundler", "1.0.21" 4 +gem "rake", "~> 0.9.2.2"
  5 +gem "rdoc", "~> 3.12"
  6 +gem "bundler", "~> 1.1.5"
5 gem "rails", "2.3.14" 7 gem "rails", "2.3.14"
6 gem "hoptoad_notifier", "2.4.9" 8 gem "hoptoad_notifier", "2.4.9"
7 gem "ambethia-smtp-tls", "1.1.2", :require => "smtp-tls" 9 gem "ambethia-smtp-tls", "1.1.2", :require => "smtp-tls"
8 -gem "thoughtbot-paperclip", "2.3.1",  
9 - :require => "paperclip" 10 +gem "paperclip", "2.3.1"
10 gem "mime-types", "1.16", 11 gem "mime-types", "1.16",
11 :require => "mime/types" 12 :require => "mime/types"
12 gem "xml-simple", "1.0.12", 13 gem "xml-simple", "1.0.12",
13 :require => "xmlsimple" 14 :require => "xmlsimple"
14 gem "yfactorial-utility_scopes", "0.2.2", 15 gem "yfactorial-utility_scopes", "0.2.2",
15 :require => "utility_scopes" 16 :require => "utility_scopes"
16 -gem "justinfrench-formtastic", "0.2.2",  
17 - :require => "formtastic" 17 +gem "formtastic", "~> 0.2.2"
18 gem "inherited_resources", "1.0.4" 18 gem "inherited_resources", "1.0.4"
19 gem "has_scope", "0.4.2" 19 gem "has_scope", "0.4.2"
20 gem "responders", "0.4.8" 20 gem "responders", "0.4.8"
@@ -22,7 +22,7 @@ gem "thoughtbot-clearance", "0.8.2", @@ -22,7 +22,7 @@ gem "thoughtbot-clearance", "0.8.2",
22 :require => "clearance" 22 :require => "clearance"
23 gem "fastercsv", "1.5.1" 23 gem "fastercsv", "1.5.1"
24 gem "delayed_job", "2.0.6" 24 gem "delayed_job", "2.0.6"
25 -gem "redis", "1.0.7" 25 +gem "redis", "~> 3.0.1"
26 gem "newrelic_rpm", "3.3.0" 26 gem "newrelic_rpm", "3.3.0"
27 27
28 gem "sendgrid", "0.1.4" 28 gem "sendgrid", "0.1.4"
@@ -32,16 +32,15 @@ gem 'mysql2', '0.2.18' @@ -32,16 +32,15 @@ gem 'mysql2', '0.2.18'
32 32
33 33
34 group :cucumber do 34 group :cucumber do
35 - gem 'cucumber', '0.8.5' 35 + gem 'cucumber', '1.1.0'
  36 + gem 'cucumber-rails', '0.3.2'
36 gem 'webrat', "0.5.3" 37 gem 'webrat', "0.5.3"
37 gem 'fakeweb', '1.2.5' 38 gem 'fakeweb', '1.2.5'
38 - gem 'factory_girl', '1.2.3'  
39 end 39 end
40 40
41 group :test do 41 group :test do
42 gem "rspec", "~>1.3.1" 42 gem "rspec", "~>1.3.1"
43 gem "rspec-rails", "1.3.4" 43 gem "rspec-rails", "1.3.4"
44 - gem "factory_girl", "1.2.3"  
45 gem "shoulda", "~>2.10.1" 44 gem "shoulda", "~>2.10.1"
46 gem "jtrupiano-timecop", "0.2.1", 45 gem "jtrupiano-timecop", "0.2.1",
47 :require => "timecop" 46 :require => "timecop"
@@ -49,3 +48,7 @@ group :test do @@ -49,3 +48,7 @@ group :test do
49 gem "jferris-mocha", "0.9.5.0.1241126838", 48 gem "jferris-mocha", "0.9.5.0.1241126838",
50 :require => "mocha" 49 :require => "mocha"
51 end 50 end
  51 +
  52 +group :test, :cucumber do
  53 + gem 'factory_girl', '1.2.3'
  54 +end
@@ -13,22 +13,25 @@ GEM @@ -13,22 +13,25 @@ GEM
13 activesupport (= 2.3.14) 13 activesupport (= 2.3.14)
14 activesupport (2.3.14) 14 activesupport (2.3.14)
15 ambethia-smtp-tls (1.1.2) 15 ambethia-smtp-tls (1.1.2)
16 - builder (2.1.2)  
17 - cucumber (0.8.5)  
18 - builder (~> 2.1.2)  
19 - diff-lcs (~> 1.1.2)  
20 - gherkin (~> 2.1.4)  
21 - json_pure (~> 1.4.3)  
22 - term-ansicolor (~> 1.0.4)  
23 - daemons (1.1.8) 16 + builder (3.0.0)
  17 + cucumber (1.1.0)
  18 + builder (>= 2.1.2)
  19 + diff-lcs (>= 1.1.2)
  20 + gherkin (~> 2.5.0)
  21 + json (>= 1.4.6)
  22 + term-ansicolor (>= 1.0.6)
  23 + cucumber-rails (0.3.2)
  24 + cucumber (>= 0.8.0)
  25 + daemons (1.1.9)
24 delayed_job (2.0.6) 26 delayed_job (2.0.6)
25 daemons 27 daemons
26 diff-lcs (1.1.3) 28 diff-lcs (1.1.3)
27 factory_girl (1.2.3) 29 factory_girl (1.2.3)
28 fakeweb (1.2.5) 30 fakeweb (1.2.5)
29 fastercsv (1.5.1) 31 fastercsv (1.5.1)
30 - gherkin (2.1.5)  
31 - trollop (~> 1.16.2) 32 + formtastic (0.2.5)
  33 + gherkin (2.5.4)
  34 + json (>= 1.4.6)
32 has_scope (0.4.2) 35 has_scope (0.4.2)
33 hoptoad_notifier (2.4.9) 36 hoptoad_notifier (2.4.9)
34 activesupport 37 activesupport
@@ -38,13 +41,14 @@ GEM @@ -38,13 +41,14 @@ GEM
38 responders (~> 0.4.3) 41 responders (~> 0.4.3)
39 jferris-mocha (0.9.5.0.1241126838) 42 jferris-mocha (0.9.5.0.1241126838)
40 rake 43 rake
  44 + json (1.7.4)
41 json_pure (1.4.6) 45 json_pure (1.4.6)
42 jtrupiano-timecop (0.2.1) 46 jtrupiano-timecop (0.2.1)
43 - justinfrench-formtastic (0.2.2)  
44 mime-types (1.16) 47 mime-types (1.16)
45 mysql2 (0.2.18) 48 mysql2 (0.2.18)
46 newrelic_rpm (3.3.0) 49 newrelic_rpm (3.3.0)
47 - nokogiri (1.5.0) 50 + nokogiri (1.5.5)
  51 + paperclip (2.3.1)
48 rack (1.1.3) 52 rack (1.1.3)
49 rails (2.3.14) 53 rails (2.3.14)
50 actionmailer (= 2.3.14) 54 actionmailer (= 2.3.14)
@@ -54,7 +58,9 @@ GEM @@ -54,7 +58,9 @@ GEM
54 activesupport (= 2.3.14) 58 activesupport (= 2.3.14)
55 rake (>= 0.8.3) 59 rake (>= 0.8.3)
56 rake (0.9.2.2) 60 rake (0.9.2.2)
57 - redis (1.0.7) 61 + rdoc (3.12)
  62 + json (~> 1.4)
  63 + redis (3.0.1)
58 responders (0.4.8) 64 responders (0.4.8)
59 rspec (1.3.2) 65 rspec (1.3.2)
60 rspec-rails (1.3.4) 66 rspec-rails (1.3.4)
@@ -67,8 +73,6 @@ GEM @@ -67,8 +73,6 @@ GEM
67 shoulda (2.10.3) 73 shoulda (2.10.3)
68 term-ansicolor (1.0.7) 74 term-ansicolor (1.0.7)
69 thoughtbot-clearance (0.8.2) 75 thoughtbot-clearance (0.8.2)
70 - thoughtbot-paperclip (2.3.1)  
71 - trollop (1.16.2)  
72 webrat (0.5.3) 76 webrat (0.5.3)
73 nokogiri (>= 1.2.0) 77 nokogiri (>= 1.2.0)
74 rack (>= 1.0) 78 rack (>= 1.0)
@@ -81,24 +85,28 @@ PLATFORMS @@ -81,24 +85,28 @@ PLATFORMS
81 85
82 DEPENDENCIES 86 DEPENDENCIES
83 ambethia-smtp-tls (= 1.1.2) 87 ambethia-smtp-tls (= 1.1.2)
84 - bundler (= 1.0.21)  
85 - cucumber (= 0.8.5) 88 + bundler (~> 1.1.5)
  89 + cucumber (= 1.1.0)
  90 + cucumber-rails (= 0.3.2)
86 delayed_job (= 2.0.6) 91 delayed_job (= 2.0.6)
87 factory_girl (= 1.2.3) 92 factory_girl (= 1.2.3)
88 fakeweb (= 1.2.5) 93 fakeweb (= 1.2.5)
89 fastercsv (= 1.5.1) 94 fastercsv (= 1.5.1)
  95 + formtastic (~> 0.2.2)
90 has_scope (= 0.4.2) 96 has_scope (= 0.4.2)
91 hoptoad_notifier (= 2.4.9) 97 hoptoad_notifier (= 2.4.9)
92 inherited_resources (= 1.0.4) 98 inherited_resources (= 1.0.4)
93 jferris-mocha (= 0.9.5.0.1241126838) 99 jferris-mocha (= 0.9.5.0.1241126838)
94 json_pure (= 1.4.6) 100 json_pure (= 1.4.6)
95 jtrupiano-timecop (= 0.2.1) 101 jtrupiano-timecop (= 0.2.1)
96 - justinfrench-formtastic (= 0.2.2)  
97 mime-types (= 1.16) 102 mime-types (= 1.16)
98 mysql2 (= 0.2.18) 103 mysql2 (= 0.2.18)
99 newrelic_rpm (= 3.3.0) 104 newrelic_rpm (= 3.3.0)
  105 + paperclip (= 2.3.1)
100 rails (= 2.3.14) 106 rails (= 2.3.14)
101 - redis (= 1.0.7) 107 + rake (~> 0.9.2.2)
  108 + rdoc (~> 3.12)
  109 + redis (~> 3.0.1)
102 responders (= 0.4.8) 110 responders (= 0.4.8)
103 rspec (~> 1.3.1) 111 rspec (~> 1.3.1)
104 rspec-rails (= 1.3.4) 112 rspec-rails (= 1.3.4)
@@ -106,7 +114,6 @@ DEPENDENCIES @@ -106,7 +114,6 @@ DEPENDENCIES
106 sendgrid (= 0.1.4) 114 sendgrid (= 0.1.4)
107 shoulda (~> 2.10.1) 115 shoulda (~> 2.10.1)
108 thoughtbot-clearance (= 0.8.2) 116 thoughtbot-clearance (= 0.8.2)
109 - thoughtbot-paperclip (= 2.3.1)  
110 webrat (= 0.5.3) 117 webrat (= 0.5.3)
111 xml-simple (= 1.0.12) 118 xml-simple (= 1.0.12)
112 yfactorial-utility_scopes (= 0.2.2) 119 yfactorial-utility_scopes (= 0.2.2)
@@ -5,7 +5,7 @@ require(File.join(File.dirname(__FILE__), 'config', 'boot')) @@ -5,7 +5,7 @@ require(File.join(File.dirname(__FILE__), 'config', 'boot'))
5 5
6 require 'rake' 6 require 'rake'
7 require 'rake/testtask' 7 require 'rake/testtask'
8 -require 'rake/rdoctask' 8 +require 'rdoc/task'
9 9
10 require 'tasks/rails' 10 require 'tasks/rails'
11 11
config/cucumber.yml 0 → 100644
@@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
  1 +<%
  2 +rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
  3 +rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
  4 +std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} --strict --tags ~@wip"
  5 +%>
  6 +default: <%= std_opts %> features
  7 +wip: --tags @wip:3 --wip features
  8 +rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip
config/environments/cucumber.rb
1 -# IMPORTANT: This file was generated by Cucumber 0.4.2  
2 # Edit at your own peril - it's recommended to regenerate this file 1 # Edit at your own peril - it's recommended to regenerate this file
3 # in the future when you upgrade to a newer version of Cucumber. 2 # in the future when you upgrade to a newer version of Cucumber.
4 3
5 -config.cache_classes = true # This must be true for Cucumber to operate correctly! 4 +# IMPORTANT: Setting config.cache_classes to false is known to
  5 +# break Cucumber's use_transactional_fixtures method.
  6 +# For more information see https://rspec.lighthouseapp.com/projects/16211/tickets/165
  7 +config.cache_classes = true
6 8
7 # Log error messages when you accidentally call methods on nil. 9 # Log error messages when you accidentally call methods on nil.
8 config.whiny_nils = true 10 config.whiny_nils = true
@@ -19,9 +21,7 @@ config.action_controller.allow_forgery_protection = false @@ -19,9 +21,7 @@ config.action_controller.allow_forgery_protection = false
19 # ActionMailer::Base.deliveries array. 21 # ActionMailer::Base.deliveries array.
20 config.action_mailer.delivery_method = :test 22 config.action_mailer.delivery_method = :test
21 23
22 -  
23 HOST = "localhost" 24 HOST = "localhost"
24 AUTHORIZE_NET_API_LOGIN_ID = '' 25 AUTHORIZE_NET_API_LOGIN_ID = ''
25 AUTHORIZE_NET_TRANSACTION_KEY = '' 26 AUTHORIZE_NET_TRANSACTION_KEY = ''
26 -ActiveMerchant::Billing::Base.gateway_mode = :test  
27 27
features/step_definitions/factory_girl_steps.rb
@@ -1,33 +0,0 @@ @@ -1,33 +0,0 @@
1 -Given /^the following (.*) exists?:$/ do |factory, table|  
2 - factory = factory.singularize.gsub(' ','_')  
3 - table.hashes.each do |attributes|  
4 - Factory(factory, attributes)  
5 - end  
6 -end  
7 -  
8 -Factory.factories.each do |name, factory|  
9 - if factory.build_class.respond_to?(:columns)  
10 - factory.build_class.columns.each do |column|  
11 - Given %{^an? #{name.to_s.humanize.downcase} exists with an? #{column.name.humanize.downcase} of "([^"]*)"$} do |value|  
12 - Factory(name, column.name => value)  
13 - end  
14 -  
15 - Given %{^an? #{name.to_s.humanize.downcase} exists with an? #{column.name.humanize.downcase} of "([^"]*)" and a "([^"]*)" of "([^"]*)"$} do |first_value, second_column, second_value|  
16 - Factory(name, column.name => value, second_column.downcase.to_sym => second_value)  
17 - end  
18 - end  
19 - end  
20 -  
21 - Given /^an? #{name} exists$/ do  
22 - Factory(name)  
23 - end  
24 -  
25 - Given /^(\d+) #{name.to_s.humanize.downcase.pluralize} exist with an? ([^"]*) of "([^"]*)"$/ do |count, attr, value|  
26 - count.to_i.times { Factory(name, attr.gsub(' ', '_') => value) }  
27 - end  
28 -  
29 - Given %r{^(\d+) #{name.to_s.humanize.downcase.pluralize} exist$} do |count|  
30 - count.to_i.times { Factory(name) }  
31 - end  
32 -end  
33 -  
features/support/env.rb
1 -# IMPORTANT: This file was generated by Cucumber 0.4.2  
2 -# Edit at your own peril - it's recommended to regenerate this file  
3 -# in the future when you upgrade to a newer version of Cucumber.  
4 -# Consider adding your own code to a new file instead of editing this one. 1 +# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
  2 +# It is recommended to regenerate this file in the future when you upgrade to a
  3 +# newer version of cucumber-rails. Consider adding your own code to a new file
  4 +# instead of editing this one. Cucumber will automatically load all features/**/*.rb
  5 +# files.
5 6
6 -# Sets up the Rails environment for Cucumber  
7 ENV["RAILS_ENV"] ||= "cucumber" 7 ENV["RAILS_ENV"] ||= "cucumber"
8 require File.expand_path(File.dirname(__FILE__) + '/../../config/environment') 8 require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
  9 +
  10 +require 'cucumber/formatter/unicode' # Remove this line if you don't want Cucumber Unicode support
  11 +require 'cucumber/rails/rspec'
9 require 'cucumber/rails/world' 12 require 'cucumber/rails/world'
  13 +require 'cucumber/rails/active_record'
  14 +require 'cucumber/web/tableish'
  15 +
  16 +require 'webrat'
  17 +require 'webrat/core/matchers'
  18 +
  19 +Webrat.configure do |config|
  20 + config.mode = :rails
  21 + config.open_error_files = false # Set to true if you want error pages to pop up in the browser
  22 +end
10 23
11 -# If you set this to true, each scenario will run in a database transaction.  
12 -# You can still turn off transactions on a per-scenario basis, simply tagging  
13 -# a feature or scenario with the @no-txn tag.  
14 -#  
15 -# If you set this to false, transactions will be off for all scenarios,  
16 -# regardless of whether you use @no-txn or not.  
17 -#  
18 -# Beware that turning transactions off will leave data in your database  
19 -# after each scenario, which can lead to hard-to-debug failures in  
20 -# subsequent scenarios. If you do this, we recommend you create a Before  
21 -# block that will explicitly put your database in a known state.  
22 -Cucumber::Rails::World.use_transactional_fixtures = true  
23 24
24 # If you set this to false, any error raised from within your app will bubble 25 # If you set this to false, any error raised from within your app will bubble
25 # up to your step definition and out to cucumber unless you catch it somewhere 26 # up to your step definition and out to cucumber unless you catch it somewhere
@@ -32,20 +33,25 @@ Cucumber::Rails::World.use_transactional_fixtures = true @@ -32,20 +33,25 @@ Cucumber::Rails::World.use_transactional_fixtures = true
32 # of your scenarios, as this makes it hard to discover errors in your application. 33 # of your scenarios, as this makes it hard to discover errors in your application.
33 ActionController::Base.allow_rescue = false 34 ActionController::Base.allow_rescue = false
34 35
35 -require 'cucumber'  
36 -# Comment out the next line if you don't want Cucumber Unicode support  
37 -require 'cucumber/formatter/unicode'  
38 -require 'cucumber/webrat/element_locator' # Lets you do table.diff!(element_at('#my_table_or_dl_or_ul_or_ol').to_table)  
39 -  
40 -require 'webrat'  
41 -require 'webrat/core/matchers'  
42 -Webrat.configure do |config|  
43 - config.mode = :rails  
44 - config.open_error_files = false # Set to true if you want error pages to pop up in the browser 36 +# If you set this to true, each scenario will run in a database transaction.
  37 +# You can still turn off transactions on a per-scenario basis, simply tagging
  38 +# a feature or scenario with the @no-txn tag. If you are using Capybara,
  39 +# tagging with @culerity or @javascript will also turn transactions off.
  40 +#
  41 +# If you set this to false, transactions will be off for all scenarios,
  42 +# regardless of whether you use @no-txn or not.
  43 +#
  44 +# Beware that turning transactions off will leave data in your database
  45 +# after each scenario, which can lead to hard-to-debug failures in
  46 +# subsequent scenarios. If you do this, we recommend you create a Before
  47 +# block that will explicitly put your database in a known state.
  48 +Cucumber::Rails::World.use_transactional_fixtures = true
  49 +# How to clean your database when transactions are turned off. See
  50 +# http://github.com/bmabey/database_cleaner for more info.
  51 +if defined?(ActiveRecord::Base)
  52 + begin
  53 + require 'database_cleaner'
  54 + DatabaseCleaner.strategy = :truncation
  55 + rescue LoadError => ignore_if_database_cleaner_not_present
  56 + end
45 end 57 end
46 -  
47 -require 'factory_girl/step_definitions'  
48 -FakeWeb.allow_net_connect = false  
49 -  
50 -Dir[File.join(Rails.root, "test", "support", "**", "*.rb")].each { |file| require(file) }  
51 -  
lib/tasks/cucumber.rake
1 -$LOAD_PATH.unshift(RAILS_ROOT + '/vendor/plugins/cucumber/lib') if File.directory?(RAILS_ROOT + '/vendor/plugins/cucumber/lib') 1 +# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
  2 +# It is recommended to regenerate this file in the future when you upgrade to a
  3 +# newer version of cucumber-rails. Consider adding your own code to a new file
  4 +# instead of editing this one. Cucumber will automatically load all features/**/*.rb
  5 +# files.
  6 +
  7 +
  8 +unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks
  9 +
  10 +vendored_cucumber_bin = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
  11 +$LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil?
2 12
3 begin 13 begin
4 require 'cucumber/rake/task' 14 require 'cucumber/rake/task'
5 15
6 - Cucumber::Rake::Task.new(:features) do |t|  
7 - t.fork = true  
8 - t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'pretty')] 16 + namespace :cucumber do
  17 + Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do |t|
  18 + t.binary = vendored_cucumber_bin # If nil, the gem's binary is used.
  19 + t.fork = true # You may get faster startup if you set this to false
  20 + t.profile = 'default'
  21 + end
  22 +
  23 + Cucumber::Rake::Task.new({:wip => 'db:test:prepare'}, 'Run features that are being worked on') do |t|
  24 + t.binary = vendored_cucumber_bin
  25 + t.fork = true # You may get faster startup if you set this to false
  26 + t.profile = 'wip'
  27 + end
  28 +
  29 + Cucumber::Rake::Task.new({:rerun => 'db:test:prepare'}, 'Record failing features and run only them if any exist') do |t|
  30 + t.binary = vendored_cucumber_bin
  31 + t.fork = true # You may get faster startup if you set this to false
  32 + t.profile = 'rerun'
  33 + end
  34 +
  35 + desc 'Run all features'
  36 + task :all => [:ok, :wip]
  37 + end
  38 + desc 'Alias for cucumber:ok'
  39 + task :cucumber => 'cucumber:ok'
  40 +
  41 + task :default => :cucumber
  42 +
  43 + task :features => :cucumber do
  44 + STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***"
9 end 45 end
10 - task :features => 'db:test:prepare'  
11 rescue LoadError 46 rescue LoadError
12 - desc 'Cucumber rake task not available'  
13 - task :features do 47 + desc 'cucumber rake task not available (cucumber not installed)'
  48 + task :cucumber do
14 abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin' 49 abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
15 end 50 end
16 end 51 end
  52 +
  53 +end
spec/factories.rb
1 -Factory.define(:item) do |f|  
2 - f.sequence(:data) { |i| "Item #{i}" }  
3 -end  
4 -  
5 -  
6 Factory.define(:question) do |f| 1 Factory.define(:question) do |f|
7 f.sequence(:name) { |i| "Name #{i}" } 2 f.sequence(:name) { |i| "Name #{i}" }
8 f.site {|s| s.association(:user)} 3 f.site {|s| s.association(:user)}
@@ -99,16 +94,3 @@ Factory.define(:appearance_new_user, :parent =&gt; :appearance) do |f| @@ -99,16 +94,3 @@ Factory.define(:appearance_new_user, :parent =&gt; :appearance) do |f|
99 f.voter {|a| Factory.build(:visitor, :site => a.question.site)} 94 f.voter {|a| Factory.build(:visitor, :site => a.question.site)}
100 end 95 end
101 96
102 -Factory.sequence :email do |n|  
103 - "user#{n}@example.com"  
104 -end  
105 -  
106 -Factory.define :user do |user|  
107 - user.email { Factory.next :email }  
108 - user.password { "password" }  
109 - user.password_confirmation { "password" }  
110 -end  
111 -  
112 -Factory.define :email_confirmed_user, :parent => :user do |user|  
113 - user.email_confirmed { true }  
114 -end  
vendor/cache/builder-2.1.2.gem
No preview for this file type
vendor/cache/builder-3.0.0.gem 0 → 100644
No preview for this file type
vendor/cache/cucumber-0.8.5.gem
No preview for this file type
vendor/cache/cucumber-1.1.0.gem 0 → 100644
No preview for this file type
vendor/cache/cucumber-rails-0.3.2.gem 0 → 100644
No preview for this file type
vendor/cache/daemons-1.1.8.gem
No preview for this file type
vendor/cache/daemons-1.1.9.gem 0 → 100644
No preview for this file type
vendor/cache/formtastic-0.2.5.gem 0 → 100644
No preview for this file type
vendor/cache/gherkin-2.1.5.gem
No preview for this file type
vendor/cache/gherkin-2.5.4.gem 0 → 100644
No preview for this file type
vendor/cache/json-1.7.4.gem 0 → 100644
No preview for this file type
vendor/cache/justinfrench-formtastic-0.2.2.gem
No preview for this file type
vendor/cache/nokogiri-1.5.0.gem
No preview for this file type
vendor/cache/nokogiri-1.5.5.gem 0 → 100644
No preview for this file type
vendor/cache/paperclip-2.3.1.gem 0 → 100644
No preview for this file type
vendor/cache/rdoc-3.12.gem 0 → 100644
No preview for this file type
vendor/cache/redis-1.0.7.gem
No preview for this file type
vendor/cache/redis-3.0.1.gem 0 → 100644
No preview for this file type
vendor/cache/thoughtbot-paperclip-2.3.1.gem
No preview for this file type
vendor/cache/trollop-1.16.2.gem
No preview for this file type
vendor/plugins/jrails/lib/tasks/jrails.rake 0 → 100644
@@ -0,0 +1,19 @@ @@ -0,0 +1,19 @@
  1 +namespace :jrails do
  2 + namespace :update do
  3 + desc "Copies the jQuery and jRails javascripts to public/javascripts"
  4 + task :javascripts do
  5 + puts "Copying files..."
  6 + project_dir = RAILS_ROOT + '/public/javascripts/'
  7 + scripts = Dir[File.join(File.dirname(__FILE__), '..') + '/javascripts/*.js']
  8 + FileUtils.cp(scripts, project_dir)
  9 + puts "files copied successfully."
  10 + end
  11 + end
  12 +
  13 + namespace :install do
  14 + desc "Installs the jQuery and jRails javascripts to public/javascripts"
  15 + task :javascripts do
  16 + Rake::Task['jrails:update:javascripts'].invoke
  17 + end
  18 + end
  19 +end
vendor/plugins/jrails/tasks/jrails.rake
@@ -1,19 +0,0 @@ @@ -1,19 +0,0 @@
1 -namespace :jrails do  
2 - namespace :update do  
3 - desc "Copies the jQuery and jRails javascripts to public/javascripts"  
4 - task :javascripts do  
5 - puts "Copying files..."  
6 - project_dir = RAILS_ROOT + '/public/javascripts/'  
7 - scripts = Dir[File.join(File.dirname(__FILE__), '..') + '/javascripts/*.js']  
8 - FileUtils.cp(scripts, project_dir)  
9 - puts "files copied successfully."  
10 - end  
11 - end  
12 -  
13 - namespace :install do  
14 - desc "Installs the jQuery and jRails javascripts to public/javascripts"  
15 - task :javascripts do  
16 - Rake::Task['jrails:update:javascripts'].invoke  
17 - end  
18 - end  
19 -end  
vendor/plugins/limerick_rake/MIT-LICENSE
@@ -17,4 +17,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -17,4 +17,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 17 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 18 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 19 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  
21 \ No newline at end of file 20 \ No newline at end of file
  21 +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
vendor/plugins/limerick_rake/README.md 0 → 100644
@@ -0,0 +1,166 @@ @@ -0,0 +1,166 @@
  1 +Limerick Rake
  2 +=============
  3 +
  4 +A collection of useful rake tasks.
  5 +
  6 +To use in a Rails app, in your Gemfile:
  7 +
  8 + gem 'limerick_rake'
  9 +
  10 +DEPRECATED
  11 +----------
  12 +
  13 +We no longer use `limerick_rake`, and as such no longer maintain it. If you
  14 +wish to take over the project please email <support@thoughtbot.com>.
  15 +
  16 +Database
  17 +--------
  18 +
  19 +Read tasks/database.rake for details for configuration.
  20 +
  21 + rake db:bootstrap:load # Load initial database fixtures (in db/bootstrap/*.yml) into the current environment's database. Load specific fixtures using FIXTURES=x,y
  22 + rake db:indexes:missing # Prints a list of unindexed foreign keys so you can index them.
  23 + rake db:shell # Launches the database shell using the values defined in config/database.yml.
  24 + rake db:validate_models # Run model validations on all model records in database.
  25 + rake db:recreate # Recreate database with seeds (drop, create, migrate and seed)
  26 +
  27 +Git
  28 +---
  29 +
  30 + rake git:push:staging # Merge a branch into the origin/staging branch.
  31 + rake git:push:production # Merge the staging branch into origin/production for launch.
  32 + rake git:diff:staging # Show the difference between current branch and origin/staging.
  33 + rake git:diff:production # Show the difference between origin/staging and origin/production.
  34 + rake git:pull:suspenders # Pull updates from suspenders, the thoughtbot rails template.
  35 + rake git:branch:production #Branch origin/production into BRANCH locally.
  36 +
  37 +Backup
  38 +------
  39 +
  40 + rake backup:db # Backup the current database. Timestamped file is created as :rails_root/../db-name-timestamp.sql
  41 + rake backup:assets # Backup all assets under public/system. File is created as :rails_root/../system.tgz
  42 +
  43 +Haml & Sass
  44 +-----------
  45 +
  46 + rake sass:all_css2sass # Convert all CSS files in public/stylesheets to Sass.
  47 + rake sass:all_sass2css # Convert all Sass files to CSS.
  48 + rake haml:all_html2haml # Convert all HTML files to Haml.
  49 +
  50 +Rails 2+
  51 +--------
  52 +
  53 + rake rails_two:rename_views # Renames all .rhtml views to .html.erb, .rjs to .js.rjs, .rxml to .xml.builder and .haml to .html.haml.
  54 +
  55 +Subversion
  56 +----------
  57 +
  58 + rake svn:add # Adds all files with an svn status flag of '?'
  59 + rake svn:delete # Deletes all files with an svn status flag of '!'
  60 + rake svn:log # Writes the log file to doc/svn_log.txt
  61 + rake svn:update\_svn\_ignore # Updates svn:ignore from .svnignore
  62 +
  63 +Test Coverage
  64 +-------------
  65 +
  66 +Install rcov from http://github.com/mergulhao/rcov
  67 +
  68 + rake test:coverage # Uses rcov to provide reports about test coverage of your application.
  69 +
  70 +Mass Assignment
  71 +---------------
  72 +
  73 +From "mhartl":http://github.com/mhartl/find_mass_assignment
  74 +
  75 + rake find_mass_assignment
  76 +
  77 +The Limerick Rake
  78 +=================
  79 +
  80 +Traditional Irish song. [YouTube](http://www.youtube.com/v/e8moLHIW8xw)
  81 +
  82 + I am a young fellow that's easy and bold,
  83 + In Castletown conners I'm very well known.
  84 + In Newcastle West I spent many a note,
  85 + With Kitty and Judy and Mary.
  86 +
  87 + My father rebuked me for being such a rake,
  88 + And spending me time in such frolicsome ways,
  89 + But I ne'er could forget the good nature of Jane,
  90 + Agus fágaimíd siúd mar atá sé.
  91 +
  92 + My parents had reared me to shake and to mow,
  93 + To plough and to harrow, to reap and to sow.
  94 + But my heart being airy to drop it so low,
  95 + I set out on high speculation.
  96 +
  97 + On paper and parchment they taught me to write,
  98 + In Euclid and grammar they opened my eyes,
  99 + And in multiplication in truth I was bright,
  100 + Agus fágaimíd siúd mar atá sé.
  101 +
  102 + If I chance for to go to the town of Rathkeale,
  103 + The girls all round me do flock on the square.
  104 + Some give me a bottle and others sweet cakes,
  105 + To treat me unknown to their parents.
  106 +
  107 + There is one from Askeaton and one from the Pike,
  108 + Another from Arda, my heart was beguiled,
  109 + Tho' being from the mountains her stockings are white,
  110 + Agus fágaimíd siúd mar atá sé.
  111 +
  112 + To quarrel for riches I ne'er was inclined,
  113 + For the greatest of misers that must leave all behind.
  114 + I'll purchase a cow that will never run dry,
  115 + And I'll milk her by twisting her horn.
  116 +
  117 + John Damer of Shronel had plenty of gold,
  118 + And Lord Devonshire's treasures are twenty times more,
  119 + But he's laid on his back among nettles and stones,
  120 + Agus fágaimíd siúd mar atá sé.
  121 +
  122 + The old cow could be milked without clover or grass,
  123 + She'd be pampered with corn, good barley and hops.
  124 + She's warm and stout, and she's free in the paps,
  125 + And she'll milk without spancil or halter.
  126 +
  127 + The man that will drink it will cock his caubeen,
  128 + And if anyone laughs there'd be wigs on the green,
  129 + And the feeble old hag will get supple and free,
  130 + Agus fágaimíd siúd mar atá sé.
  131 +
  132 + There's some say I'm foolish and more say I'm wise,
  133 + But being fond of the women I think is no crime,
  134 + For the son of King David had ten hundred wives,
  135 + And his wisdom was highly regarded.
  136 +
  137 + I'll take a good garden and live at my ease,
  138 + And each woman and child can partake of the same,
  139 + If there'd be war in the cabin, themselves they'd be to blame,
  140 + Agus fágaimíd siúd mar atá sé.
  141 +
  142 + And now for the future I mean to be wise,
  143 + And I'll send for the women that acted so kind,
  144 + I'd marry them all on the morrow by and by,
  145 + If the clergy agree to the bargain.
  146 +
  147 + And when I'd be old and my soul is at peace,
  148 + These women will crowd for to cry at my wake,
  149 + And their sons and their daughters will offer their prayer,
  150 + To the Lord for the soul of their father.
  151 +
  152 +Credits
  153 +-------
  154 +
  155 +![thoughtbot](http://thoughtbot.com/images/tm/logo.png)
  156 +
  157 +Limerick Rake is maintained and funded by [thoughtbot, inc](http://thoughtbot.com/community)
  158 +
  159 +Thank you to all [the contributors](https://github.com/thoughtbot/limerick_rake/contributors)!
  160 +
  161 +The names and logos for thoughtbot are trademarks of thoughtbot, inc.
  162 +
  163 +License
  164 +-------
  165 +
  166 +Limerick Rake is Copyright © 2008-2011 thoughtbot. It is free software, and may be redistributed under the terms specified in the LICENSE file.
vendor/plugins/limerick_rake/README.textile
@@ -1,140 +0,0 @@ @@ -1,140 +0,0 @@
1 -Limerick Rake  
2 -=============  
3 -  
4 -A collection of useful rake tasks.  
5 -  
6 -To use in a Rails app:  
7 -  
8 - script/plugin install git://github.com/thoughtbot/limerick_rake.git  
9 -  
10 -h2. Database  
11 -  
12 -Read tasks/database.rake for details for configuration.  
13 -  
14 -* rake db:bootstrap:load - Load initial database fixtures (in db/bootstrap/*.yml) into the current environment's database. Load specific fixtures using FIXTURES=x,y  
15 -* rake db:indexes:missing - Prints a list of unindexed foreign keys so you can index them.  
16 -* rake db:shell - Launches the database shell using the values defined in config/database.yml.  
17 -* rake db:validate_models - Run model validations on all model records in database.  
18 -  
19 -h2. Git  
20 -  
21 -* rake git:push:staging - Merge a branch into the origin/staging branch.  
22 -* rake git:push:production - Merge the staging branch into origin/production for launch.  
23 -* rake git:diff:staging - Show the difference between current branch and origin/staging.  
24 -* rake git:diff:production - Show the difference between origin/staging and origin/production.  
25 -* rake git:pull:suspenders - Pull updates from suspenders, the thoughtbot rails template.  
26 -* rake git:branch:production - Branch origin/production into BRANCH locally.  
27 -  
28 -h2. Backup  
29 -  
30 -* rake backup:db - Backup the current database. Timestamped file is created as :rails_root/../db-name-timestamp.sql  
31 -* rake backup:assets - Backup all assets under public/system. File is created as :rails_root/../system.tgz  
32 -  
33 -h2. Haml & Sass  
34 -  
35 -* rake sass:all_css2sass - Convert all CSS files in public/stylesheets to Sass.  
36 -* rake sass:all_sass2css - Convert all Sass files to CSS.  
37 -* rake haml:all_html2haml - Convert all HTML files to Haml.  
38 -  
39 -h2. Rails 2+  
40 -  
41 -* rake rails_two:rename_views - Renames all .rhtml views to .html.erb, .rjs to .js.rjs, .rxml to .xml.builder and .haml to .html.haml.  
42 -  
43 -h2. Subversion  
44 -  
45 -* rake svn:add - Adds all files with an svn status flag of '?'  
46 -* rake svn:delete - Deletes all files with an svn status flag of '!'  
47 -* rake svn:log - Writes the log file to doc/svn_log.txt  
48 -* rake svn:update\_svn\_ignore - Updates svn:ignore from .svnignore  
49 -  
50 -h2. Test Coverage  
51 -  
52 -Install rcov from http://github.com/mergulhao/rcov  
53 -  
54 -* rake test:coverage - Uses rcov to provide reports about test coverage of your application.  
55 -  
56 -h2. Mass Assignment  
57 -  
58 -From "mhartl":http://github.com/mhartl/find_mass_assignment  
59 -  
60 -* rake find_mass_assignment  
61 -  
62 -The Limerick Rake  
63 -=================  
64 -  
65 -Traditional Irish song. "YouTube":http://www.youtube.com/v/e8moLHIW8xw  
66 -  
67 - I am a young fellow that's easy and bold,  
68 - In Castletown conners I'm very well known.  
69 - In Newcastle West I spent many a note,  
70 - With Kitty and Judy and Mary.  
71 -  
72 - My father rebuked me for being such a rake,  
73 - And spending me time in such frolicsome ways,  
74 - But I ne'er could forget the good nature of Jane,  
75 - Agus fágaimíd siúd mar atá sé.  
76 -  
77 - My parents had reared me to shake and to mow,  
78 - To plough and to harrow, to reap and to sow.  
79 - But my heart being airy to drop it so low,  
80 - I set out on high speculation.  
81 -  
82 - On paper and parchment they taught me to write,  
83 - In Euclid and grammar they opened my eyes,  
84 - And in multiplication in truth I was bright,  
85 - Agus fágaimíd siúd mar atá sé.  
86 -  
87 - If I chance for to go to the town of Rathkeale,  
88 - The girls all round me do flock on the square.  
89 - Some give me a bottle and others sweet cakes,  
90 - To treat me unknown to their parents.  
91 -  
92 - There is one from Askeaton and one from the Pike,  
93 - Another from Arda, my heart was beguiled,  
94 - Tho' being from the mountains her stockings are white,  
95 - Agus fágaimíd siúd mar atá sé.  
96 -  
97 - To quarrel for riches I ne'er was inclined,  
98 - For the greatest of misers that must leave all behind.  
99 - I'll purchase a cow that will never run dry,  
100 - And I'll milk her by twisting her horn.  
101 -  
102 - John Damer of Shronel had plenty of gold,  
103 - And Lord Devonshire's treasures are twenty times more,  
104 - But he's laid on his back among nettles and stones,  
105 - Agus fágaimíd siúd mar atá sé.  
106 -  
107 - The old cow could be milked without clover or grass,  
108 - She'd be pampered with corn, good barley and hops.  
109 - She's warm and stout, and she's free in the paps,  
110 - And she'll milk without spancil or halter.  
111 -  
112 - The man that will drink it will cock his caubeen,  
113 - And if anyone laughs there'd be wigs on the green,  
114 - And the feeble old hag will get supple and free,  
115 - Agus fágaimíd siúd mar atá sé.  
116 -  
117 - There's some say I'm foolish and more say I'm wise,  
118 - But being fond of the women I think is no crime,  
119 - For the son of King David had ten hundred wives,  
120 - And his wisdom was highly regarded.  
121 -  
122 - I'll take a good garden and live at my ease,  
123 - And each woman and child can partake of the same,  
124 - If there'd be war in the cabin, themselves they'd be to blame,  
125 - Agus fágaimíd siúd mar atá sé.  
126 -  
127 - And now for the future I mean to be wise,  
128 - And I'll send for the women that acted so kind,  
129 - I'd marry them all on the morrow by and by,  
130 - If the clergy agree to the bargain.  
131 -  
132 - And when I'd be old and my soul is at peace,  
133 - These women will crowd for to cry at my wake,  
134 - And their sons and their daughters will offer their prayer,  
135 - To the Lord for the soul of their father.  
136 -  
137 -License  
138 --------  
139 -  
140 -MIT License, under the same terms as Ruby.  
vendor/plugins/limerick_rake/Rakefile
  1 +require 'bundler/gem_tasks'
  2 +
1 task :default do 3 task :default do
2 end 4 end
vendor/plugins/limerick_rake/lib/find_mass_assignment.rb
@@ -2,22 +2,22 @@ @@ -2,22 +2,22 @@
2 # http://github.com/mhartl/find_mass_assignment 2 # http://github.com/mhartl/find_mass_assignment
3 3
4 require 'active_support' 4 require 'active_support'
5 - 5 +
6 # Find potential mass assignment problems. 6 # Find potential mass assignment problems.
7 # The method is to scan the controllers for likely mass assignment, 7 # The method is to scan the controllers for likely mass assignment,
8 # and then find the corresponding models that *don't* have 8 # and then find the corresponding models that *don't* have
9 # attr_accessible defined. Any time that happens, it's a potential problem. 9 # attr_accessible defined. Any time that happens, it's a potential problem.
10 - 10 +
11 class String 11 class String
12 - 12 +
13 @@cache = {} 13 @@cache = {}
14 - 14 +
15 # A regex to match likely cases of mass assignment 15 # A regex to match likely cases of mass assignment
16 # Examples of matching strings: 16 # Examples of matching strings:
17 # "Foo.new( { :bar => 'baz' } )" 17 # "Foo.new( { :bar => 'baz' } )"
18 # "Foo.update_attributes!(params[:foo])" 18 # "Foo.update_attributes!(params[:foo])"
19 MASS_ASSIGNMENT = /(\w+)\.(new|create|update_attributes|build)!*\(/ 19 MASS_ASSIGNMENT = /(\w+)\.(new|create|update_attributes|build)!*\(/
20 - 20 +
21 # Return the strings that represent potential mass assignment problems. 21 # Return the strings that represent potential mass assignment problems.
22 # The MASS_ASSIGNMENT regex returns, e.g., ['Post', 'new'] because of 22 # The MASS_ASSIGNMENT regex returns, e.g., ['Post', 'new'] because of
23 # the grouping methods; we want the first of the two for each match. 23 # the grouping methods; we want the first of the two for each match.
@@ -28,17 +28,17 @@ class String @@ -28,17 +28,17 @@ class String
28 def mass_assignment_models 28 def mass_assignment_models
29 scan(MASS_ASSIGNMENT).map { |problem| problem.first.classify } 29 scan(MASS_ASSIGNMENT).map { |problem| problem.first.classify }
30 end 30 end
31 - 31 +
32 # Return true if the string has potential mass assignment code. 32 # Return true if the string has potential mass assignment code.
33 def mass_assignment? 33 def mass_assignment?
34 self =~ MASS_ASSIGNMENT 34 self =~ MASS_ASSIGNMENT
35 end 35 end
36 - 36 +
37 # Return true if the model defines attr_accessible. 37 # Return true if the model defines attr_accessible.
38 # Note that 'attr_accessible' must be preceded by nothing other than 38 # Note that 'attr_accessible' must be preceded by nothing other than
39 # whitespace; this catches cases where attr_accessible is commented out. 39 # whitespace; this catches cases where attr_accessible is commented out.
40 def attr_accessible? 40 def attr_accessible?
41 - model = "#{RAILS_ROOT}/app/models/#{self.classify}.rb" 41 + model = "#{Rails.root.to_s}/app/models/#{self.classify}.rb"
42 if File.exist?(model) 42 if File.exist?(model)
43 return @@cache[model] unless @@cache[model].nil? 43 return @@cache[model] unless @@cache[model].nil?
44 @@cache[model] = File.open(model).read =~ /^\s*attr_accessible/ 44 @@cache[model] = File.open(model).read =~ /^\s*attr_accessible/
@@ -48,17 +48,17 @@ class String @@ -48,17 +48,17 @@ class String
48 true 48 true
49 end 49 end
50 end 50 end
51 - 51 +
52 # Returnt true if a model does not define attr_accessible. 52 # Returnt true if a model does not define attr_accessible.
53 def problem? 53 def problem?
54 not attr_accessible? 54 not attr_accessible?
55 end 55 end
56 - 56 +
57 # Return true if a line has a problem model (no attr_accessible). 57 # Return true if a line has a problem model (no attr_accessible).
58 def problem_model? 58 def problem_model?
59 mass_assignment_models.find { |model| model.problem? } 59 mass_assignment_models.find { |model| model.problem? }
60 end 60 end
61 - 61 +
62 # Return true if a controller string has a (likely) mass assignment problem. 62 # Return true if a controller string has a (likely) mass assignment problem.
63 # This is true if at least one of the controller's lines 63 # This is true if at least one of the controller's lines
64 # (1) Has a likely mass assignment 64 # (1) Has a likely mass assignment
@@ -67,9 +67,9 @@ class String @@ -67,9 +67,9 @@ class String
67 File.open(self).find { |l| l.mass_assignment? and l.problem_model? } 67 File.open(self).find { |l| l.mass_assignment? and l.problem_model? }
68 end 68 end
69 end 69 end
70 - 70 +
71 module MassAssignment 71 module MassAssignment
72 - 72 +
73 def self.print_mass_assignment_problems(controller) 73 def self.print_mass_assignment_problems(controller)
74 lines = File.open(controller) 74 lines = File.open(controller)
75 lines.each_with_index do |line, number| 75 lines.each_with_index do |line, number|
@@ -78,9 +78,9 @@ module MassAssignment @@ -78,9 +78,9 @@ module MassAssignment
78 end 78 end
79 end 79 end
80 end 80 end
81 - 81 +
82 def self.find 82 def self.find
83 - controllers = Dir.glob("#{RAILS_ROOT}/app/controllers/*_controller.rb") 83 + controllers = Dir.glob("#{Rails.root.to_s}/app/controllers/*_controller.rb")
84 controllers.each do |controller| 84 controllers.each do |controller|
85 if controller.mass_assignment_problem? 85 if controller.mass_assignment_problem?
86 puts "\n#{controller}" 86 puts "\n#{controller}"
@@ -88,4 +88,4 @@ module MassAssignment @@ -88,4 +88,4 @@ module MassAssignment
88 end 88 end
89 end 89 end
90 end 90 end
91 -end  
92 \ No newline at end of file 91 \ No newline at end of file
  92 +end
vendor/plugins/limerick_rake/lib/limerick_rake.rb 0 → 100644
@@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
  1 +require 'limerick_rake/version'
  2 +
  3 +module LimerickRake
  4 + require 'limerick_rake/engine' if defined?(Rails)
  5 +end
vendor/plugins/limerick_rake/lib/limerick_rake/engine.rb 0 → 100644
@@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
  1 +module LimerickRake
  2 +
  3 + class Engine < Rails::Engine
  4 + end
  5 +
  6 +end
vendor/plugins/limerick_rake/lib/limerick_rake/version.rb 0 → 100644
@@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
  1 +module LimerickRake
  2 + VERSION = '0.0.2'.freeze
  3 +end
vendor/plugins/limerick_rake/lib/tasks/backup.rake 0 → 100644
@@ -0,0 +1,40 @@ @@ -0,0 +1,40 @@
  1 +require 'fileutils'
  2 +require 'pathname'
  3 +
  4 +namespace :backup do
  5 + desc "Backup the current database. Timestamped file is created as :rails_root/../db-name-timestamp.sql"
  6 + task :db => :environment do
  7 + config = ActiveRecord::Base.configurations[Rails.env || 'development']
  8 + filename = "#{config['database'].gsub(/_/, '-')}-#{Time.now.strftime('%Y-%m-%d-%H-%M-%S')}.sql"
  9 + backupdir = File.expand_path(File.join(Rails.root.to_s, '..'))
  10 + filepath = File.join(backupdir, filename)
  11 + mysqldump = `which mysqldump`.strip
  12 + options = "-e -u #{config['username']}"
  13 + options += " -p'#{config['password']}'" if config['password']
  14 + options += " -h #{config['host']}" if config['host']
  15 + options += " -S #{config['socket']}" if config['socket']
  16 +
  17 + raise RuntimeError, "I only work with mysql." unless config['adapter'] == 'mysql'
  18 + raise RuntimeError, "Cannot find mysqldump." if mysqldump.blank?
  19 +
  20 + FileUtils.mkdir_p backupdir
  21 + `#{mysqldump} #{options} #{config['database']} > #{filepath}`
  22 + puts "#{config['database']} => #{filepath}"
  23 + end
  24 +
  25 +
  26 + desc "Backup all assets under public/system. File is created as :rails_root/../system.tgz"
  27 + task :assets do
  28 + path = (Pathname.new(Rails.root.to_s) + 'public' + 'system').realpath
  29 + base_dir = path.parent
  30 + system_dir = path.basename
  31 + outfile = (Pathname.new(Rails.root.to_s) + '..').realpath + 'system.tgz'
  32 +
  33 + cd base_dir
  34 + `tar -czf #{outfile} #{system_dir}`
  35 + puts "Assets => #{outfile}"
  36 + end
  37 +end
  38 +
  39 +desc 'Backup the database and all assets by running the backup:db and backup:assets tasks.'
  40 +task :backup => ["backup:db", "backup:assets"]
vendor/plugins/limerick_rake/lib/tasks/coverage.rake 0 → 100644
@@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
  1 +namespace :test do
  2 +
  3 + desc 'Measures test coverage'
  4 + task :coverage do
  5 + rm_f "coverage"
  6 + rm_f "coverage.data"
  7 + rcov = "rcov -Itest --rails --aggregate coverage.data -T -x \" rubygems/*,/Library/Ruby/Site/*,gems/*,rcov*\""
  8 + system("#{rcov} --no-html test/unit/*_test.rb test/unit/helpers/*_test.rb")
  9 + system("#{rcov} --no-html test/functional/*_test.rb")
  10 + system("#{rcov} --html test/integration/*_test.rb")
  11 + system("open coverage/index.html") if PLATFORM['darwin']
  12 + end
  13 +
  14 +end
vendor/plugins/limerick_rake/lib/tasks/db/bootstrap.rake 0 → 100644
@@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
  1 +namespace :db do
  2 + desc "Loads a schema.rb file into the database and then loads the initial database fixtures."
  3 + task :bootstrap => ['db:schema:load', 'db:bootstrap:load']
  4 +
  5 + namespace :bootstrap do
  6 + desc "Load initial database fixtures (in db/bootstrap/*.yml) into the current environment's database. Load specific fixtures using FIXTURES=x,y"
  7 + task :load => :environment do
  8 + require 'active_record/fixtures'
  9 + ActiveRecord::Base.establish_connection(Rails.env.to_sym)
  10 + (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir.glob(File.join(Rails.root.to_s, 'db', 'bootstrap', '*.{yml,csv}'))).each do |fixture_file|
  11 + Fixtures.create_fixtures('db/bootstrap', File.basename(fixture_file, '.*'))
  12 + end
  13 + end
  14 + end
  15 +end
vendor/plugins/limerick_rake/lib/tasks/db/indexes.rake 0 → 100644
@@ -0,0 +1,22 @@ @@ -0,0 +1,22 @@
  1 +namespace :db do
  2 + namespace :indexes do
  3 + desc "Prints a list of unindexed foreign keys so you can index them"
  4 + task :missing => :environment do
  5 + indexes = {}
  6 + conn = ActiveRecord::Base.connection
  7 + conn.tables.each do |table|
  8 + indexed_columns = conn.indexes(table).map { |i| i.columns }.flatten
  9 + conn.columns(table).each do |column|
  10 + if column.name.match(/_id$/) && !indexed_columns.include?(column.name)
  11 + indexes[table] ||= []
  12 + indexes[table] << column.name
  13 + end
  14 + end
  15 + end
  16 + puts "Foreign Keys:"
  17 + indexes.sort.each do |table, columns|
  18 + puts columns.map { |c| "\s\sadd_index '#{table}', '#{c}'\n"}
  19 + end
  20 + end
  21 + end
  22 +end
vendor/plugins/limerick_rake/lib/tasks/db/recreate.rake 0 → 100644
@@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
  1 + namespace :db do
  2 + desc "Recreate database. Drop, create, migrate and seed it."
  3 + task :recreate => [:drop, :create, :migrate, :seed]
  4 + end
vendor/plugins/limerick_rake/lib/tasks/db/shell.rake 0 → 100644
@@ -0,0 +1,26 @@ @@ -0,0 +1,26 @@
  1 +namespace :db do
  2 + desc 'Launches the database shell using the values defined in config/database.yml'
  3 + task :shell => :environment do
  4 + config = ActiveRecord::Base.configurations[Rails.env || 'development']
  5 + command = ""
  6 +
  7 + case config['adapter']
  8 + when 'mysql'
  9 + command << "mysql "
  10 + command << "--host=#{config['host'] || 'localhost'} "
  11 + command << "--port=#{config['port'] || 3306} "
  12 + command << "--user=#{config['username'] || 'root'} "
  13 + command << "--password=#{config['password'] || ''} "
  14 + command << config['database']
  15 + when 'postgresql'
  16 + command << "psql "
  17 + command << "-h #{config['host'] || 'localhost'} "
  18 + command << "-p #{config['port'] || 5432} "
  19 + command << "-U #{config['username'] || 'postgres'} "
  20 + command << "\"dbname=#{config['database']} password=#{config['password']}\""
  21 + else
  22 + command << "echo Unsupported database adapter: #{config['adapter']}"
  23 + end
  24 + system command
  25 + end
  26 +end
vendor/plugins/limerick_rake/lib/tasks/db/validate_models.rake 0 → 100644
@@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
  1 +namespace :db do
  2 + # From http://blog.hasmanythrough.com/2006/8/27/validate-all-your-records
  3 + desc "Run model validations on all model records in database"
  4 + task :validate_models => :environment do
  5 + # because rails loads stuff on demand...
  6 + Dir.glob(Rails.root.to_s + '/app/models/**/*.rb').each do |file|
  7 + silence_warnings do
  8 + require file
  9 + end
  10 + end
  11 +
  12 + Object.subclasses_of(ActiveRecord::Base).select { |c| c.base_class == c}.sort_by(&:name).each do |klass|
  13 + next if klass.name == "CGI::Session::ActiveRecordStore::Session"
  14 + unless klass.table_exists?
  15 + puts "WARNING: Could not find table for #{klass} (skipping)"
  16 + next
  17 + end
  18 + invalid_count = 0
  19 + total = klass.count
  20 + chunk_size = 1000
  21 + (total / chunk_size + 1).times do |i|
  22 + chunk = klass.find(:all, :offset => (i * chunk_size), :limit => chunk_size)
  23 + chunk.reject(&:valid?).each do |record|
  24 + invalid_count += 1
  25 + puts "#{klass} #{record.id}: #{record.errors.full_messages.to_sentence}"
  26 + end rescue nil
  27 + end
  28 + puts "#{invalid_count} of #{total} #{klass.name.pluralize} are invalid." if invalid_count > 0
  29 + end
  30 + end
  31 +end
vendor/plugins/limerick_rake/lib/tasks/find_mass_assignment_tasks.rake 0 → 100644
@@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
  1 +desc "Find potential mass assignment vulnerabilities"
  2 +task :find_mass_assignment do
  3 + require File.join(File.dirname(__FILE__), '../../lib/find_mass_assignment.rb')
  4 + MassAssignment.find
  5 +end
vendor/plugins/limerick_rake/lib/tasks/git.rake 0 → 100644
@@ -0,0 +1,109 @@ @@ -0,0 +1,109 @@
  1 +module GitCommands
  2 + class ShellError < RuntimeError; end
  3 +
  4 + @logging = ENV['LOGGING'] != "false"
  5 +
  6 + def self.run cmd, *expected_exitstatuses
  7 + puts "+ #{cmd}" if @logging
  8 + output = `#{cmd} 2>&1`
  9 + puts output.gsub(/^/, "- ") if @logging
  10 + expected_exitstatuses << 0 if expected_exitstatuses.empty?
  11 + raise ShellError.new("ERROR: '#{cmd}' failed with exit status #{$?.exitstatus}") unless
  12 + [expected_exitstatuses].flatten.include?( $?.exitstatus )
  13 + output
  14 + end
  15 +
  16 + def self.current_branch
  17 + run("git branch --no-color | grep '*' | cut -d ' ' -f 2").chomp
  18 + end
  19 +
  20 + def self.remote_branch_exists?(branch)
  21 + ! run("git branch -r --no-color | grep '#{branch}'").empty?
  22 + end
  23 +
  24 + def self.ensure_clean_working_directory!
  25 + return if run("git status", 0, 1).match(/working directory clean/)
  26 + raise "Must have clean working directory"
  27 + end
  28 +
  29 + def self.diff_staging
  30 + puts run("git diff HEAD origin/staging")
  31 + end
  32 +
  33 + def self.diff_production
  34 + puts run("git diff origin/staging origin/production")
  35 + end
  36 +
  37 + def self.push(src_branch, dst_branch)
  38 + raise "origin/#{dst_branch} branch does not exist" unless remote_branch_exists?("origin/#{dst_branch}")
  39 + ensure_clean_working_directory!
  40 + begin
  41 + run "git fetch"
  42 + run "git push -f origin #{src_branch}:#{dst_branch}"
  43 + rescue
  44 + puts "Pushing #{src_branch} to origin/#{dst_branch} failed."
  45 + raise
  46 + end
  47 + end
  48 +
  49 + def self.push_staging
  50 + push(current_branch, "staging")
  51 + end
  52 +
  53 + def self.push_production
  54 + push("origin/staging", "production")
  55 + end
  56 +
  57 + def self.branch_production(branch)
  58 + raise "You must specify a branch name." if branch.blank?
  59 + ensure_clean_working_directory!
  60 + run "git fetch"
  61 + run "git branch -f #{branch} origin/production"
  62 + run "git checkout #{branch}"
  63 + end
  64 +
  65 + def self.pull_template
  66 + ensure_clean_working_directory!
  67 + run "git pull git://github.com/thoughtbot/suspenders.git master"
  68 + end
  69 +end
  70 +
  71 +namespace :git do
  72 + namespace :push do
  73 + desc "Reset origin's staging branch to be the current branch."
  74 + task :staging do
  75 + GitCommands.push_staging
  76 + end
  77 +
  78 + desc "Reset origin's production branch to origin's staging branch."
  79 + task :production do
  80 + GitCommands.push_production
  81 + end
  82 + end
  83 +
  84 + namespace :diff do
  85 + desc "Show the difference between current branch and origin/staging."
  86 + task :staging do
  87 + GitCommands.diff_staging
  88 + end
  89 +
  90 + desc "Show the difference between origin/staging and origin/production."
  91 + task :production do
  92 + GitCommands.diff_production
  93 + end
  94 + end
  95 +
  96 + namespace :pull do
  97 + desc "Pull updates from suspenders, the thoughtbot rails template."
  98 + task :suspenders do
  99 + GitCommands.pull_template
  100 + end
  101 + end
  102 +
  103 + namespace :branch do
  104 + desc "Branch origin/production into BRANCH locally."
  105 + task :production do
  106 + GitCommands.branch_production(branch)
  107 + end
  108 + end
  109 +end
vendor/plugins/limerick_rake/lib/tasks/haml_sass.rake 0 → 100644
@@ -0,0 +1,77 @@ @@ -0,0 +1,77 @@
  1 +# Dan Croak, February 2008
  2 +
  3 +@css_dir = "#{Rails.root.to_s}/public/stylesheets"
  4 +@sass_dir = "#{@css_dir}/sass"
  5 +@views_dir = "#{Rails.root.to_s}/app/views"
  6 +
  7 +def convert_css_to_sass(basename)
  8 + system "css2sass #{@css_dir}/#{basename}.css > #{@sass_dir}/#{basename}.sass"
  9 +end
  10 +
  11 +def convert_sass_to_css(basename)
  12 + system "sass #{@sass_dir}/#{basename}.sass > #{@css_dir}/#{basename}.css"
  13 +end
  14 +
  15 +def convert_html_to_haml(controller, basename)
  16 + extname = basename.include?("erb") ? ".html.erb" : ".rhtml"
  17 + basename = basename.split(".").first
  18 + system "html2haml #{@views_dir}/#{controller}/#{basename}#{extname} > #{@views_dir}/#{controller}/#{basename}.html.haml"
  19 + system "rm #{@views_dir}/#{controller}/#{basename}#{extname}"
  20 +end
  21 +
  22 +namespace :sass do
  23 + desc "Convert all CSS files to Sass."
  24 + task :all_css2sass => :environment do
  25 + begin
  26 + Dir.mkdir(@sass_dir)
  27 + rescue Exception => e
  28 + nil
  29 + end
  30 +
  31 + files = Dir.entries(@css_dir).find_all do |f|
  32 + File.extname("#{@css_dir}/#{f}") == ".css" &&
  33 + File.basename("#{@css_dir}/#{f}") !~ /^[.]/
  34 + end
  35 +
  36 + files.each do |filename|
  37 + basename = File.basename("#{@css_dir}/#{filename}", ".css")
  38 + convert_css_to_sass basename
  39 + convert_sass_to_css basename
  40 + end
  41 + end
  42 +
  43 + desc "Convert all Sass files to CSS."
  44 + task :all_sass2css => :environment do
  45 + files = Dir.entries(@sass_dir).find_all do |f|
  46 + File.extname("#{@sass_dir}/#{f}") == ".sass" &&
  47 + File.basename("#{@sass_dir}/#{f}") !~ /^[.]/
  48 + end
  49 +
  50 + files.each do |filename|
  51 + basename = File.basename("#{@sass_dir}/#{filename}", ".sass")
  52 + convert_sass_to_css basename
  53 + end
  54 + end
  55 +end
  56 +
  57 +namespace :haml do
  58 + desc "Convert all HTML files to Haml."
  59 + task :all_html2haml => :environment do
  60 + controllers = Dir.entries(@views_dir).find_all do |c|
  61 + File.directory?("#{@views_dir}/#{c}") &&
  62 + File.basename("#{@views_dir}/#{c}") !~ /^[.]/
  63 + end
  64 +
  65 + controllers.each do |controller|
  66 + files = Dir.entries("#{@views_dir}/#{controller}").find_all do |f|
  67 + (File.new("#{@views_dir}/#{controller}/#{f}").path.include?(".html.erb") ||
  68 + File.new("#{@views_dir}/#{controller}/#{f}").path.include?(".rhtml")) &&
  69 + File.basename("#{@views_dir}/#{controller}/#{f}") !~ /^[.]/
  70 + end
  71 + files.each do |filename|
  72 + basename = File.basename("#{@views_dir}/#{controller}/#{filename}")
  73 + convert_html_to_haml controller, basename
  74 + end
  75 + end
  76 + end
  77 +end
vendor/plugins/limerick_rake/lib/tasks/rails_two.rake 0 → 100644
@@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
  1 +desc 'Renames all .rhtml views to .html.erb, .rjs to .js.rjs, .rxml to .xml.builder and .haml to .html.haml'
  2 +namespace :rails_two do
  3 + task :rename_views do
  4 + Dir.glob('app/views/**/[^_]*.rhtml').each do |file|
  5 + puts `git mv #{file} #{file.gsub(/\.rhtml$/, '.html.erb')}`
  6 + end
  7 +
  8 + Dir.glob('app/views/**/[^_]*.rjs').each do |file|
  9 + puts `git mv #{file} #{file.gsub(/\.rjs$/, '.js.rjs')}`
  10 + end
  11 +
  12 + Dir.glob('app/views/**/[^_]*.rxml').each do |file|
  13 + puts `git mv #{file} #{file.gsub(/\.rxml$/, '.xml.builder')}`
  14 + end
  15 +
  16 + Dir.glob('app/views/**/[^_]*.haml').each do |file|
  17 + puts `git mv #{file} #{file.gsub(/\.haml$/, '.html.haml')}`
  18 + end
  19 + end
  20 +end
vendor/plugins/limerick_rake/lib/tasks/svn.rake 0 → 100644
@@ -0,0 +1,21 @@ @@ -0,0 +1,21 @@
  1 +# Pulled together from various mailing lists.
  2 +
  3 +namespace :svn do
  4 + desc "Adds all files with an svn status flag of '?'"
  5 + task(:add) { system %q(svn status | awk '/\\?/ {print $2}' | xargs svn add) }
  6 +
  7 + desc "Deletes all files with an svn status flag of '!'"
  8 + task(:delete) { system %q(svn status | awk '/\\!/ {print $2}' | xargs svn delete) }
  9 +
  10 + desc "Writes the log file to doc/svn_log.txt"
  11 + task(:log) do
  12 + File.delete("#{Rails.root.to_s}/doc/svn_log.txt") if File::exists?("#{Rails.root.to_s}/doc/svn_log.txt")
  13 + File.new("#{Rails.root.to_s}/doc/svn_log.txt", "w+")
  14 + system("svn log >> doc/svn_log.txt")
  15 + end
  16 +
  17 + desc 'Updates svn:ignore from .svnignore'
  18 + task(:update_svn_ignore) do
  19 + system %q(svn propset svn:ignore -F .svnignore .)
  20 + end
  21 +end
vendor/plugins/limerick_rake/limerick_rake.gemspec
  1 +# -*- encoding: utf-8 -*-
  2 +$:.push File.expand_path("../lib", __FILE__)
  3 +require "limerick_rake/version"
  4 +
1 Gem::Specification.new do |s| 5 Gem::Specification.new do |s|
2 - s.name = "limerick_rake"  
3 - s.version = "0.0.2"  
4 - s.date = "2008-10-07"  
5 - s.summary = "A collection of useful rake tasks."  
6 - s.email = "support@thoughtbot.com"  
7 - s.homepage = "http://github.com/thoughtbot/limerick_rake" 6 + s.name = "limerick_rake"
  7 + s.version = LimerickRake::VERSION.dup
  8 + s.platform = Gem::Platform::RUBY
  9 + s.authors = ["the Ruby community", "thoughtbot, inc."]
  10 + s.email = "support@thoughtbot.com"
  11 + s.homepage = "http://github.com/thoughtbot/limerick_rake"
  12 + s.summary = "A collection of useful rake tasks."
8 s.description = "A collection of useful rake tasks." 13 s.description = "A collection of useful rake tasks."
9 - s.authors = ["the Ruby community", "thoughtbot, inc."]  
10 - s.files = ["README.textile",  
11 - "limerick_rake.gemspec",  
12 - "tasks/backup.rake",  
13 - "tasks/db/bootstrap.rake",  
14 - "tasks/db/indexes.rake",  
15 - "tasks/db/shell.rake",  
16 - "tasks/db/validate_models.rake",  
17 - "tasks/git.rake",  
18 - "tasks/haml_sass.rake",  
19 - "tasks/svn.rake"]  
20 -end  
21 \ No newline at end of file 14 \ No newline at end of file
  15 +
  16 + s.files = `git ls-files`.split("\n")
  17 + s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
  18 + s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
  19 + s.require_paths = ["lib"]
  20 +end
vendor/plugins/limerick_rake/tasks/backup.rake
@@ -1,39 +0,0 @@ @@ -1,39 +0,0 @@
1 -require 'fileutils'  
2 -require 'pathname'  
3 -  
4 -namespace :backup do  
5 - desc "Backup the current database. Timestamped file is created as :rails_root/../db-name-timestamp.sql"  
6 - task :db => :environment do  
7 - config = ActiveRecord::Base.configurations[RAILS_ENV || 'development']  
8 - filename = "#{config['database'].gsub(/_/, '-')}-#{Time.now.strftime('%Y-%m-%d-%H-%M-%S')}.sql"  
9 - backupdir = File.expand_path(File.join(RAILS_ROOT, '..'))  
10 - filepath = File.join(backupdir, filename)  
11 - mysqldump = `which mysqldump`.strip  
12 - options = "-e -u #{config['username']}"  
13 - options += " -p#{config['password']}" if config['password']  
14 - options += " -h #{config['host']}" if config['host']  
15 -  
16 - raise RuntimeError, "I only work with mysql." unless config['adapter'] == 'mysql'  
17 - raise RuntimeError, "Cannot find mysqldump." if mysqldump.blank?  
18 -  
19 - FileUtils.mkdir_p backupdir  
20 - `#{mysqldump} #{options} #{config['database']} > #{filepath}`  
21 - puts "#{config['database']} => #{filepath}"  
22 - end  
23 -  
24 -  
25 - desc "Backup all assets under public/system. File is created as :rails_root/../system.tgz"  
26 - task :assets do  
27 - path = (Pathname.new(RAILS_ROOT) + 'public' + 'system').realpath  
28 - base_dir = path.parent  
29 - system_dir = path.basename  
30 - outfile = (Pathname.new(RAILS_ROOT) + '..').realpath + 'system.tgz'  
31 -  
32 - cd base_dir  
33 - `tar -czf #{outfile} #{system_dir}`  
34 - puts "Assets => #{outfile}"  
35 - end  
36 -end  
37 -  
38 -desc 'Backup the database and all assets by running the backup:db and backup:assets tasks.'  
39 -task :backup => ["backup:db", "backup:assets"]  
vendor/plugins/limerick_rake/tasks/coverage.rake
@@ -1,14 +0,0 @@ @@ -1,14 +0,0 @@
1 -namespace :test do  
2 -  
3 - desc 'Measures test coverage'  
4 - task :coverage do  
5 - rm_f "coverage"  
6 - rm_f "coverage.data"  
7 - rcov = "rcov -Itest --rails --aggregate coverage.data -T -x \" rubygems/*,/Library/Ruby/Site/*,gems/*,rcov*\""  
8 - system("#{rcov} --no-html test/unit/*_test.rb test/unit/helpers/*_test.rb")  
9 - system("#{rcov} --no-html test/functional/*_test.rb")  
10 - system("#{rcov} --html test/integration/*_test.rb")  
11 - system("open coverage/index.html") if PLATFORM['darwin']  
12 - end  
13 -  
14 -end  
vendor/plugins/limerick_rake/tasks/db/bootstrap.rake
@@ -1,15 +0,0 @@ @@ -1,15 +0,0 @@
1 -namespace :db do  
2 - desc "Loads a schema.rb file into the database and then loads the initial database fixtures."  
3 - task :bootstrap => ['db:schema:load', 'db:bootstrap:load']  
4 -  
5 - namespace :bootstrap do  
6 - desc "Load initial database fixtures (in db/bootstrap/*.yml) into the current environment's database. Load specific fixtures using FIXTURES=x,y"  
7 - task :load => :environment do  
8 - require 'active_record/fixtures'  
9 - ActiveRecord::Base.establish_connection(RAILS_ENV.to_sym)  
10 - (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir.glob(File.join(RAILS_ROOT, 'db', 'bootstrap', '*.{yml,csv}'))).each do |fixture_file|  
11 - Fixtures.create_fixtures('db/bootstrap', File.basename(fixture_file, '.*'))  
12 - end  
13 - end  
14 - end  
15 -end  
vendor/plugins/limerick_rake/tasks/db/indexes.rake
@@ -1,22 +0,0 @@ @@ -1,22 +0,0 @@
1 -namespace :db do  
2 - namespace :indexes do  
3 - desc "Prints a list of unindexed foreign keys so you can index them"  
4 - task :missing => :environment do  
5 - indexes = {}  
6 - conn = ActiveRecord::Base.connection  
7 - conn.tables.each do |table|  
8 - indexed_columns = conn.indexes(table).map { |i| i.columns }.flatten  
9 - conn.columns(table).each do |column|  
10 - if column.name.match(/_id/) && !indexed_columns.include?(column.name)  
11 - indexes[table] ||= []  
12 - indexes[table] << column.name  
13 - end  
14 - end  
15 - end  
16 - puts "Foreign Keys:"  
17 - indexes.each do |table, columns|  
18 - puts columns.map { |c| "\s\sadd_index '#{table}', '#{c}'\n"}  
19 - end  
20 - end  
21 - end  
22 -end  
23 \ No newline at end of file 0 \ No newline at end of file
vendor/plugins/limerick_rake/tasks/db/shell.rake
@@ -1,23 +0,0 @@ @@ -1,23 +0,0 @@
1 -namespace :db do  
2 - desc 'Launches the database shell using the values defined in config/database.yml'  
3 - task :shell => :environment do  
4 - config = ActiveRecord::Base.configurations[RAILS_ENV || 'development']  
5 - command = ""  
6 -  
7 - case config['adapter']  
8 - when 'mysql'  
9 - command << "mysql "  
10 - command << "--host=#{config['host'] || 'localhost'} "  
11 - command << "--port=#{config['port'] || 3306} "  
12 - command << "--user=#{config['username'] || 'root'} "  
13 - command << "--password=#{config['password'] || ''} "  
14 - command << config['database']  
15 - when 'postgresql'  
16 - puts 'You should consider switching to MySQL or get off your butt and submit a patch'  
17 - else  
18 - command << "echo Unsupported database adapter: #{config['adapter']}"  
19 - end  
20 -  
21 - system command  
22 - end  
23 -end  
24 \ No newline at end of file 0 \ No newline at end of file
vendor/plugins/limerick_rake/tasks/db/validate_models.rake
@@ -1,27 +0,0 @@ @@ -1,27 +0,0 @@
1 -namespace :db do  
2 - # From http://blog.hasmanythrough.com/2006/8/27/validate-all-your-records  
3 - desc "Run model validations on all model records in database"  
4 - task :validate_models => :environment do  
5 - # because rails loads stuff on demand...  
6 - Dir.glob(RAILS_ROOT + '/app/models/**/*.rb').each do |file|  
7 - silence_warnings do  
8 - require file  
9 - end  
10 - end  
11 -  
12 - Object.subclasses_of(ActiveRecord::Base).select { |c| c.base_class == c}.sort_by(&:name).each do |klass|  
13 - next if klass.name == "CGI::Session::ActiveRecordStore::Session"  
14 - invalid_count = 0  
15 - total = klass.count  
16 - chunk_size = 1000  
17 - (total / chunk_size + 1).times do |i|  
18 - chunk = klass.find(:all, :offset => (i * chunk_size), :limit => chunk_size)  
19 - chunk.reject(&:valid?).each do |record|  
20 - invalid_count += 1  
21 - puts "#{klass} #{record.id}: #{record.errors.full_messages.to_sentence}"  
22 - end rescue nil  
23 - end  
24 - puts "#{invalid_count} of #{total} #{klass.name.pluralize} are invalid." if invalid_count > 0  
25 - end  
26 - end  
27 -end  
vendor/plugins/limerick_rake/tasks/find_mass_assignment_tasks.rake
@@ -1,5 +0,0 @@ @@ -1,5 +0,0 @@
1 -desc "Find potential mass assignment vulnerabilities"  
2 -task :find_mass_assignment do  
3 - require File.join(File.dirname(__FILE__), "../lib/find_mass_assignment.rb")  
4 - MassAssignment.find  
5 -end  
6 \ No newline at end of file 0 \ No newline at end of file
vendor/plugins/limerick_rake/tasks/git.rake
@@ -1,109 +0,0 @@ @@ -1,109 +0,0 @@
1 -module GitCommands  
2 - class ShellError < RuntimeError; end  
3 -  
4 - @logging = ENV['LOGGING'] != "false"  
5 -  
6 - def self.run cmd, *expected_exitstatuses  
7 - puts "+ #{cmd}" if @logging  
8 - output = `#{cmd} 2>&1`  
9 - puts output.gsub(/^/, "- ") if @logging  
10 - expected_exitstatuses << 0 if expected_exitstatuses.empty?  
11 - raise ShellError.new("ERROR: '#{cmd}' failed with exit status #{$?.exitstatus}") unless  
12 - [expected_exitstatuses].flatten.include?( $?.exitstatus )  
13 - output  
14 - end  
15 -  
16 - def self.current_branch  
17 - run("git branch --no-color | grep '*' | cut -d ' ' -f 2").chomp  
18 - end  
19 -  
20 - def self.remote_branch_exists?(branch)  
21 - ! run("git branch -r --no-color | grep '#{branch}'").blank?  
22 - end  
23 -  
24 - def self.ensure_clean_working_directory!  
25 - return if run("git status", 0, 1).match(/working directory clean/)  
26 - raise "Must have clean working directory"  
27 - end  
28 -  
29 - def self.diff_staging  
30 - puts run("git diff HEAD origin/staging")  
31 - end  
32 -  
33 - def self.diff_production  
34 - puts run("git diff origin/staging origin/production")  
35 - end  
36 -  
37 - def self.push(src_branch, dst_branch)  
38 - raise "origin/#{dst_branch} branch does not exist" unless remote_branch_exists?("origin/#{dst_branch}")  
39 - ensure_clean_working_directory!  
40 - begin  
41 - run "git fetch"  
42 - run "git push -f origin #{src_branch}:#{dst_branch}"  
43 - rescue  
44 - puts "Pushing #{src_branch} to origin/#{dst_branch} failed."  
45 - raise  
46 - end  
47 - end  
48 -  
49 - def self.push_staging  
50 - push(current_branch, "staging")  
51 - end  
52 -  
53 - def self.push_production  
54 - push("origin/staging", "production")  
55 - end  
56 -  
57 - def self.branch_production(branch)  
58 - raise "You must specify a branch name." if branch.blank?  
59 - ensure_clean_working_directory!  
60 - run "git fetch"  
61 - run "git branch -f #{branch} origin/production"  
62 - run "git checkout #{branch}"  
63 - end  
64 -  
65 - def self.pull_template  
66 - ensure_clean_working_directory!  
67 - run "git pull git://github.com/thoughtbot/suspenders.git master"  
68 - end  
69 -end  
70 -  
71 -namespace :git do  
72 - namespace :push do  
73 - desc "Reset origin's staging branch to be the current branch."  
74 - task :staging do  
75 - GitCommands.push_staging  
76 - end  
77 -  
78 - desc "Reset origin's production branch to origin's staging branch."  
79 - task :production do  
80 - GitCommands.push_production  
81 - end  
82 - end  
83 -  
84 - namespace :diff do  
85 - desc "Show the difference between current branch and origin/staging."  
86 - task :staging do  
87 - GitCommands.diff_staging  
88 - end  
89 -  
90 - desc "Show the difference between origin/staging and origin/production."  
91 - task :production do  
92 - GitCommands.diff_production  
93 - end  
94 - end  
95 -  
96 - namespace :pull do  
97 - desc "Pull updates from suspenders, the thoughtbot rails template."  
98 - task :suspenders do  
99 - GitCommands.pull_template  
100 - end  
101 - end  
102 -  
103 - namespace :branch do  
104 - desc "Branch origin/production into BRANCH locally."  
105 - task :production do  
106 - GitCommands.branch_production(branch)  
107 - end  
108 - end  
109 -end  
vendor/plugins/limerick_rake/tasks/haml_sass.rake
@@ -1,78 +0,0 @@ @@ -1,78 +0,0 @@
1 -# Dan Croak, February 2008  
2 -  
3 -@css_dir = "#{RAILS_ROOT}/public/stylesheets"  
4 -@sass_dir = "#{@css_dir}/sass"  
5 -@views_dir = "#{RAILS_ROOT}/app/views"  
6 -  
7 -def convert_css_to_sass(basename)  
8 - system "css2sass #{@css_dir}/#{basename}.css > #{@sass_dir}/#{basename}.sass"  
9 -end  
10 -  
11 -def convert_sass_to_css(basename)  
12 - system "sass #{@sass_dir}/#{basename}.sass > #{@css_dir}/#{basename}.css"  
13 -end  
14 -  
15 -def convert_html_to_haml(controller, basename)  
16 - extname = basename.include?("erb") ? ".html.erb" : ".rhtml"  
17 - basename = basename.split(".").first  
18 - system "html2haml #{@views_dir}/#{controller}/#{basename}#{extname} > #{@views_dir}/#{controller}/#{basename}.html.haml"  
19 - system "rm #{@views_dir}/#{controller}/#{basename}#{extname}"  
20 -end  
21 -  
22 -namespace :sass do  
23 - desc "Convert all CSS files to Sass."  
24 - task :all_css2sass => :environment do  
25 - begin  
26 - Dir.mkdir(@sass_dir)  
27 - rescue Exception => e  
28 - nil  
29 - end  
30 -  
31 - files = Dir.entries(@css_dir).find_all do |f|  
32 - File.extname("#{@css_dir}/#{f}") == ".css" &&  
33 - File.basename("#{@css_dir}/#{f}") !~ /^[.]/  
34 - end  
35 -  
36 - files.each do |filename|  
37 - basename = File.basename("#{@css_dir}/#{filename}", ".css")  
38 - convert_css_to_sass basename  
39 - convert_sass_to_css basename  
40 - end  
41 - end  
42 -  
43 - desc "Convert all Sass files to CSS."  
44 - task :all_sass2css => :environment do  
45 - files = Dir.entries(@sass_dir).find_all do |f|  
46 - File.extname("#{@sass_dir}/#{f}") == ".sass" &&  
47 - File.basename("#{@sass_dir}/#{f}") !~ /^[.]/  
48 - end  
49 -  
50 - files.each do |filename|  
51 - basename = File.basename("#{@sass_dir}/#{filename}", ".sass")  
52 - convert_sass_to_css basename  
53 - end  
54 - end  
55 -end  
56 -  
57 -namespace :haml do  
58 - desc "Convert all HTML files to Haml."  
59 - task :all_html2haml => :environment do  
60 - controllers = Dir.entries(@views_dir).find_all do |c|  
61 - File.directory?("#{@views_dir}/#{c}") &&  
62 - File.basename("#{@views_dir}/#{c}") !~ /^[.]/  
63 - end  
64 -  
65 - controllers.each do |controller|  
66 - files = Dir.entries("#{@views_dir}/#{controller}").find_all do |f|  
67 - (File.new("#{@views_dir}/#{controller}/#{f}").path.include?(".html.erb") ||  
68 - File.new("#{@views_dir}/#{controller}/#{f}").path.include?(".rhtml")) &&  
69 - File.basename("#{@views_dir}/#{controller}/#{f}") !~ /^[.]/  
70 - end  
71 - files.each do |filename|  
72 - basename = File.basename("#{@views_dir}/#{controller}/#{filename}")  
73 - convert_html_to_haml controller, basename  
74 - end  
75 - end  
76 - end  
77 -end  
78 -  
vendor/plugins/limerick_rake/tasks/rails_two.rake
@@ -1,20 +0,0 @@ @@ -1,20 +0,0 @@
1 -desc 'Renames all .rhtml views to .html.erb, .rjs to .js.rjs, .rxml to .xml.builder and .haml to .html.haml'  
2 -namespace :rails_two do  
3 - task :rename_views do  
4 - Dir.glob('app/views/**/[^_]*.rhtml').each do |file|  
5 - puts `git mv #{file} #{file.gsub(/\.rhtml$/, '.html.erb')}`  
6 - end  
7 -  
8 - Dir.glob('app/views/**/[^_]*.rjs').each do |file|  
9 - puts `git mv #{file} #{file.gsub(/\.rjs$/, '.js.rjs')}`  
10 - end  
11 -  
12 - Dir.glob('app/views/**/[^_]*.rxml').each do |file|  
13 - puts `git mv #{file} #{file.gsub(/\.rxml$/, '.xml.builder')}`  
14 - end  
15 -  
16 - Dir.glob('app/views/**/[^_]*.haml').each do |file|  
17 - puts `git mv #{file} #{file.gsub(/\.haml$/, '.html.haml')}`  
18 - end  
19 - end  
20 -end  
21 \ No newline at end of file 0 \ No newline at end of file
vendor/plugins/limerick_rake/tasks/svn.rake
@@ -1,21 +0,0 @@ @@ -1,21 +0,0 @@
1 -# Pulled together from various mailing lists.  
2 -  
3 -namespace :svn do  
4 - desc "Adds all files with an svn status flag of '?'"  
5 - task(:add) { system %q(svn status | awk '/\\?/ {print $2}' | xargs svn add) }  
6 -  
7 - desc "Deletes all files with an svn status flag of '!'"  
8 - task(:delete) { system %q(svn status | awk '/\\!/ {print $2}' | xargs svn delete) }  
9 -  
10 - desc "Writes the log file to doc/svn_log.txt"  
11 - task(:log) do  
12 - File.delete("#{RAILS_ROOT}/doc/svn_log.txt") if File::exists?("#{RAILS_ROOT}/doc/svn_log.txt")  
13 - File.new("#{RAILS_ROOT}/doc/svn_log.txt", "w+")  
14 - system("svn log >> doc/svn_log.txt")  
15 - end  
16 -  
17 - desc 'Updates svn:ignore from .svnignore'  
18 - task(:update_svn_ignore) do  
19 - system %q(svn propset svn:ignore -F .svnignore .)  
20 - end  
21 -end