Capistrano Dep-Check Has Been Assimilated!

Shows how much I follow the progress of RoR SVN…Jamis Buck checked in changeset 6487 2 months ago, which as far as I can tell is derived from my technique of checking dependencies as described in Using Capistrano To Check For Deployment Dependencies.

Nice work Jamis, looks good!

Given that we’re using my original technique at my work, we haven’t had the opportunity to switch over to Capistrano 2 yet…but I’ll get there. I think I’ll need to submit a few patches, though, given that there are some things that aren’t supported yet such as executing a command and checking the results to see if it matches a regular expression. Something like this:

Check if MySQL is configured correctly
1
2
3
4
5
mysql_setting_max_connections:
  - 2000+
  - echo "SHOW VARIABLES LIKE '%max_connections%'" | mysql
  - !ruby/regexp /max_connections\s*[2-9]000/
  - !ruby/regexp /\d+/

You’ll notice that this is YAML (YAML Ain’t Markup Language). I’m storing dependencies in a file called dependencies.yaml, which gets auto-loaded when I load my DependencyChecker module/plugin. I could also do this:

Check for a specific version of PIL (contrived example of running code)
1
2
3
4
5
python_pil:
  - 1.1.x
  - python -c "import Image; print Image.VERSION"
  - !ruby/regexp /1\.1\.\d/
  - !ruby/regexp /\d\.\d\.\d/</filter:code>

Or perhaps:

Check if NPTL is available
1
2
3
4
5
nptl:
  - present
  - /lib/libc.so.6
  - !ruby/regexp /Native POSIX Threads Library/
  - !ruby/regexp /Native POSIX Threads Library/</filter:code>

Doing it like this means I get platform-agnostic dependency checking, which would be a great feature for Capistrano 2’s dependency checking implementation.