Adding DRYML syntax highlighting support (NetBeans 6.0 with Ruby)

Hobo is an amazing extension to Ruby on Rails that allows for very rapid web application development. An integral part of what makes it such a productivity boost is its template language: DRYML.

As the Hobo project is still quite young, it is seldom supported by the widely used Ruby on Rails IDE's like Aptana, TextMate, Emacs - and more recently - NetBeans. As far as IDE's need be concerned, DRYML is little more than XML with embedded Ruby (ERb). As NetBeans already supports Ruby on Rails (fantastically!), it shouldn't be too difficult to get the RHTML rendering engine to be on the lookout for files bearing the *.dryml extension that signifies a DRYML file. Surprisingly, this is an odious task in many of the other IDE's, most notably those of the Eclipse family (RadRails, Aptana).

What follows is a short tutorial on how to get your RHTML syntax highlighting applied to your DRYML files:

In your installation directory, you should see a _ruby1/_ directory. If you don't you evidently do not have Ruby support enabled. Do this first.

  1. Browse to: installation_directory/ruby1/modules/org-netbeans-modules-ruby-rhtml.jar/org/netbeans/modules/ruby/rhtml/resources/
  2. Open the RhtmlResolver.xml config file for editing
  3. Edit the contents by duplicating the <ext name="rhtml"/> line, and change the second line's 'name' attribute to "dryml"
  4. The file should now look something like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE MIME-resolver PUBLIC "-//NetBeans//DTD MIME Resolver 1.0//EN" "http://www.netbeans.org/dtds/mime-resolver-1_0.dtd">
        <ext name="rhtml"/>
        <ext name="erb"/>
        <ext name="dryml" />
        <resolver mime="application/x-httpd-eruby"/>

5. That should do the trick! Restart your NetBeans IDE, open a *.dryml file and verify that your RHTML syntax highlighting is working as it should.

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo