Friday May 18, 2007 First the screenshot - click for full resolution:
The NetBeans Ruby support now lets you debug Rails applications. As the screenshot shows, you can even step right through RHTML files! All the usual debugging features are there - breakpoints, stack view, local variables view - and balloon evaluation, where you hover the mouse over a variable and it displays the current value as a tooltip.
I can't take any credit for this; the debugger has been written by Martin Krauskopf, and uses the debug-commons library. Martin was my co-speaker for the Ruby talk (TS-9972) at JavaOne. If you missed it, Brian Leonard will be doing the same talk at RailsConf this weekend. One thing I want to clarify is that not everything I talked about in the type inference section is actually implemented yet in NetBeans. The talk represents everything I plan to do, not everything I've already done.
Note that the RHTML debugging feature is not present in the recent Milestone 9 bits. We've made a lot of improvements since then. Just this morning I integrated various fixes to make code completion work much better in Rails. You now properly get code completion in your model and migration files etc - as the following screenshot shows:
Another feature we added after Milestone 9 was some preliminary support for Auto Test - see the testing page for some screenshots and more info.
For now, I recommend that you use NetBeans Milestone 9 as your base IDE, and then use the trunk/daily Ruby bits with them. The easiest way to do that is to install Milestone 9, then follow the instructions in the RubyInstallation wiki page to blow away the ruby1 cluster in your M9 installation and replace it with a .zip download from deadlock.nbextras.org. Also be sure to nuke your userdir for any custom installed modules there (usually ~/.netbeans/dev). In the future, staying up to date with the Tools | Plugins manager will be easy, but with Milestone 9, it only displays branched Milestone 9 modules, and we aren't merging and rebuilding the Ruby stuff into the M9 branch at this point.
If all that sounded complicated, just go and download the Ruby-only IDE zip here. Get the zip containing rubyide in the name, unzip somewhere, and run nbrubyide/bin/nbrubyide. This will be daily-everything as opposed to a stable IDE + trunk Ruby, but - it will probably be okay.
Finally, if you're going to be debugging, make sure you first visit the RubyDebugging wiki page which will tell you some really important configuration information - like how to enable fast debugging.
(2007-05-18 09:45:49.0) Permalink Comments [36]
Posted by Greg on May 18, 2007 at 12:08 PM PDT #
Posted by Martin Krauskopf on May 18, 2007 at 01:06 PM PDT #
Posted by Greg on May 18, 2007 at 08:18 PM PDT #
Posted by hemant kumar on May 18, 2007 at 10:42 PM PDT #
Posted by hemant kumar on May 18, 2007 at 11:02 PM PDT #
Posted by Eugene on May 19, 2007 at 02:54 AM PDT #
Posted by hemant kumar on May 19, 2007 at 02:57 AM PDT #
Hemant, regarding the implementation-version problem: On May 16 one of the APIs the Ruby support depends on changed incompatibly. I adjusted the Ruby support about 36 hours later (when I discovered it), so all the builds in between would have had problems. But it should be working now. Unfortunately, deadlock.nbextras.org seems to be down at the moment (sigh! Luckily it's scheduled to be replaced by a much beefier production system shortly) so I can't verify.
Eugene, I had forgotten about the debugging toolbar problem. Ugh, that means I probably shouldn't have pointed to the Ruby-only IDE in a blog entry on debugging! This happens in the Ruby-only IDE at the moment (there's an open bug report on it) and I believe it will be addressed shortly. Martin is on the case :-) The problem was that the debugging toolbar is getting registered by a Java-related debugger module which isn't present in the ruby-only IDE.
Hemant, do you have any ideas for how we should make it easier to add a file? I'm thinking of adding some quick-tip style functionality which should make it easier to create methods and classes for the symbol under the caret, but do you have other ideas?
Posted by Tor Norbye's Weblog on May 19, 2007 at 08:41 AM PDT #
Hemant, I overlooked your TextMate comment. Have you looked at this blog entry: http://blogs.sun.com/tor/entry/ruby_screenshot_of_the_week7. One very important part about that article is that it has a link to a separate module you have to download and install. This mechanism isn't in the base IDE yet.
I'd really like to add some more bundles into the default IDE rather than relying on import from others. If anyone has any snippets they'd like to contribute, please send them my way.
Posted by Tor Norbye's Weblog on May 19, 2007 at 08:44 AM PDT #
Posted by Eugene on May 19, 2007 at 09:11 AM PDT #
Posted by phil swenson on May 19, 2007 at 10:20 AM PDT #
it's being added for Milestone 10. But you can download a plugin and use it now - it works well (I use it all the time): http://deadlock.nbextras.org/hudson/job/go%20to%20file/
There's also a preliminary Go To Type module (will also be part of the standard build - more info and download link here: http://blogs.sun.com/tor/entry/saturday_morning_hack
Posted by Tor Norbye's Weblog on May 19, 2007 at 12:38 PM PDT #
Posted by Eugene on May 20, 2007 at 01:57 AM PDT #
regarding toolbar and menu, I'm trying to solve this. Hopefully on Monday. http://www.netbeans.org/issues/show_bug.cgi?id=102945
Conditional breakpoint: http://www.netbeans.org/issues/show_bug.cgi?id=100096
Again, should be for 6.0. I'm leaving for 2 weeks next week. So the debugger progress will be probably stopped a little bit until I return.
Posted by Martin Krauskopf on May 20, 2007 at 09:44 AM PDT #
Posted by hemant kumar on May 20, 2007 at 10:28 AM PDT #
Which led to another problem, when i blew away my nbm installation, i lost all my snippets that i created manually(*sigh*). Yes, there should be way to export snippets or at least back them up.
Posted by hemant kumar on May 20, 2007 at 10:48 AM PDT #
Hi Hemant, thanks for the exception; the only way I can see this happening from inspecting the code is if you point the importer to a .tmbundle directory that doesn't contain a "Snippets" subdirectory?
Would you mind mailing me directly (tor.norbye@sun.com) a zip of the snippets directory you're trying to import? It's also important that you choose the directory named "<whatever>.tmbundle" as the bundle to be imported - not individual snippet files. I thought the file import filter tried to enforce that, but it may not be working properly.
Posted by Tor Norbye's Weblog on May 20, 2007 at 10:50 AM PDT #
One thing you can try is to run with a new userdirectory; e.g. netbeans --userdir /tmp/nonexistent/. Does that help?
I tried downloading a nbrubyide build yesterday, blew away my ~/.nbrubyide dir and it started without the warning.
There also should be a way to export snippets via the CodeTemplateTools module, I'll go look for it (but it will have to be later tonight, I have to run now). In any case, using --userdir to point to an alternative user directory is safer since you don't actually delete your old userdir (where the snippets live).
Sorry about all the installation trouble. Hopefully soon we'll have this ironed out such that you can use only the plugin manager to fetch updates.
Posted by Tor Norbye's Weblog on May 20, 2007 at 10:55 AM PDT #
yes, my mistake regarding absence of snippets directory from tmbundle. I wasn't familiar with Textmate snippets mechanism actually. Sorry about this stupidity.
Anyways, I am really puzzled with userdir stuff. I would try to list out my woes.
1. I download plain nbm ML9 and install ruby module via zip file provided at deadlock.nbextras.org. Now, I don't have a .nbrubyide directory, neither do i have a ~/.netbeans/dev directory as suggested in one of your earlier posts. I have a ~/.netbeans/netbeans-6.09 and ~/.nbi and ~/.netbeans-derby. So i delete them all and try to restart netbeans with latest ruby bits and i get above said problem. I think, my problem is, you guys are using latest build of netbeans which comes with version 4 Common Scripting framework, and ML9 with 3 and hence the problem.
2. I download nbrubyide from deadlock.nbextras.org. and i experience following problems. It goes in some kind of infinite loop when its scanning Typo gem. So top shows netbeans running with almost 100% of CPU and 10% of memory usage and library scanning halted, although IDE is still responsive. nbrubyide, hangs when i try to open a netbeans project which was created by IDE installed using approach #1. I tried to run nbrubyide with strace and find out, where the heck its going in infinite loop, but strace doesn't cut through JVM as i see.
Posted by hemant kumar on May 20, 2007 at 12:09 PM PDT #
Posted by Tor Norbye's Weblog on May 21, 2007 at 02:34 PM PDT #
Posted by Stephen Brown on May 21, 2007 at 05:51 PM PDT #
Posted by Martin Krauskopf on May 21, 2007 at 11:51 PM PDT #
Posted by Eugene on May 22, 2007 at 02:08 PM PDT #
Posted by Jonas Tehler on May 22, 2007 at 11:04 PM PDT #
Posted by Greg on May 23, 2007 at 11:15 AM PDT #
Posted by Jonas Tehler on May 23, 2007 at 12:02 PM PDT #
I'm not sure what to do about the incompatibility; one of the APIs the Ruby support depends on changed incompatibly. I've adjusted the Ruby code such that it compiles and runs with the IDE trunk; making it work with M9 seems harder (I thought I had made it work but it sounds like it's not). Hopefully these APIs will be stabilizing when we reach feature freeze!
Hi Greg - regarding the catch-22: What is the problem with the jvi plugins and rubyide? I don't see why it would depend on the Java support (which is missing in rubyide). I downloaded it to take a look but it looks like the jvi code depends on JDK 6! (java.util.Deque) - and I don't have that on this Mac. If there's something in jvi which depends on java I'd like to talk to the developer to see if we can make it work. Or, if it simply depends on some other infrastructure module that I've needlessly ripped out in the rubyide, I can place it back in.
Posted by Tor Norbye's Weblog on May 23, 2007 at 08:11 PM PDT #
Posted by Vincent Tencé on May 24, 2007 at 09:02 AM PDT #
Posted by Vincent Tencé on May 24, 2007 at 09:38 AM PDT #
Posted by Greg on May 24, 2007 at 11:32 AM PDT #
Hi Vincent, thanks for the wiki page on rubygems. I've just checked in some support for rspec debugging. See http://wiki.netbeans.org/wiki/view/RubyRecentChanges. (This is usually Martin's territory, but he's on vacation so I took a quick stab at it, and it worked for my simple test case). For Ruby debugging with NetBeans in general, see the Ruby debugging page, since there's some important configuraiton you have to do to set it up - http://wiki.netbeans.org/wiki/view/RubyDebugging.
This should be available in build 1362 shortly on http://deadlock.nbextras.org/hudson/job/ruby/.
Posted by Tor Norbye's Weblog on May 28, 2007 at 03:39 PM PDT #
Posted by Vincent Tencé on June 04, 2007 at 02:16 PM PDT #
Posted by Vincent Tencé on June 05, 2007 at 07:01 PM PDT #
Posted by Vincent Tencé on June 05, 2007 at 07:02 PM PDT #
Posted by Tor Norbye on June 05, 2007 at 07:53 PM PDT #
Posted by Tor Norbye's Weblog on June 11, 2007 at 08:28 PM PDT #