Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Ruby VM Roundup: MacRuby 0.2, JRuby JMX, Ruby 1.9

Ruby VM Roundup: MacRuby 0.2, JRuby JMX, Ruby 1.9

This item in japanese

MacRuby is a port of Ruby 1.9 to the Objective-C runtime (you can read InfoQ's interview with MacRuby developer Laurent Sansonetti).

Now a new version, MacRuby 0.2 is available From the release notes:
In MacRuby 0.2, all strings, arrays and hashes are now native Cocoa types, represented by NSString, NSArray and NSDictionary objects, respectively.
From the release notes: The entire String, Array and Hash interface was rewritten on top of the Cocoa equivalents using the powerful CoreFoundation framework.
It is no longer necessary to convert Ruby primitive types to Cocoa or vice-versa. For example, a String created in MacRuby can be passed as is, without conversion, to an underlying C or Objective-C API that expects an NSString. Similarly, any method of the Ruby String class can be performed on an NSString that comes from Objective-C.
The use of Objective-C data structures and Strings also brought some performance improvements along. MacRuby 0.2 is available at MacOSforge.

The JRuby team has been busy working with JMX. Charles Nutter recently added some MBeans to the JRuby trunk which allow to monitor internals of the JRuby. It's now possible to watch the JRuby optimizers and JIT do it's work. This is useful to get a feel how an application running on JRuby interacts with the optimizations. Together with the addition of the "--manage" command line switch, it's now possible to easily view this information using tools like JConsole.

The new JMX gem by JRuby's Tom Enebo works in the other direction, i.e. using the information exported via JMX. It allows to connect to a JMX server and list the exported MBeans and use the attributes or invoke the operations. Another library with this capability is jmx4r. Tom Enebo's jmx gem also includes the capability to define a MBean in JRuby, which can then be registered in a regular MBean server (JMX has been included in Java since Java 5). With this, JRuby applications can now export their own monitoring information via the JMX system, which can then, of course, be viewed by tools like JConsole.

Finally, Sasada Koichi notes that Ruby 1.9.0-2 will be released in time for RubyKaigi, i.e. around the 20th June 2008. More details on changes once the release is out, but a quick look through the Ruby trunk CHANGELOG shows updates to RubyGems and an upgrade to RDoc 2.0.

Another change that might happen for this or a future release, is the replacement of test/unit with Ryan Davis' miniunit. Ryan just released miniunit 1.2, with a call to users to find discrepancies between it and test/unit. Ryan explains how to use miniunit:
% sudo gem install miniunit
% sudo use_miniunit yes

The second command will install symlinks into your sitelib directory. That comes before the stdlib dir in $LOAD_PATH so it'll take over for test/unit. You can roll it out by providing "no" as an argument instead. It should be totally easy and safe.
I've added a lot of really great stuff in this release. The biggies:
 * New useful assertions like assert_includes.
  * A refute mirrors every assert. eg refute_empty ary
 * I added mini/spec and mini/mock and they can work side-by-side with mini/test.
An important note for developers of Ruby IDEs or everyone using custom test-runners:
NOTE: Do not report bugs against it if you're trying to use it integrated into a GUI IDE/test-runner like komodo. It isn't meant to be compatible with GUI runners and the like. It is meant to be compatible with your tests.
To work around this, the original test/unit was extracted into a gem.

Rate this Article