Using capistrano for drupal deployment

UPDATE: This post was written using Capistrano 1, which has since been superseded. An updated version—covering deployment of Drupal with Capistrano 2—can be found here. It’s easy to get spoiled building rails apps. Tools like migrations make it so much easier to keep databases in sync, the way environments are managed helps considerably, and there’s Capistrano which makes rapid deployments a breeze. I miss those things when I have to work with other systems. ...

Shiny gems

There’s something going round, with people sharing the list of gems they have installed locally. To be honest, I’m not quite sure why, but I decided to join in and who knows? Maybe it’ll inspire me to write a little more about a few of my favourites?. So without further delay… abstract (1.0.0) actionmailer (1.3.2, 1.3.1, 1.3.0, 1.2.5) actionpack (1.13.2, 1.13.1, 1.13.0, 1.12.5) actionwebservice (1.2.2, 1.2.1, 1.2.0, 1.1.6) activerecord (1.15.2, 1.15.1, 1.15.0, 1.14.4) activesupport (1.4.1, 1.4.0, 1.3.1) acts_as_searchable (0.1.0) acts_as_versioned (0.2.3) atom (0.3) builder (2.0.0) cached_model (1.3.1) calibre-bbcode (1.0.0) camping (1.5.180, 1.5) camping-omnibus (1.5.180) capistrano (1.4.0, 1.3.1, 1.2.0) cgi_multipart_eof_fix (2.1, 2.0.2, 1.0.0) cheat (1.2.1) daemons (1.0.4, 1.0.3, 1.0.2, 1.0.1) ebayapi (0.9.4, 0.9.3) erubis (2.1.0) fastercsv (1.1.1, 1.1.0, 1.0.0) fastthread (0.6.3, 0.6.2, 0.6.1, 0.4) ferret (0.10.14, 0.10.13) flickr (1.0.0) gem_plugin (0.2.2, 0.2.1) gruff (0.2.8, 0.2.4, 0.1.2) hoe (1.1.7, 1.1.6, 1.1.2, 1.1.1, 1.1.0) hpricot (0.5, 0.4.92, 0.4) icalendar (0.98, 0.97) isbn-tools (0.1.0) json (0.4.2) libxml-ruby (0.3.8.4, 0.3.8) markaby (0.5) memcache-client (1.2.1, 1.2.0) metaid (1.0) mime-types (1.15) mofo (0.1.2) money (1.7.1) mongrel (1.0.1, 1.0, 0.3.17, 0.3.13.4) mongrel_cluster (0.2.1, 0.2.0) mt-capistrano (0.0.2) mysql (2.7) needle (1.3.0) net-sftp (1.1.0) net-ssh (1.0.10) paginator (1.0.8, 1.0.7, 1.0.1) parseexcel (0.5.1.1) piston (1.3.0, 1.2.1) production_log_analyzer (1.3.0) rails (1.2.2, 1.2.1, 1.2.0, 1.1.6) rails_analyzer_tools (1.1.0) rake (0.7.1) rcov (0.7.0.1) RedCloth (3.0.4, 3.0.3) rfm (0.1.0) rmagick (1.15.2, 1.15.0, 1.14.1, 1.14.0, 1.13.0) Rubilicious (0.2.0) ruby-openid (1.1.4, 1.1.3) ruby-prof (0.4.1) ruby-yadis (0.3.4, 0.3.3) rubyforge (0.4.0, 0.3.2, 0.3.0) rubyosa (0.2.0, 0.1.0) slave (1.2.0, 1.0.0) sources (0.0.1) sqlite3-ruby (1.2.1, 1.2.0, 1.1.0.1) streamlined_generator (0.0.5) tattle (1.0.1) termios (0.9.4) tzinfo (0.3.3) uuidtools (1.0.0) wirble (0.1.2) xml-mapping (0.8.1) xml-simple (1.0.10, 1.0.9) ZenTest (3.4.3)

The Array Argument (aka. *)

Wednesday’s post on acts_as_locateable didn’t do much to explain what the patch to the plugin’s methods was doing to allow us to pass extra arguments to ActiveRecord#find. The secret is in the *, or array argument. A normal method will have a fixed number of arguments: def simple_method(first, second, third) puts "#{first} : #{second} : #{third}" end simple_method('one', 'two', 'three') >> one : two : three and sometimes we can develop that by allowing default values for those arguments: ...

XML::Mapping and text nodes with attributes

While working on an API interface I’ve been playing around with XML::Mapping, an XML-to-object wrapper for ruby. The main reason to use it is that it allows me to easily build an interface similar to that used in Cody Fauser’s Ebay API client which will also be used in the same application. Generally I’ve been very happy with the library, though at some point it would be nice to have a class generator which will take the XSD file and write most of the code for me, but scour the documentation as I may I couldn’t find an easy way to add attributes to a standard text-holding node. It’s easy enough to get: ...

Splitting search terms

The other day I wanted to break up a search string into its constituent parts. We’re not supporting any fancy operators, but we did want to allow phrases to be specified in double quotes. It’s an easy enough operation, but I googled to see if anyone was offering a particularly efficient way to do that in ruby. Nothing came up and since I’ve not posted in a while I thought I’d offer it for anyone else in that situation. ...

Better than BASIC?

David Brin complains about the difficulty of obtaining BASIC for modern computers, in a piece published yesterday on Salon. He’s been trying to teach his son to code, starting with simple algorithms and developing a good sense of what the computer is doing as it processes each step. Java and C++ are considered too complex for this purpose, and he seems to consider most scripting languages to be too high-level: The “scripting” languages that serve as entry-level tools for today’s aspiring programmers – like Perl and Python – don’t make this experience accessible to students in the same way. BASIC was close enough to the algorithm that you could actually follow the reasoning of the machine as it made choices and followed logical pathways. Repeating this point for emphasis: You could even do it all yourself, following along on paper, for a few iterations, verifying that the dot on the screen was moving by the sheer power of mathematics, alone. Wow! ...