NetBeans+Ruby Demos

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.

Comments:

Cool, nice looking Gem manager! Do you happen to know the best way to add Markaby (.mab) extensions as ruby source file types? I've tried through the advanced options editor but NullPointerExceptions seem to be thrown. Other than that I haven't had too many problems using the nightly builds, the progress of it is coming along nicely. I will be fully switching over once it hits a stable release.

Posted by Dan on March 06, 2007 at 05:58 AM PST #

Fantastic job -- looking forward to debugging in M8. Some small problems: 1) how to add new gems (running in Ubuntu 6.1) and need root mode? 2) how to generate "processor" for activemessaging? Can you change the combobox to allow the user to add new items to the generate combobox? (Had same problem in RADRails). As a Newbie, your HELP is awesome and significantly shortens the learning curve.

Posted by Chris Michael on March 06, 2007 at 06:16 PM PST #

awesome. I fund one problem. when typing puts "#{some_var}" Netbeans does no longer do anything after I typed "{". still Netbeans is my new IDE of choice for Ruby and when it will have refactoring sometime it will be a real killer

Posted by Stefan on March 06, 2007 at 10:47 PM PST #

Hi Tor, The ruby module is great, I can't believe how quickly you're putting this stuff together. Can I echo Chris' comment about the generate dialogue. Having made a bold leap into the world of resources I miss seeing the scaffold_resource generator. Do you know if anyone is working on syntax and formatting for .yml files at the moment?

Posted by james hoskins on March 07, 2007 at 12: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 02:11 PM PST #

Hi Tor, I have really enjoyed playing around with the Ruby module that you have been writing. At the moment I'm looking into the support that is available for Rails development. Have you added support yet for issuing a `rake migrate` command? Also, would you have an idea why the JRuby's IRB implementation does not recognize the `rake` command?

Posted by Chad Oliver on March 09, 2007 at 01:13 AM PST #

This is great indeed! What I really like is the integration of all things Ruby and Rails in a context, rather than in a file tree. The Gem support is just the thing to make an IDE truly Integrated. Still, one thing is beyond me: how do I add a gem that is not online? The Hobo gem is of particular interest to me and I have yet to see how I can add this. Furthermore, the Hobo gem provides a couple of new generators that it would be splendid if it was possible to add to the IDE as well. It sort of looses all meaning if one can not run the generators, you see... :-)

Posted by Karl-Koenig Koenigsson on March 11, 2007 at 11:43 PM PDT #

I have been using Java for 10 years and Ruby for a month. Answering my own question I posted earlier - I figured out that you can not run Rake from IRB, but do you have plans to expose both the Ruby Console and the Rake command from within Netbeans? Currently, I'm using the combination of Netbeans and Instant Rails to do Rails development. Instant Rails is used to run both Rake and the Ruby console, while I use Netbeans for all the other development related tasks.

Posted by Chad Oliver on March 12, 2007 at 01:17 AM PDT #

Chad, what is the "Ruby Console" ? If it's IRB, that should already be there - check the Windows menu. I do plan on supporting running Rake, and as I understand there is a "Rails console" which I'll also be adding.

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 04:21 AM PDT #

Hi Tor, When you use Instant Rails, there is a menu option called "Open Ruby Console Window". The Ruby Console is just a shell (BASH) window open to the directory of the current Rails project. The term `Ruby Console` might be something that the Instant Rails developers came up with. The `Ruby Console` will be unnecessary once Rake and the Rails Console become available within Netbeans.

Posted by Chad Oliver on March 12, 2007 at 05:32 AM 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 12, 2007 at 10:58 PM 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 02:29 AM PDT #

Tor: Cool, thanks! Is there anywhere to grab the latest Ruby modules aside from the update center?

Posted by Dan on March 13, 2007 at 04:06 AM PDT #

Tor: Nevermind, tracked it down. :)

Posted by Dan on March 13, 2007 at 04: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 04:22 AM PDT #

Ruby+Netbeans is amazing. But when I typed a dot "." the code completion doesn't work. do I must use the "CTRL+SPACE" for code completion?

Posted by Bob on March 13, 2007 at 08:44 PM 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 01: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 02:20 AM PDT #

Post a Comment:
Comments are closed for this entry.
About

Tor Norbye

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today