Deployment: Diffs and Dependencies
We moved house recently, so my daily development machine was packed up for a few weeks while I worked off a laptop and a 3G card. It was like being on holiday except I still had to work. Anyway, I found a few deployment-related scripts I was working on for my Agile Deployment series of articles (visit the agiledeployment tag for more).
I’ve packaged these scripts as rubygems, so they’ll be easy to install and try out. They’re essentially snippets that I use to maintain sanity when deploying. They might form part of a bigger deployment system in the future.
Rsyncdiff

rsyncdiff shows the differences between your local and remote code. I’ve been using this to try to visualise what will happen after deploying.
The output contains file creations, deletions and updates. The updates show a diff, and will automatically use colordiff if you’ve got it.
I use it with my Rails projects like this:
rsyncdiff server:/u/apps/project/current/app app/
rsyncdiff server:/u/apps/project/current/lib lib/
I usually just compare app/, lib/ and public/, just to keep the output manageable.
Depwhack

depwhack compares the gems your application loads locally with the gems available on a remote server. I use config.gem in my Rails project which helps mitigate missing gems, but if I’m doing a major deploy for a client I don’t like nasty surprises.
Ruby has a method called at_exit which you can use as a callback at the end of a script. I was using this after running tests on my Rails projects to get a complete list of the gems they use.
It’s pretty easy to do:
at_exit do
p Gem.loaded_specs.collect { |g| [g.first, g[1].version.to_s] }
end
Installation
I’ve put these scripts as gems on gemcutter:
gem install rsyncdiff
gem install depwhack



blog comments powered by Disqus