Mephisto capistrano tasks

The latest edition of Mephisto, Immortus, has just been released. I just upgraded this blog in 15 seconds to the latest edition by running one custom capistrano task.


I keep my Mephisto theme in a subversion repository. My mephisto installation and my theme site in the same directory on the server.

$ ls /var/rails
depixelate depixelate_theme

With that layout in mind, here is my deploy.rb which I added to my depixelate_theme code.


# Usage: $cap -r deploy.rb -a theme_update

set :rails_apps_dir, '/var/rails'
set :application, 'depixelate'

set :app_dir, "#{rails_apps_dir}/#{application}"
set :app_theme_dir, "#{rails_apps_dir}/#{application}_theme"

role :web, ''

desc "Svn update on mephisto." 
task :update_mephisto, :roles => :web do
  run <<-CMD
    cd #{app_dir} &&
    svn update && 
    RAILS_ENV=production rake db:migrate


  sudo '/etc/init.d/mongrel_cluster restart'

desc "Svn update the theme." 
task :theme_update, :roles => :web do
  run <<-CMD
    cd #{app_theme_dir} &&
    svn up && 
    cd #{app_dir}/themes &&
    ln -fs ../../#{application}_theme site-1 &&
    cd #{app_dir} &&
    ./script/runner 'CachedPage.find(:all).each { |p| ActionController::Base.expire_page(p.url) }' -e production &&
    ./script/runner 'CachedPage.delete_all;' -e production &&
    if [ -e #{app_dir}/public/stylesheets/depixelate.css ]; then rm #{app_dir}/public/stylesheets/depixelate.css; fi

Update - 9/2

I want to mention that this recipe is inspired by Geoffrey Grosenbach’s capistrano task detailed in his Update Your Typo Blog With Capistrano article.

Comment or question via
FYI: This post was migrated over from another blogging engine. If you encounter any issues please let me know on . Thanks.