blob: 0d04e482b953f49542ada750f7bc7dac8b279214 [file] [log] [blame]
<html>
<HEAD>
<TITLE>Ruby and NetBeans IDE</TITLE>
<META NAME="description" CONTENT="NetBeans IDE's support for Ruby covers the full edit-compile-test-debug cycle for Ruby and Ruby on Rails. Klaasjan Tukker, Michael Slater, Michael Cot&eacute;, Charles Lowell, and Joe Bowbeer were among the first ones to give the new Ruby features a try. Here is what they said!">
<link rel="stylesheet" type="text/css" href="../../netbeans.css">
<META NAME="author" CONTENT="Ruth Kusterer" />
</HEAD>
<BODY>
<h1>Ruby and Rails &mdash; How NetBeans Changed my Life</h1>
<div style="padding:0 20 0 0; float:left"><p><img border="1" width="200"
src="http://wiki.netbeans.org/wiki/attach/RubyEditing/ruby-highlighting.png"></p></div>
<p />
<em>
From version 6.0 on, the NetBeans IDE's support for Ruby is as comprehensive
as it is for Java, covering the full edit-compile-test-debug cycle for Ruby and Ruby on Rails.
<p />
Klaasjan Tukker, the president of the Dutch Java User Group
<a href="http://www.nljug.org">NLJUG</a>, web developer Michael Slater,
software industry analyst Michael Cot&eacute;,
developer and software consultant Charles Lowell,
and the Java technology consultant Joe Bowbeer,
were among the first ones to give the new Ruby features a try.
<p />
Here is what they said!
</em>
<p />
<p style="clear:both" />
<h2>The First Impression</h2>
<p />
<p />
Klaasjan Tukker first came into contact with Ruby and Ruby on Rails in 2006.
Like many Ruby developers he soon felt that, instead of a text editor,
he needed an IDE that understood Ruby code semantically.
<p />
"Having worked with Java and PHP, Eclipse was the IDE of my choice, and so I
downloaded the RadRails plugin. The plugin supported basic Rails commands
like scaffolding and project creation. Code highlighting and 'templating
features' were not quite common at that moment," Tukker remembers.
<p />
"Early 2007 I got hooked on the <a href="../../features/ruby/index.html">NetBeans
module for Ruby and Ruby on Rails</a>,"
Tukker adds. "In my day-to-day job, I manage an in-house Java development team.
In the evening hours, I've built a simple membership administration system
for the NLJUG. NetBeans supported this development quite nicely."
<div style="padding:20;text-align:center"><p><img border="1" src="../../images_www/articles/rapid-ruby-weblog/60/generate_model.png"></p></div>
<p />
Michael Slater has a similar story to tell. He develops web applications
with the Ruby on Rails framework and he too was using RadRails.
Then in July 2007, one morning changed his (work) life.
<p />
"[T]his morning I downloaded NetBeans. It took me about two hours to download it,
figure out how to use all the core Rails features,
and get a few projects imported into it from my Subversion repository.
By the end of those two hours, I knew I'd be unlikely to use Aptana [RadRails] again,"
Slater writes in his <a href="http://www.mslater.com/2007/7/3/goodbye-aptana-hello-netbeans">weblog</a>.
<div style="float:right;width:250px;padding:0 0 10 10;font-size:90%">
<P>
<b>NetBeans Tip:</b> Did you know that Control-K automatically completes
any previously typed strings from within the same editor?
Similarly, Control-L completes previously typed strings
found after the insertion point.
Press either shortcut repeatedly to cycle through all possible completions.
</p>
</div>
<p />
"NetBeans just feels more capable and more polished, and while I found a couple bugs
(using the latest [milestone] release), it was much more stable than the current Aptana release,"
Slater continues.
"By mid-day I felt at least as productive in NetBeans as I ever was in RadRails."
<p />
Developer Michael Cot&eacute;, too, was positively surprised by how easy
it was for NetBeans IDE users to get started with new features.
He got curious about the IDE's Ruby support
while doing research for a <a href="http://redmonk.com/cote/2007/06/27/eclipse-europa/">comparison
of the Netbeans and Eclipse platforms</a>.
<p />
"NetBeans typically wants to first tell you how to start pounding nails,
while Eclipse wants to first tell you about the hammer."
Cot&eacute; sums up his impression in his weblog.
"[C]heck out the <a href="../../kb/60/ruby/index.html">NetBeans
Ruby page</a> versus the <a href="http://www.eclipse.org/dltk/">Eclipse Dynamic Languages Toolkit page</a>:
The fact that NetBeans goes with the specific &mdash;Ruby&mdash;
over the general &mdash;dynamic languages&mdash;
is really all you need for the 'ready-to-use tool' vs. 'tool for tools' frame."
<p />
<h2>Features and User Interface</h2>
<p />
<p />
Although the full version of <a href="../releases/60/">NetBeans IDE 6.0</a>
will only be <a href="../releases/roadmap.html">released
in a couple of months</a>, you can already test current <a href="http://services.netbeans.org/downloads/dev.php">development builds</a>
and <a href="../issues.html">give feedback</a> on new features.
<p />
"The speed of development of the team is amazing. The cutting-edge
features are mostly built upon the latest builds of NetBeans IDE 6.0,"
Tukker describes the results of his hunt for the best tool. "I became
a frequent visitor of the Development Download section of the NetBeans
website. About once a week, I update my installation to the latest NetBeans IDE
6.0 and Ruby IDE build."
<div style="padding:20;text-align:center"><p><img border="1" src="http://wiki.netbeans.org/wiki/attach/RubyAddHints/blockvar-fixes.png"></p></div>
<p />
Michael Slater still recalls his first impression of the Ruby project support:
"Some of the features I immediately appreciated were the code hinting,
ability to split the editor window into multiple panes either horizontally or vertically,
better UI for accessing generators and Rake tasks,
highlighting of the begin and end of Ruby methods, blocks, and HTML statements,
and marking of where in each file code has been deleted and inserted."
<div style="float:right;width:250px;padding:0 0 10 10;font-size:90%">
<P>
<b>NetBeans Tip:</b> Use shortcuts to speed up your work:
Typing a colon and then hiting the tabkey inserts
a hash entry of the form <code>:key => "value"</code>.
Pressing <code>#</code> inside a double quoted string will insert <code>#{}</code> with the caret in the middle.
See the lost of all <a href="http://wiki.netbeans.org/wiki/view/RubyShortcuts">Ruby keyboard shortcuts</a> in NetBeans IDE.
</p>
</div>
<p />
And he is not alone: "First of all the project support is super," Tukker confirms.
"Also the code completion and refactorings are very powerful."
<p />
"For a Ruby IDE, mostly I'm looking for code completion," Michael Slater agrees,
referring to the same standard feature for Java IDEs: Code completion speeds up typing by
popping up a list of all options that you have at this spot in your code.
<p />
Unlike Java however, Ruby is not only a dynamically typed language,
its syntax is also a lot more flexible. This is why type inference
&mdash; and thus code completion &mdash; for Ruby
is "not an accurate science," explains Tor Norbye,
well-known in the community as the developer who currently implements
the necessary completion heuristics.
<div style="padding:20;float:left"><p><img border="1" src="http://wiki.netbeans.org/wiki/attach/RubyEditing/singleton-completion.png"></p></div>
<p />
Web application developer Michael Slater is of course especially intersted in
the IDE's Ruby on Rails features.
"The appeal has at least as much to do with Rails and with Ruby,
for which you need easy access to lots of files," he comments on the
quality of the user interface; "It helps to have easy access to Rake tasks,
starting Rails servers, and other Rails-specific items."
<p />
Charles Lowell's favorite NetBeans feature is the Ruby debugger.
"You can use the cruby debugger or jRuby; Netbeans by default uses the jRuby VM
for your projects, but there is no reason you can't run it with regular Ruby.
Either way, you get really nice debugging hooks into the code,"
Lowell points out in his and Cot&eacute;'s recent <a href="http://www.drunkandretired.com/2007/07/30/drunkandretiredcom-podcast-episode-103-ruby-java-ide-chat/">podcast</a>.
"As you're stepping through the debugger, all your code browsing,
completion, documentation information, it's all there,
in a way that it's not in Eclipse or Textmate.
So I do use it for debugging, really sweet."
<p />
So, is there nothing more to wish for? Well, almost nothing.
"There are always nice features you could wish for," Tukker admits,
"like a colored output console, or an integrated <code>tail</code> module."
<p />
<p style="clear:both" />
<h2>Conclusion</h2>
<p />
<p />
"I find it amazing that products of the richness of Aptana and NetBeans are free,"
Slater complements the NetBeans and Aptana development teams in closing.
"They're easily as deep and sophisticated as most of Adobe's $500+ products,
for example, and they're evolving a lot more quickly."
<div style="float:right;width:250px;padding:0 0 10 10;font-size:90%">
<P>
<b>NetBeans Tip:</b> Did you know that you can open files that are not part of a project
in the Favorites window? Select Windows &gt; Favorites for a customizable file browser.
You can also choose Navigate &gt; Go to File or Go to Type from the menu
to search for files and resources in your projects.
</p>
</div>
<p />
Cot&eacute; agrees that NetBeans IDE is one his top two options for Ruby development.
"If I were to start writing code again full-time (Java or Ruby),
I'd certainly check out NetBeans for a while and compare it to Eclipse,"
and he admits, "I wouldn't have considered a non-Eclipse option until recently."
<p />
If you are not convinced yet, Cot&eacute;
has a message for "all you horse-race, zero-sum fans" out there
when he states "[W]e'll have to keep our eye on
<a href="../magazine/html/03/nb06/">NetBeans 6.0</a>.
It's looking slick, esp. with the <a href="../../features/ruby/index.html">Ruby support</a>
and <a href="https://netbeans.org/projects/contrib/">Jackpot</a>."
<p />
For the JUG-leader Tukker there is only one thing he regrets:
"The NetBeans Ruby IDE is still very unknown amongst Java and Ruby
developers." But he is doing all he can to change that:
"When I visit a conference (both on Java and Ruby), I am happy to
show off the wonderful IDE in the making. Keep up the good work!"
<p />
Thank you all for your surport and constructive feedback!
<p /><p />
<h1>Get NetBeans IDE for Ruby</h1>
<h2>Installation and Download</h2>
<ol>
<li><p>Make sure you have a current Java Development Kit installed
(<a href="http://java.sun.com/javase/downloads/index.jsp">download</a>)
<li><p>Download the NetBeans IDE 6.0.
(<a href="../../downloads/index.html">download</a>)
<li><p>Run the NetBeans installer and click Customize.
Check <em>at least</em> "Ruby IDE" and "Base IDE".
This will install NetBeans IDE including support for Ruby,
Rails, the Mongrel server, CVS and Subversion.
</ol>
<p>
Note: As an alternative, a prototype Ruby IDE build exists
with only cvs/subversion, local file history, Ruby, and Rails installed.
Get the <a href="http://deadlock.netbeans.org/hudson/job/ruby/">Ruby-only NetBeans IDE here</a>.
</p>
<h2>How to import and run Ruby Projects in NetBeans</h2>
<p />
<p />
<p>You want to integrate your Ruby scripts with Java code?
Then we recommend using the default JRuby interpreter.
JRuby runs on the Java Virtual Machine and is already built into the IDE.
In all other cases, feel free to set the IDE to use
your system's Ruby interpreter. </p>
<p>
You can always go to the Miscellaneous Options &gt; Ruby panel
to switch from one Ruby interpreter to the other.
Note that switching to another Ruby interpreter
also switches to the associated Rails interpreter.
</p>
<p>To get started:
<ol>
<li>Select New Project from the File menu. Create a new project or
use the wizard to create a Ruby project from existing sources.
The wizard assists you with Ruby as well as Rails projects.
<li>The new Ruby project will appear in the Project window.
Right-click the project and select Run from the context menu to compile and run the application.
<li>You can also access Rake targets from the context menu if you have defined any.
</ol>
<p />
<div style="padding:20;text-align:center;"><p><img border="1" width="600" src="http://wiki.netbeans.org/wiki/attach/RubyProjects/ruby-new-project.png"></p></div>
<p style="clear:both" />
<h1>Further Information</h1>
<h2>Related Links</h2>
<p />
<p />
<ol>
<li><a href="../../features/ruby/index.html">Ruby Development with NetBeans IDE &mdash; Home</a></li>
<li><a href="../../kb/60/ruby/index.html">Ruby Development with NetBeans &mdash; tutorials</a></li>
<li><a href="http://wiki.netbeans.org/wiki/view/Ruby">The Ruby wiki</a> with the latest feature news and screenshots.</li>
<li><a href="http://ruby.netbeans.org/">The Ruby for NetBeans project</a></li>
</ol>
<h2>Sources</h2>
<p />
<p />
<ol>
<li><a href="http://blogs.sun.com/roumen/entry/netbeans_podcast_episode_32_interview">Roman's
NetBeans Podcast: Tor Norbye talks about Ruby</a></li>
<li><a href="http://blogs.sun.com/tor/">Tor Norbye's Blog</a></li>
<li><a href="http://www.oopsla.org/oopsla2007/index.php?page=sub&id=69">Meet Joe Bowbeer at the OOPSLA conference</a>
in October 2007. </li>
<li><a href="http://redmonk.com/cote/2007/06/27/eclipse-europa/">Cot&eacute;'s Blog about Eclipse and NetBeans</a>. </li>
<li>Cot&eacute;'s and Charles'
<a href="http://www.drunkandretired.com/2007/07/30/drunkandretiredcom-podcast-episode-103-ruby-java-ide-chat/">Podcast about Ruby and Java IDEs.</a></li>
<li><a href="http://www.mslater.com/2007/7/3/goodbye-aptana-hello-netbeans">Michael Slater's Blog</a> about Ruby IDEs</li>
<li><a href="http://www.nljug.org">Klaasjan Tukker's NLJUG</a></li>
</ol>
</body>
</html>