This blog uses the handy BlueCloth gem to provide Markdown syntax for writing posts. (And, eventually, for writing comments, but we’ll get to that.)
The problem is that I got everything working on my development server, but when I deployed the code to production using Capistrano and Deprec… boom! No BlueCloth gem, no functional app, lots of ugly black smoke.
(Okay, it was Rails, so it was nicely formatted black smoke with a fairly clear error message. But, still.)
The good news is that I had several unit tests that checked for Markdown support. The bad news is that none of those tests got run on the production server as the app was being deployed, so they were kind of useless. Fortunately, Peter Marklund has come to my rescue:
desc "Run the full tests on the deployed app"
task :run_tests do
run "cd #{release_path} && RAILS_ENV=production rake db:test:prepare"
# note how the cat /dev/null writes emptiness to the test log unless the tests
# generate an error condition - I learn some UNIX every day.
run "cd #{release_path} && RAILS_ENV=production rake && cat /dev/null > log/test.log"
end
desc "Run pre-symlink tasks"
task :before_symlink, :roles => :web do
run_tests
end