Update (02-03-2008): As of Vlad 1.2.0, this module is included. You will have native Git support.

So you want to use Vlad the Deployer to deploy your apps. You’ve found its simplicity elegant. You’ve seen the light when it comes to distributed vs. centralized version control systems and decided distributed is the only way to go. You’ve sat down to write your deployment recipe, only to find, to your horror…

…only Subversion and Perforce are supported.

No longer. I present to you a Git module. Just a sidenote, in light of accuracy, Mercurial support is in the development version, and darcs support is in a patch on RubyForge.

Now, with this module I also provide a small patch to lib/vlad/core.rb. At the time of this writing, Vlad 1.1.0 is the latest version and does not have all that is needed to support the pile of awesome that Git provides. Specifically, it hard codes “head” as the revision in every checkout. That’s no good with Git, because we may want to deploy a branch, tag, or arbitrary SHA1 commit ID.

Enough of that, let’s have some fun. Install the module and my patch to core.rb like so: 1 2 3 cd $GEMPATH/vlad-1.1.0 wget http://scie.nti.st/dist/git-vlad.diff patch -p1 < git-vlad.diff

Replace $GEMPATH with the real path to your Gems.

Now, in your Rakefile, you will want the couple lines that refer to Vlad to look like this: 1 2 require 'vlad' Vlad.load :scm => :git

I can’t seem to override the scm in config/deploy.rb, even though Vlad implies you can do so. Perhaps a bug, no matter. Here’s a simple 3-line deploy file (config/deploy.rb): 1 2 3 set :domain, "myhost.com" set :deploy_to, "/var/www/" set :repository, "dev1.myhost.com:/var/git/repo.git"

Now you can proceed to deploy as usual (rake vlad:update && rake vlad:migrate && rake vlad:start).

There is another variable you can put in config/deploy.rb which is called “revision”. Here are a few examples: 1 2 3 4 5 6 7 8 # Deploy the latest code, this the default set :revision, "HEAD" # Deploy branch "origin/my_branch" set :revision, "origin/my_branch" # Deploy tag "1.0" set :revision, "1.0"

That’s about all there is to it. Questions, comments, bugs, mistakes, praises, boos? Please leave a comment.