Rfactor: Ruby Refactoring for your loved editor

I know we all love Ruby, and doesn’t care that much about not having auto completion/IntelliSense available.

I don’t care that much about auto completion, when coding in Ruby, myself. What I really like in Java IDEs is their refactoring support. Eclipse and IntelliJ IDEA are simply awesome in this space for Java. We still have ReSharper for Visual Studio and others, targeting other languages. Ruby has NetBeans, Aptana RadRails, RubyMine and TurboRuby/3rdRail doing a great job in this area.

But, I have this feeling that most of Ruby developers do not use IDEs (including myself). We are using good text editors, such as TextMate, Vim, Emacs and GEdit. They are good enough. Why would I need something else?

I have to admit. I really miss some refactorings while programming in Ruby. Particularly, the lack of “Extract Method” and “Extract Variable” bothers me. They aren’t even complicated, why hasn’t someone already implemented them?

So, I would like to introduce Rfactor. It is a Ruby gem, which aims to provide common and simple refactorings for Ruby code. RubyParser from Ryan Davis is being used to analyze and manipulate the source code AST, in the form of Sexps.

In theory, we should be able to use Rfactor to power any editor, adding refactoring capabilities to it. I’m targeting TextMate, but I would love to see contributions for others. The TextMate Bundle is hosted on github:

Rfactor TextMate Bundle, with installation instructions

This very first release has support only for basic “Extract Method”: inside methods and without trying to guess the method parameters and return.

Stay in touch, there is much more coming!


JettyRails 0.7, Merb 1.0 support

After the 1.0 official release, Merb is gaining more and more attention.

I’ve updated JettyRails to support Merb 1.0 applications, making it a good choice to run your rails and merb applications with JRuby, particularly in development time.

The release notes include:

* Merb 1.0 support!
* jruby-rack updated to the latest release (0.9.3)
* jetty server update to 6.1.14
* JSP and JSP Expression Language support
* some minor bugs

It is very simple to run any Merb 1.0.x and Rails 2.x applications. You just need to have JRuby properly installed, but JettyRails doesn’t work with jruby-1.1.4 (JRUBY-2959). First step is to install jetty-rails:

jruby -S gem install jetty-rails

Then, for Rails applications:

cd myrailsapp
jruby -S jetty_rails

And for Merb applications:

cd mymerbapp
jruby -S jetty_merb

Please note that you can’t use Merb with DataMapper in JRuby right now, but ActiveRecord does the job. Work is being done by Yehuda Katz (wycats) and Nick Sieger to port the native parts of DataObjects (used by DataMapper) in the do_jdbc project. Because of that, you can’t just install the merb gem. Wanted Merb modules should be installed separately:

jruby -S gem install merb-core # required
jruby -S gem install merb-more # extras