Capistrano 2.0 Preview 4
I am such a chicken. I very much wanted the next release of Capistrano to be the official “Capistrano 2.0” release. But as I watched the changelog grow, I started to get cold feet.
Thus, tonight I announce the fourth (and final, hopefully!) preview release of Capistrano 2.0. As before, you can grab it from the Rails beta gems server:
gem install -s http://gems.rubyonrails.com capistrano
The following items are just some of the changes new in preview #4:
- The deploy:symlink task works correctly now when run by itself.
- Synchronously instantiate the gateway to prevent it being instantiated multiple times.
- Use “which” instead of “test -p to test whether a command exists on the path.
- The :hosts and :roles keys can now accept lambdas, to lazily select which hosts or roles a task uses.
- Versions of Net::SSH prior to 1.1.0 work with Capistrano again.
- Variable accesses are now thread safe.
- The deployment code is now locale-independent, so that the revision is parsed correctly even if your computer is using a non-English locale.
- You can now pass :on_error => :continue when defining a task, so that any connection or command errors that occur during the task’s execution will be ignored, allowing the task (and subsequent tasks) to continue.
You can see the entire list of changes in the CHANGELOG.
So, give it a go. Try it out. Post your feedback to the Capistrano mailing list. I’d love to release cap2 final next week!
P.S. If you are on a Windows machine, and you get Zlib errors trying to install the Capistrano gem, try this. Find the rubygems/package.rb file (wherever it happens to be in your Ruby installation), open it up, and find the zipped_stream method. Then, replace it, wholesale, with the following:
1 2 3 4 5 6 7
def zipped_stream(entry) entry.read(10) # skip the gzip header zis = Zlib::Inflate.new(-Zlib::MAX_WBITS) is = StringIO.new(zis.inflate(entry.read)) ensure zis.finish if zis end
That seems to do the trick for me; let me know if it doesn’t work for you.
:on_error => :continue is especially cool!
28 Jun 2007
Can I use the mongrel_cluster extension with cap2, or do all extensions need to be updated? Or maybe cap2 even has built-in recipes for managing mongrel_clusters :)
29 Jun 2007
The new zipped_stream method worked for me. I’m using the latest instantrails (rails 1.2.3).
29 Jun 2007
@Jeroen, my guess is that mongrel_cluster won’t work with cap2 until the author of mongrel_cluster updates it. I could be wrong, so it’d be worth testing, but I wouldn’t get your hopes up. :)
The good news, though, is that it isn’t very much work to make a cap1 extension work with cap2, generally. So hopefully the author of the mongrel_cluster cap extensions will be able to do that soon.
29 Jun 2007