Legacy Capistrano Issues

I have some apps deployed with older versions of capistrano but I still want to be able to use the latest capistrano on newer projects. Ideally I’d update the older apps to use the newer capistrano, but sometimes that requires a lot of work for not much benefit when I have a perfectly good copy of the old capistrano laying around to run those old deploy scripts with.

However, by perfectly good, I mean broken. It breaks because it doesn’t specifically require the correct versions of other gems but this you can fix. This is how I fixed it for my particular use case. I’m assuming you have a recent version of rubygems where you can use the gem method for specifying require’s gem versions.

Open up your old cap program, mine was here:
/usr/local/lib/ruby/gems/1.8/gems/capistrano-1.4.1/bin/cap

Before the “require ‘capistrano/cli’” line add the following:

I also edited my lib/tasks/capistrano.rake file to have the following code in it.

Then I created a new symlink.

Now I can run my old stuff and I have my old cap program as well.