Wednesday, March 28, 2007

Ruby Screenshot of the Week #7

WARNING: This blog entry was imported from my old blog on blogs.sun.com (which used different blogging software), so formatting and links may not be correct.






Since I cheated last week, I'll make up for it by posting several screenshots this week.



First: The continuous builds on deadlock.nbextras.org are back up and running. One of the things you'll find there is a Ruby-only slimmed down version of NetBeans. This might be attractive for those of you who are used to editing Ruby and think of IDEs as overkill. The download is not tiny, but that's because it includes a full installation of JRuby as well as Ruby On Rails and all its supporting libraries. Perhaps we can create a configuration which doesn't JRuby and Rails, since the tool is also perfectly happy to use any existing installations of Ruby and Rails you might point it at.



The configuration is experimental, so menu items etc. might not always be ordered correctly. But if you're a Ruby-only programmer, you'll find it less crowded than the full-featured IDE, and a faster download.



I've tried to improve the Rails support lately, since I've gotten lots of feedback from developers using NetBeans+Ruby with Rails.



Rails projects now have a "Rake Target" action, which is a pull right menu. The pull right shows, hierarchically, all the rake targets available for the project. The target descriptions, if any, are shown as tooltips. Recently executed targets are listed before the hierarchical list of available targets. (Determining the set of targets for the UI is expensive, so it is not kept up to date automatically. There is therefore an explicit user action for refreshing the list when you have edited your Rakefiles or have installed software which adds available targets.)






Database migrations are supported in a similar way. There is a "Migrate Database" context menu (as you can see above). It's a pull right menu which lets you choose either to migrate to the current version, or a specific version (the IDE lists versions that it finds in the migrations directory). You can also "run" any of your migrations files (Shift-F6), and this will run the corresponding migrations target with the version number of the migrations file.



Rails supports lots of additional code generators, performing tasks from generating login pages to localizations and sparklines. The Generator action is now fully aware of generator plugins. They show up in the generator drop down, and usage information is displayed for all generators right there, inlined in the generator dialog. In addition, there is an action for quickly installing more code generators in the Gem Manager.






I just integrated support for running the Mongrel web server, which is popular with many Rails developers. All you need to do now is install Mongrel via the Gem Manager and run your application.






Finally, it's been a few weeks since I added it, but it's useful enough to point out in case you missed it: There is a command for jumping from actions to views and back (Ctrl-Shift-View). It's in the Go To context menu as well.


45 comments:

  1. Awesome. rake & db migration!
    BTW - I am thinking ditching my Windows and going with Mac. Netbeans looks so much nicer in Mac than Windows.
    Thanks!

    ReplyDelete
  2. Ugh, that's a bug - I guess it occurs on Windows. I've checked in a fix for it; the result will appear in build #608 - #607 is just wrapping up.

    ReplyDelete
  3. wow! lightning fast! will check it out later.
    thank you!

    ReplyDelete
  4. Hm.. the minimal configuration doesn't seem to be indexing my apps on startup. I have the modules installed on the latest build as well and it seems to index it fine.

    ReplyDelete
  5. Just to check: You're observing that your own classes are not available in goto-declaration or code completion, right? It's not that you don't see indexing messages in the status bar, correct?
    I've implemented pre-indexing such that indexing should be really really fast these days - there shouldn't be any significant indexing on startup (unless you point to your own ruby, such as /usr/bin/ruby - in that case there's quite a pause...)

    ReplyDelete
  6. Tor,
    Yeah, primarily the code-completion. There is no indexing messages in the status bar when I start up, it just displays the 'Opening Main Window' message on the left side of the status bar.
    I've tested pointing to my own ruby as well and it doesn't display any indexing messages and I don't notice any significant pause.
    I definitely noticed a speed increase awhile back and aren't having any problems when using the Netbeans Daily builds with the modules, just the minimial configuration.
    I poked around the logs and found that these warnings were being spat out around the time the index would normally be happening:
    WARNING [global]: Ignoring root with no ClassPath: /home/dinsley/NetBeansProjects/railsappname/app/controllers

    ReplyDelete
  7. Tor, I'm still having some stability problems, perhaps because I'd decided to load a few of the other latest modules besides the Ruby modules. I'm on the Mac (OSX) and tried dropping the Netbeans icon into the trash, downloaded the latest daily build, and unpack and use this one.


    Netbeans still seemed to pickup my previous modules?


    What is the correct way to UnInstall netbeans on the Mac platform? (so I can start again from scratch with the latest daily build, and then just add the Ruby modules)


    Thanks Greg

    ReplyDelete
  8. GregH: try deleting the ~/.netbeans directory.
    Tor: A stripped down ide, server output in the bottom window, mongrel support...wow, I feel like a kid on Christmas morning right now.

    ReplyDelete
  9. Anyone able to offer comments in regards to productivity of this vs RadRails/Aptana (with nightly RDT builds) vs TextMate vs Ruby in Steel on MS VS 2005? I'm really eager to hear which is the most complete bundle or quickest with which to work at the moment from someone that's been around the block.

    ReplyDelete
  10. Hi Tor,
    I see a lot of Ruby/JRuby used for web applications via Rails/Grails.



    But, do you happen to know if Ruby/JRuby can be used as the language behind Matisse when developing Swing applications. That is to say, can we interchange between Java and Ruby/JRuby to write GUI (Swing) and Web applications, and at the same time will all the designers (Matisse form designer or VisualWebPack) within Netbeans generate the respective language skeletal code when we write event handlers? So, are there future plans for this, if it isn't already in the works? That would be really great.

    ReplyDelete
  11. Hi Tor,
    Thanks for the reply.
    You can add my vote to have Ruby integrated into the GUI builders on the shortlist.

    It might help in the proliferation desktop applications for all platforms that support Ruby & Java. I see Ruby+Netbeans+Matisse as the equivalent of (Visual) Basic, but only better. Perhaps, it could happen after the new Databinding in Swing+Matisse is completed ie. the next upgrade of Netbeans6.

    Thanks.

    ReplyDelete
  12. Hey Tor, thanks very much for that link. I'll take a look and see what I can glean. Just going through your blog it seems like you've got a tremendous amount of steam pushing you along. I'm extremely excited to see the forward motion of this!!!
    I am curious, I've been asking some developers that work with ERD style diagram apps to add migration support where you can slide up and down through a migration and see it visually represented as that would be a tremendous help. I've found that whenever you can draw out your models and logic the better developer one is and I thought that that would be super handy as well as visual rhtml design and development, etc.
    I'm going to be downloading the most recent build today and give NB a spin to see what exactly is going on, but I'm really excited to see some of the work happening.
    We have had some interesting discussion going on over at the Aptana forums right now as well:
    http://www.aptana.com/forums/viewtopic.php?t=1117
    There are some milestones that I'd seen before with Ruby in Steel that I thought were quite interesting and should provide some guidance for your own todos:
    --BEGIN PASTE--
    1.01
    - Vista Support
    - More IntelliSense...
    1.1
    - Zero, one or more minor (1.0x) releases may be made to fix problems reported by users and to make relatively small changes, if required.
    1.2 May Visual Rails Developer
    - Visual Web Page Designer for Rails
    - Enhanced RHTML editor
    1.3x 2nd – 3rd quarter 2007 RHTML Additions
    - RHTML Tag Completion and snippets
    - Multi-threaded debugger
    Features may be added incrementally, leading towards the next major release (1.5).
    1.5 (3rd quarter 2007) Final Release
    - User-selectable IntelliSense libraries for Rails
    - Find All References
    - Project Wizards
    - Extended Server support
    - Extended database support
    - More dedicated Rails tools
    - Database IntelliSense
    - RXML, RJS support
    - TODO comments in Task List
    ==END PASTE==
    Also, if I recall from Netbeans many years back, it had database editing and reading functions back at that time, is there support in place that reads the yaml database config files that maps over to the jdbc connectors w/o having to fiddle with jdbc urls, etc.? Just kind of curious as it seems that it would be handy and add some extensibility handles.

    ReplyDelete
  13. I apologize for the last post, I didn't realize that it would all be stuck together in an unintelligible post!

    ReplyDelete
  14. Wow, also, are we going to see UML support for Ruby and Rails? Just looking through the milestone reports and "UML has been added to NetBeans 6" looked quite intriguing. I know some discussion of this has gone on around various places on the web for Ruby and Ruby on Rails...

    ReplyDelete
  15. Tor/ylon, I'm keen for UML(ERD) <-> migrations round tripping. For the moment I do note the following product which allows you to draw a ER diagram and then create a Rails Migration file from it. Doesn't seem to round trip perfectly at the moment however.

    http://www.malcolmhardie.com/sqleditor/cocoa/

    Greg

    PS. Tor, I was thinking a grey horizontal line between posts might make it easily to see who posted what in your blog? Just an idea

    ReplyDelete
  16. Tor: Cool, thanks! Anymore issues I come across I'll open tickets for in the Issuezilla. (Finally tracked it down). I signed up under the username 'dinsley' and requested observer status. :)

    ReplyDelete
  17. Yes, indeed a line and/or a bg highlight for the poster info would help tremendously.


    Also, after having downloaded build 621 earlier I'm curious as to the best method of application execution. I tried executing the shell script in bin, however received some errors in return. Is there a "pretty" wrapper I'm missing for Mac OS X?

    ReplyDelete
  18. Yeah, the slim-ide build doesn't build a Mac-specific installer or directory layout structure (we have that for NetBeans itself such that it builds a NetBeans.app directory with the right layout structure). We'll get to that latest as we polish things. However, running bin/nbrubyide should have worked - if you got errors, please send them to me direectly (tor.norbye@sun.com) or if you're willing, use the issue tracker as described near the bottom of http://wiki.netbeans.org/wiki/view/RubyBuildInstructions

    ReplyDelete
  19. Tor (got M8 working)

    (a) Is it not possible to "rename" an instant variable? (c.f. local) I get "can not perform this instance rename here)

    (b) Can you allow a rake db:migrate VERSION=0, as well as other numbers (useful to clear database and rebuild)

    cheers Greg

    ReplyDelete
  20. Hi Tor,
    Is the "Go to Type" already supposed to work with M8 and 0.38 ? at the moment it doesn't show any available classes, however the "Goto Declaration" in the editor (Alt-G) works...
    Klaasjan

    ReplyDelete
  21. A bit off topic - is haml and sass highlighting planned and when it would come?

    ReplyDelete
  22. You know, one other item that came to mind this morning that would be quite powerful is if in fact an ER Diagram tool were forged, it should not only allow for the fluid movement up and down the migrations by way of the visual aspect, but also each of these ER components in the diagram should also contain model validation properties such that by virtue of just altering this ER diagram visually it would both modify the migrations as well as the rails model code with proper validations and perhaps other properties.

    It just seems logical that all database development should be able to occur visually so as to build proper normalized models, etc.

    ReplyDelete
  23. Mongrel support : After intalling the mongrel gem, it should start after starting the server. In my case, the window says "Output - Mongrel for [projectname] on port 3000". But the output says "Bootig WEBrick"....what is happening?

    ReplyDelete
  24. mongrel would be much better than webrick.

    Also, Locomotive for Mac OS X might be a good example of how multiple web apps running simultaneously should be executed. I'm using it right now rather than webrick, etc.

    ReplyDelete
  25. Thanks Tor - re rake migration: the other version numbers were showing, it was just version=0 I was keen to see too so thanks for incorporating this - Greg

    ReplyDelete
  26. Tor, Just noted when I went "goto declaration" on "logger" I got an exception:
    java.lang.IllegalStateException: java.io.IOException
    at org.netbeans.modules.retouche.editor.hyperlink.GoToSupport.performGoTo(GoToSupport.java:118)
    at org.netbeans.modules.gsf.GsfEditorKitFactory$GsfEditorKit$GenericGoToDeclarationAction.gotoDeclaration(GsfEditorKitFactory.java:524)
    at org.netbeans.editor.ext.ExtKit$GotoDeclarationAction.actionPerformed(ExtKit.java:527)
    at org.netbeans.editor.BaseAction.actionPerformed(BaseAction.java:261)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1882)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2202)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
    at javax.swing.AbstractButton.doClick(AbstractButton.java:334)
    at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1000)
    at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1041)
    at java.awt.Component.processMouseEvent(Component.java:5554)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
    at java.awt.Component.processEvent(Component.java:5319)
    at java.awt.Container.processEvent(Container.java:2010)
    at java.awt.Component.dispatchEventImpl(Component.java:4021)
    at java.awt.Container.dispatchEventImpl(Container.java:2068)
    at java.awt.Component.dispatchEvent(Component.java:3869)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4256)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3936)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3866)
    at java.awt.Container.dispatchEventImpl(Container.java:2054)
    at java.awt.Window.dispatchEventImpl(Window.java:1774)
    at java.awt.Component.dispatchEvent(Component.java:3869)
    [catch] at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    Caused by: java.io.IOException
    at org.netbeans.api.retouche.source.Source.runUserActionTask(Source.java:441)
    at org.netbeans.modules.retouche.editor.hyperlink.GoToSupport.performGoTo(GoToSupport.java:71)
    ... 29 more
    Caused by: java.lang.NullPointerException
    at org.netbeans.modules.ruby.AstUtilities$1.read(AstUtilities.java:261)
    at org.netbeans.modules.ruby.RubyParser.parseFiles(RubyParser.java:101)
    at org.netbeans.modules.ruby.AstUtilities.getForeignNode(AstUtilities.java:275)
    at org.netbeans.modules.ruby.DeclarationFinder.findBestMethodMatch(DeclarationFinder.java:819)
    at org.netbeans.modules.ruby.DeclarationFinder.findDeclaration(DeclarationFinder.java:347)
    at org.netbeans.modules.retouche.editor.hyperlink.GoToSupport$1.run(GoToSupport.java:90)
    at org.netbeans.modules.retouche.editor.hyperlink.GoToSupport$1.run(GoToSupport.java:75)
    at org.netbeans.api.retouche.source.Source.runUserActionTask(Source.java:434)
    ... 30 more
    Greg

    ReplyDelete
  27. Since there's some chatter going on about migrations, I really thought this blog entry from the 29th was quite "sexy":
    “Sexy Migrations”
    http://errtheblog.com/post/2381
    Thought we might all benefit from that.
    And thanks very much for pointing them over here regarding ERD. It would be very powerful and a big "selling" point. And it would be much sexier than any textual migration file... :)

    ReplyDelete
  28. For anyone interested, I poked around and here appears to be the ER Diagram module site that Tor mentioned:



    http://wiki.netbeans.org/wiki/view/ERDSupport



    Now how nice would that be to see tied into Rails... :)

    ReplyDelete
  29. It looks like the "Rake target" is available on rails projects only. Can we have that in regular Ruby projects as well? (Some of us do use ruby for non-rails stuff ;)

    ReplyDelete
  30. On Mac OS X, it seems that NB behavior for text selection, etc. is very unlike what it should be. I'm hoping that things can be brought in line with the Cocoa feel (and even perhaps look as well, but feel and response is much more important).

    For example, just right off the bat I noticed that, while creating a new project, I tried to double click and hold the "Project Location" field on one of the folders in the string. Rather keeping the set of chars that I had double clicked selected, it released those when I dragged backwards and just kept the preceding forward slash, then dragging forward did keep it selected. It should actually keep that '/' delimited folder selected whichever way you drag.

    Should I report this as you'd previously mentioned versus here?

    ReplyDelete
  31. Have a question Tor, I just generated a model and it took what seemed an exorbitant amount of time for it to complete. I thought that perhaps something may be throwing an error as I'd not created the database or config'd the yaml file yet, however it did finally complete after running for what seemed to be about 1-1.5 minutes. Generating a model should normally only take several seconds.

    ReplyDelete
  32. Where do I find the test-running environment on NetBeans? I see how you run rake tests, or individual tests, but is there anything like the RadRails system that can show you which of your tests are passing/failing, and let you walk the stack on the failures? That was far and away the most useful thing about RadRails - without it I'd still be using emacs.

    ReplyDelete
  33. Tor, I really like the code complete and refactoring support for Ruby. I'm finding for the moment I'm still jumping back to Textmate when I'm writing new code to leverage the "bundles" functionality. I know you were considering this, so I'm just wondering if you planned to implement the Textmate-like Rails/Ruby bundles concept (e.g. enter "lica", hit TAB, then it fills in a link_to controller/action code snippet)

    Also I'm finding that part of the NB GUI freezes for me & I have to restart. Some of the menu-bar functions work but the project side-bar and file windows are non-responsive for example. If there is a trace/log file I could send in to assist please let me know.

    Greg

    ReplyDelete
  34. Great upgrades! Congratulations.
    A configuration that uses existing rails/jruby installations, as you mentioned, would be wonderful.

    ReplyDelete
  35. Ruby templates.
    I type in def and hit tab, the following code is inserted:
    def name
    end
    but the cursor jumps to the first line of the page/screen.
    Is this a bug? how can i change this behavior? Thanks!

    ReplyDelete
  36. Indeed Tor that is the case as you described it for the 10 seconds vs 3 minutes with JRuby.



    I have replaced it with native ruby and will try it again. I am curious; while it was indexing the new ruby path, I did a gem update and I was not sure whether it will detect changes and reindex only where appropriate accordingly, reindex everything and/or if I need to trigger that update. I'm hopeful that it intelligently searches for updates based upon a timestamp and automatically is triggered...



    Also, you may take note of "footnotes" by Duane Johnson for TextMate Rails browser integration in Mac OS X. It is quite handy and would be a powerful addition to the development cycle when occasion requires.

    ReplyDelete
  37. Installing mongrel, or other ruby gems which require building native extensions (such as sqlite3-ruby), fails with the Ruby Gem Manager in NB (m8 w/ ruby module v. 0.51). The error is that 'extconf.rb' cannot be found. Mongrel installs fine on my system outside of NetBeans. Other gems (ie, RedCloth), install okay with the Ruby Gem Manager. Any solution?
    Also, I'm using a full NB install w/ the ruby modules (not the ruby-only build). Is there any way to configure NB to use the gems already installed systemwide, including rails, rather than having to reinstall all those gems plus keep two sets of gems updated?

    ReplyDelete
  38. Not sure where else to put this, but I've noticed something: I have a directory under Rails structure app/sweepers
    When I try to put a new file into this directory using the context menu, it forces me to put it into the controllers directory instead, and won't let me change it to be in the directory I actually want.
    This is with m8 and latest build from deadlock.

    ReplyDelete
  39. Hi, great work, thx. I encountered one major problem:
    whenever I run netbeans the indexer takes up to 15 Minutes to finish. I suggest the link in 'rails -> /usr/share/rails' within the vendor path causing the problem.
    I use debian sarge.

    ReplyDelete
  40. Sorry for the stupidity, but I can't figure out how to setup NetBeans to use my native Ruby install rather than the JRuby stack... is there a link to this information that I haven't found? I read through the Install wiki page, but nothing in there... any advice welcome!

    ReplyDelete
  41. Google to the rescue, please ignore me.

    ReplyDelete
  42. Martin KrauskopfApril 3, 2007 at 7:01 PM

    Arvid> You may CC yourself to the issue 93019 to watch the progress.

    ReplyDelete
  43. Tor/others - Is there a way to open a Terminal/Console window to bring you to the project root & set appropriate environment variables for ruby/rails? i.e. Similar to how you launch a terminal from Locamotive


    i.e. Easy way to then be able to run standard rails commands etc, for example "cap deploy".


    Tks

    Greg


    PS. Still main blocking item for cutting over from Textmate for me would be the great textmate/bundles functionality.

    ReplyDelete
  44. Tor, where do we post feature requests? Didn't find it in plugin info in NetBeans.

    ReplyDelete
  45. Martin KrauskopfApril 4, 2007 at 5:47 PM

    You might find the link at the bottom of the RubyTodo page. I.e. in the Issuezilla - Issue Type "Feature".

    ReplyDelete