RubyCocoa 0.13.0

Hi,

I am honored to announce the immediate release of RubyCocoa 0.13.0.

RubyCocoa is a Mac OS X framework that allows Cocoa programming in the
object-oriented scripting language Ruby. In other words, it is a
bridge that let you access Objective-C objects from Ruby, and
vice-versa.

You can learn more about RubyCocoa on our website:

http://rubycocoa.sf.net

A source tarball as well as binary installers for Mac OS X 10.4 and
10.5 are provided.

This is mostly a bugs fix release, addressing many critical issues,
but it also brings some nice enhancements. All users are encouraged to
upgrade, and report us feedback.

Mac OS X 10.5, Leopard, is as you can see supported by this release.
Installing this release using the binary installer or manually with
the default build parameters won’t override the system version, it
will go in /Library while the system version is in /System.

The release notes are following. Enjoy!

Laurent

New features:

  • NSArray and NSDictionary now respond to the same messages of their
    Ruby equivalents, respectively Array and Hash. NSString responds to
    the String messages too, except #=~ and #match. The implementation is
    fast and reliable, but respects the Cocoa semantics. The
    #method_missing hack has been removed.

  • Added utility methods to NSRect, NSPoint, NSSize and NSRange.

  • Added useful inspect methods to NSString, NSNumber, NSArray,
    NSDictionary, NSCFBoolean and NSDate. Added pretty print support to
    NSString, NSArray, NSDictionary.

  • Added a #to_ns method to Array, Hash, String, Numeric, TrueClass,
    FalseClass, Time, to convert them to their Cocoa equivalent.

  • Added ObjcPtr#cast_as(encoding) for more generic casting from void*.

  • Added Leopard-only samples.

Bugs fixed:

  • Fixed various memory leaks in the RubyCocoa initialization code, and
    in the bridge support parsing code. No memory should now be leaked
    during initialization.

  • Improved the ruby obj → ocid and ruby obj → SEL conversions
    performance.

  • Fixed a crash when passing a pointer to an ObjC object, then trying
    to convert it as a Ruby object after the API call, but crashing
    because the pointer wasn’t touched by the API. Now preparing
    passed-by-reference pointers to NULL.

  • Fixed an error, “Please install again” on reinstalling using the
    binary installer.

  • Do not translate ‘set’ methods that get more than one argument.

  • Create the slave objects at demand, if they do not exist yet. This
    fixes a bindings / CoreData problem in 10.5.

  • Now resetting the context autorelease pools on every thread restore.

  • Fixed a bug when an object that was being allocated from a Ruby
    thread was still in the cache while the thread was killed, resulting
    in a corrupted cache.

  • Make sure we do not cache CF-based objects.

  • Fixed a circular retain cycle from ObjC objects allocated from an
    NSObject-based Ruby class, resulting in a leak of both the ObjC object
    and its Ruby proxy.

  • Hook [copyWithZone:] and reset the slave object so that every ObjC
    object has a different slave object. This fixes a crash when releasing
    a slave object that could be shared by multiple ObjC objects.

  • #objc_send will now pass a frozen selector to the core, where
    underscore characters won’t be transformed as ‘:’. This is a
    convenience utility to call ObjC methods that contain underscores as
    part of their selector, like for example [rbobj].

  • Better OvMix retain cycle: if an OvMix object is created from Ruby,
    we by default don’t retain its Ruby proxy, and start tracking
    retain/release messages, and appropriately re-retain/re-release the
    Ruby proxy.

  • Removed the old slave_nsobj ivar hook. Now all pure-Ruby objects
    will be wrapped in an autoreleased RBObject.

  • Fixed a bug, when ObjC arguments that were passed from an ObjC
    closure to Ruby were not retained, as they should. Added a test case.

  • Better facility (10.5 only) that dispatches messages from threads to
    the thread where RubyCocoa was initialized. It was previously assuming
    that RubyCocoa was run in the main thread, which may not be always
    true (Ruby could be ran in a different thread).

  • Now allow the send the of ‘new’ message to any ObjC class that will
    respond to it. Keep the old behavior (raising an exception) for
    classes that don’t implement new.

  • Added threading support for 10.5.

  • Updated metaconfig and Rakefile to use ‘–gen-bridge-support=no’ on
    10.5.

  • New metaconfig option --sdkroot. Fix setup error
    –macosx-deployment-target=10.4 on 10.5.

  • Fixed String#to_nsstring for 10.5.

  • String#nsenconding, to_nsstring, to_nsmutablestring are now
    deprecated. Developers are encouraged to switch to #to_ns.

  • Fixed a bug, calling to_ns for a Ruby String which has illegal utf-8
    sequences caused a bus error.

  • Avoid an infinite loop when creating the slave proxy, which could be
    caused by an attempt to pass an object to Objective-C in its
    #initialize method.

  • sample/Scripts/darkroom.rb: fix SEGV of darkroom.rb on 10.5.

  • Added CoreData.define_wrapper_for_entity(). This feature was part of
    CoreData.define_wrapper(). Removed “to_a” for NSArray in CoreData
    module.

  • Load the libSystem.bridgesupport file if it exists (10.5 only).

  • rb_nibtool: Fixed a crash when the provided Ruby script only defines
    actions but no outlets, or vice-versa.

  • rb_nibtool: Fixed bug where #each was called on nil if there were
    either no actions OR outlets in the class.

  • rb_nibtool: Fixed bug where a new class from a source file would not
    show up in the class list in IB because the superclass is unknown to
    the classes list in IB. If the superclass const is not found it will
    default to NSObject. This change is not effective when rb_nibtool is
    used with rubynode.

  • rb_nibtool: Fixed problem when not detecting existing classes.

  • standaloneify: Now sets the environment variable
    ENV[‘RUBYCOCOA_STANDALONEIFYING?’]. This is to be able to prevent code
    from being ran when an application is being standaloneified.

  • standaloneify: Will now skip all the source files at any depth in
    Resources.

  • gen_bridge_doc: Updated to work with the latest Apple documentation
    and 10.5.

  • gen_bridge_doc: Fixed a bug where tags weren’t replaced by ‘_’.

  • gen_bridge_doc: Added documentation for the translated bool methods,
    eg: isRunning → running?.