In my last Git, Capistrano, SSH, and WordPress tutorial, I showed you how to setup your WordPress theme to be easily deployable. Now, I've simplified the process even more by eliminating a large amount of duplicate code.
I recently published my first Ruby Gem, capistrano-wordpress (source). This gem adds a new "recipe" that is available to any Capistrano deploy script. So now, our deploy script from the last tutorial becomes this:
[ruby]set :user, 'yourusername' set :domain, 'yourdomain.com' set :application, domain # in the off chance that this doesn't match your domain, just specify it set :theme_name, 'yourthemename' # your theme name here
role :web, domain role :app, domain role :db, domain
require 'capistrano_wordpress'[/ruby]
This Gem takes a few assumptions into consideration. Firstly, these are your deploy paths:
[ruby]set :appdir, "/home/#{user}/deployments/#{application}" set :deploy_to, "/home/#{user}/#{domain}/wp-content/themes/" set :releases_path, "/home/#{user}/cap/#{domain}/releases/" set :shared_path, "/home/#{user}/cap/#{domain}/shared/"[/ruby]
And these are your repository paths:
[ruby]set :local_repository, "ssh://#{user}@#{domain}/~/git/#{application}.git" set :repository, "/home/#{user}/git/#{application}.git"[/ruby]
I do plan on upgraded the gem to allow you to properly override these variables (using _cset), but I was having a lot of issues while doing so (it may take some time). I will announce when I make the update, and I will also revise this post.
Another thing to keep in mind: make sure that you include the require 'capistrano_wordpress' line and that it is at the bottom of your deploy script.
This gem works wonders when you are consistently deploying to similar server setups (in my case, Dreamhost shared-hosting).
There are a lot of other things that I would like to see from this gem, and I will try to add them when I can. If you would like to help, you can visit the gem's source code and create a branch. Features I would like to see: