From 387d68185d957d90a2cad27844486a3bd7ff3f5a Mon Sep 17 00:00:00 2001 From: Miles Gould Date: Mon, 17 Sep 2012 22:50:08 +0100 Subject: [PATCH 1/2] Wrap dev/test Rake tasks in error recovery Rake was dying due to missing gems in production. --- lib/tasks/testing.rake | 16 +++++++++------- lib/tasks/watchr.rake | 9 ++++++--- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/lib/tasks/testing.rake b/lib/tasks/testing.rake index cc082b0be..e2a99ea9b 100644 --- a/lib/tasks/testing.rake +++ b/lib/tasks/testing.rake @@ -1,12 +1,14 @@ require 'rake' -require 'rspec/core/rake_task' +begin + require 'rspec/core/rake_task' -RSpec::Core::RakeTask.new(:spec) + RSpec::Core::RakeTask.new(:spec) -task :default => :spec + task :default => :spec -task :run_tests do - system("rspec spec/") - system("rake test") + task :run_tests do + system("rspec spec/") + system("rake test") + end +rescue LoadError end - diff --git a/lib/tasks/watchr.rake b/lib/tasks/watchr.rake index 498b82be8..4f48a3761 100644 --- a/lib/tasks/watchr.rake +++ b/lib/tasks/watchr.rake @@ -1,4 +1,7 @@ -desc "Run watchr" -task :watchr do - sh %{bundle exec watchr .watchr} +begin + desc "Run watchr" + task :watchr do + sh %{bundle exec watchr .watchr} + end +rescue LoadError end From a2fede15e974186f49005779ca8e35a480e381ec Mon Sep 17 00:00:00 2001 From: Miles Gould Date: Mon, 17 Sep 2012 22:55:27 +0100 Subject: [PATCH 2/2] Don't connect to the DB when precompiling assets. See https://devcenter.heroku.com/articles/rails3x-asset-pipeline-cedar#troubleshooting --- config/application.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/application.rb b/config/application.rb index 11c1375cd..16f4ae061 100644 --- a/config/application.rb +++ b/config/application.rb @@ -58,5 +58,8 @@ module Growstuff # Version of your assets, change this if you want to expire all your assets config.assets.version = '1.0' + + # Don't try to connect to the database when precompiling assets + config.assets.initialize_on_precompile = false end end