Monday March 05, 2007 Roman has created two excellent demos of the new NetBeans + Ruby support. The first one shows Rails support, the second gets into editing. Let me me point out that until now, my focus has been on editing - so the Rails support is very preliminary. The interesting features are in the editing area, but as the Rails demo shows, if you're building a Rails application you should be able to get your work done. (There is an open bug pertaining to process management - launched Ruby processes aren't always killed by the IDE, so keep an eye on your process list for older processes. Yes, it will be fixed!)
Here's a quick hint, since it's not really obvious from the IDE: Use Shift F6 early and often. It "runs" the current file. For a unit test, that will run the tests. In a Rails app, it will open the browser on the "relevant" URL. For example, if you're editing a controller, or a view, or a helper, it will show the associated view.
I recently added a new feature to the editor you can play with: Smart Selection. Press Ctrl-Shift-Up/Down (on the Mac, Command-Shift up/down). It will select progressively larger code blocks based on the parse tree. Within a comment, it first selects the line, then the whole comment block.
Finally, I just integrated a Ruby Gem Manager (available from the Tools menu). This lets you easily see which Ruby gems you have installed, and more importantly upgrade them or install new ones. This assumes there is a gem command next to your Ruby interpreter, which is the case for the bundled JRuby, but maybe not if you're configured NetBeans to run with whatever you have installed in /usr/.
Here's a screenshot of the initial screen - my locally installed gems:
Here's what you get when you click on Install New:
Actually, if you just press Install New you see a much larger list - all available gems. You can filter down the list by typing in the Filter field - regular expressions are okay. Here I've typed rails to see any gems that have "rails" in the name or description.
I'm writing this from San Francisco international airport - I'm waiting for my flight out to Denver for the Posse Roundup 2007. It's going to be a fantastic week - technical talks, skiing, and of course I'm excited to see the unveiling of Josh Marinacci and Robert Cooper's project. With all the attention around the Ruby work this week it's bad timing to go off the grid, but at least I can leave by pointing out that this is an open source project, all the code is available and if there's a fatal bug in there, somebody can find it and fix it! Have a great week - I know I will.
P.S. I've seen lots of blog entries around the NetBeans Ruby support lately - thank you all for trying it out and writing about it. I found this Ruby IDE comparison particularly interesting.
(2007-03-05 10:13:36.0) Permalink Comments [18]
Posted by Dan on March 06, 2007 at 01:58 PM PST #
Posted by Chris Michael on March 07, 2007 at 02:16 AM PST #
Posted by Stefan on March 07, 2007 at 06:47 AM PST #
Posted by james hoskins on March 07, 2007 at 08:09 AM PST #
Hi everyone, thanks for your comments and feedback! I'm glad to hear that overall you're happy.
Dan: Are .mab files common? If so, I can add them to the builtin list of file extensions known to be Ruby files. (There is supposed to be a way to do it manually - but it doesn't appear to work - I've gotta look into that (here's what I wrote first: Go to the Options/Preferences dialog, click on the "Advanced" button, drill into IDE Configuration | System | Object Types and choose "Source Files for Ruby". In the property sheet, add "mab" to the extensions and mime types list. You then need to restart the IDE.)
Chris: I'm not sure what to do about root mode yet. I think I may need some platform specific code here on each platform to invoke the authentication services. On Linux I assume it would just involve running sudo. Making the generator dialog more flexible in allowing arbitrary generator names sounds reasonable.
Stefan: I believe the #{some_var} bug was fixed a while ago (like a week and a half ago). Are you using current bits? If so I'd like to know how to reproduce it (I have a unit test regression test for it which is passing so if it's still there it must take some additional steps).
James: I'll try to make the generator more flexible. Regarding YAML support, that is coming.
Posted by Tor Norbye on March 07, 2007 at 10:11 PM PST #
Posted by Chad Oliver on March 09, 2007 at 09:13 AM PST #
Posted by Karl-Koenig Koenigsson on March 12, 2007 at 06:43 AM PDT #
Posted by Chad Oliver on March 12, 2007 at 08:17 AM PDT #
Dan, .mab files should show up as Ruby files now (whenever the update center catches up).
Posted by Tor Norbye on March 12, 2007 at 11:21 AM PDT #
Posted by Chad Oliver on March 12, 2007 at 12:32 PM PDT #
Hi Tor,
I don't know how many of these things are suitable for integration into netbeans, in fact most probably wouldn't be, but they help me to get things done!
When developing rails I tend to start with script/console which is great for poking your application - testing models, routes, that kind of thing. Autotest is left running in the background to keep me virtuous and I like to have tail running on the development log so I can spot any stupid mistakes. My tests use a sqlite db running in memory and another console is left open to install any plugins through script/plugin or rapt. Mongrel is perfect as a development server.
Posted by james hoskins on March 13, 2007 at 05:58 AM PDT #
Thinking about it, most of these things are probably best done in a shell/console rather than the ide. It's certainly satisfying to develop with Autotest churning away in the background.
The thing I miss in Netbeans at the moment - having used Radrails in the past - is the ability to jump easily between actions and their views.
Posted by james hoskins on March 13, 2007 at 09:29 AM PDT #
Posted by Dan on March 13, 2007 at 11:06 AM PDT #
Posted by Dan on March 13, 2007 at 11:21 AM PDT #
Yes - there is a continuous build here:
http://deadlock.nbextras.org/hudson/job/ruby/
You can see both a cluster .zip (which you can install in your IDE as documented here: http://wiki.netbeans.org/wiki/view/RubyBuildInstructions. (Ignore the Build instructions).
There is also a new full IDE .zip which is customized Ruby-only version of NetBeans. This is brand new and has some issues (such as poor Mac integration because it's missing the ide/applemenu module which provides a bunch of important Mac stuff, like rebinding Command-Q, moving Tools | Options to Preferences, etc. I also heard that instant-rename isn't working in the Ruby IDE, presumably because some other editor infrastructure is missing. We'll get those issues ironed out soon.
Btw, thanks all for the various Rails feature feedback - I'll try to improve that area soon.
Posted by Tor Norbye on March 13, 2007 at 11:22 AM PDT #
Posted by Bob on March 14, 2007 at 03:44 AM PDT #
Tor,
I noticed on issue digest that you are having problems controlling webrick. Is there a special reason why you are using it as the default rails development server? I would suggest that a significant majority of rails developers use Mongrel and that the dog of uncertain parentage would be a good default choice in Netbeans.
Then again, there might be some issues with JRuby because it contains some C extensions - Ragel state machine - you could ask Zeb Shaw about it.
Posted by james hoskins on March 14, 2007 at 08:00 AM PDT #
Bob: Yes, you have to type Ctrl-Space to invoke code completion. I used to have it automatically invoke completion on . but it was getting in the way. I will probably revisit that soon. Just yesterday I made :: automatically invoke code completion.
James - yes, it will work with Mongrel too, although it had the same process control issues that webrick had (which by the way I believe are fixed in recent builds). I also intend to support non-JRuby execution of Ruby and Rails - there's just a bug preventing this from working well (I/O issue).
Posted by Tor Norbye on March 14, 2007 at 09:20 AM PDT #