Aptana Studio 1.0 Released!
Wow it's been quite a while since I last posted. In the meantime I've been working hard on RDT and RadRails at Aptana and the job has been great. I'm very lucky to have found a way to work on the open source projects I love full-time.
In that vein I'd like to announce that we've released the 1.0 of Aptana. This release is important for a number of reasons. First, we think the product is good-to-go for everyone. Second, we're announcing a Pro version of the IDE. This version is for users who want to support the project so we can keep going, or who want the extra features and perks that come with a license: nightly build access, priority support, IE Javascript Debugger, SFTP/FTPS support and all sorts of other goodies. The support, nightly builds, SVN access also apply to the other components of what we're now calling Aptana Studio: RadRails, iPhone, PHP and AIR. So if you want to be on the bleeding edge of RadRails/RDT development you'll probably want to look into getting a license.
Keep in mind that while we do offer a pro version for those who'd like to support us or the extra stuff, we are still shipping the same codebase (minus the commercial features) as an open source project under GPL. And we plan to remain an open-source company with an open source product. Here's hoping that model will work for us!
Aptana backs RDT, hires me
I'm proud to announce today that Aptana has hired me to work full-time on RDT, RadRails and integrating that work with their existing Aptana IDE which focuses on CSS, HTML and Javascript.
This announcement means that RDT will now have commercial backing (but will remain open-source and free!) and that you should see RDT and RadRails move forward at a much quicker pace than in the past.
This is also great news for RadRails users and Rails developers in general as integrating the two will give you code completion, outlines, help, debugging and much more across the entire stack - from model to controller to the HTML, ruby code, CSS and Javascript that make up your views.
Patterns in Ruby: Decorator revisited
A while back I wrote an article describing some possible ways to implement a
Decorator pattern in Ruby.
I've stumbled across several mentions of
yet another idiom used so often in the Rails codebase that they've extracted
it into the latest ActiveSupport. That idiom is
alias_method_chain,
and it's a good example of a decorator implementation.
This idiom is a codified example of using the alias approach I briefly mentioned in the earlier article. In that article we aliased the original implementation with anew name, and set up a new implementation of our method (often delegating to the original) with the original's name. A quick example makes this clear:
class Window
def draw
# do some drawing here...
end
# some code...
# creates a 'copy' of draw method, but gives it
# the name/selector 'original_draw'
alias :original_draw :draw
def draw
draw_vertical_scrollbar
original_draw
end
endalias_method_chain
In Rails 1.2 (ActiveSupport specifically), the Rails core team found many instances of this pattern
and codified a new method on the class Module, alias_method_chain. This class-level method encapsulates this
pattern of wrapping existing methods with additional behavior.
Here's a specific example, showing how they would wrap rendering with layouts:
alias_method :render_with_no_layout, :render
alias_method :render, :render_with_a_layoutIn this small code snippet, they are creating a small chain of methods to wrap the existing render behavior.
Now calls to render will be routed to render_with_a_layout and then on to the original render implementation
(which is now aliased to render_with_no_layout). So they coded up alias_method_chain which simply does
the wrapping for them (using naming conventions):
class Module
# Encapsulates the common pattern of:
#
# alias_method :foo_without_feature, :foo
# alias_method :foo, :foo_with_feature
#
# With this, you simply do:
#
# alias_method_chain :foo, :feature
#
# And both aliases are set up for you.
def alias_method_chain(target, feature)
alias_method "#{target}_without_#{feature}", target
alias_method target, "#{target}_with_#{feature}"
end
endPlease note that if they were to replace their existing two calls to alias_method above, they would need to tweak the naming a little
(the methods would become render_without_layout and render_with_layout as opposed to
render_with_no_layout and render_with_a_layout respectively).
Multi-stage deployments with Capistrano
I'm seeing a recurring theme in my feed reader today - multi-stage deployments with Capistrano. It seems that those of us working in larger companies have all hit the same issue - we have some form of user acceptance, staging or other system which mirrors the production in configuration; and we want to use Capistrano to deploy to it as well as production. I know that my current company has a 5-stage process for pushing out releases (we're in financial services, and very paranoid. Whether they'd ever accept Capistrano is another issue).
So here are my lazy pointers to the discussions:
Ola Bini, who's been doing some great posts on ruby metaprogramming, calls out his need for a "production_test" environment.
Simon Harris shares some snippets of deploying to his staged server running mongrel.
Jamis Buck, the creator of Capistrano, weighed in a while ago on multiple deployment stages
Update: Michael Buffington shares his Mongrel deployment for multiple stages
