Sunday Aug 19, 2012

Ruby in NetBeans IDE 7.2

I've not so far managed to get commit access to the Ruby community plugin repo, so here are instructions for upgrading it to 7.2 for someone who does have the rights to do so.

Note: For those who don't care about the gory details, i.e., who simply want to use Ruby in NetBeans IDE 7.2, go to the Plugin Manager in NetBeans IDE 7.2, and register  https://blogs.oracle.com/geertjan/resource/nb-72-community-ruby.xml  as a new update center. Though the update center is, as you can see, in this blog, the NBMs that will be available once you've registered the update center are located at java.net.

  1. Check out the community Ruby plugin:

    http://hg.netbeans.org/community-ruby

  2.  Open the Ruby plugin project:



  3. Build the project. This takes a while because many NetBeans modules in NBM format need to be downloaded. While you wait, read issue 210334, which describes the reason why the plugin will not work out of the box in 7.2, after which you should read http://hg.netbeans.org/web-main/rev/106cf094a505, which shows how other plugins in NetBeans IDE needed to be changed because of issue 210334.

  4. At some stage in your life, the NBMs will be downloaded and the compilation process will throw up this error, which makes complete sense, once you've read the issue referred to in the previous step:
    No dependent module org.netbeans.modules.web.client.tools.api
  5. Now we're going to tweak the plugin here and there so that we're not depending on the dead "org.netbeans.modules.web.client.tools.api" (hereafter referred to as "the WCTA", for "the Web Client Tools API") module anymore, as well as few other tweaks that turned out to be needed for 7.2.
    • Open "Ruby on Rails Project Support". In the Important Files node, open "Project Metadata". Look for the WCTA dependency and delete it. Open "RailsActionProvider" and delete the two import statements that come from the WCTA. Comment out the else-clause at line 629. Open "RailsUrlDisplayer" and delete the 6 import statements that come from WCTA. Comment out the if-clause at line 97. Comment out definition and usage of "LocationMapperfactory" from line 108 onwards. Remove two obsolete catch clauses at the end of the class. Now the module can be built without a problem.

    • Expand the "NB Ruby" project. Here, we're not going to change anything within a specific module. Instead, we're going to remove a module completely from the application. The module is "Ruby Test Runner", which makes use of a lot of code from "org.netbeans.modules.gsf.testrunner",  which no longer exists. I suspect that the Ruby plugin hasn't made use of this module for a long time and that, i.e., it has been dead functionality for quite some time, though I could be wrong, of course. Open the "project.properties" file in the Important Files node of the NB Ruby project. In there, on line 27, delete the reference to "ruby.testrunner". Now the module will be excluded from the build process.

    • Open "Ruby and Rails". In the Important Files node, open "Project Metadata" and remove the dependency on "org.netbeans.modules.ruby.testrunner". 

    • Open "GlassFish Server 3 - Ruby". In the "JRubyServerModule" class, two usages of a method "startServer" expect two arguments, now, instead of one. For the second argument, pass in "null" and then build the module and it will compile correctly.

Now everything compiles and you can run the Ruby plugin! And, those few tweaks don't add up to very much work, do they? Based on the changes made above, I don't think any functionality has been impacted, though, again, feel free to disagree. Have fun with the great Ruby support that the community Ruby plugin provides for NetBeans IDE 7.2!

About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« August 2012 »
SunMonTueWedThuFriSat
   
1
2
3
4
5
6
7
8
9
10
11
12
 
       
Today