Ticket #96 (closed defect: fixed)
IB's File->Read Class Files... command fails to parse proper ruby files for ib_outlet, ib_action, et al.. + FIX
| Reported by: | occam@… | Owned by: | lsansonetti@… |
|---|---|---|---|
| Priority: | minor | Milestone: | MacRuby 0.3 |
| Component: | MacRuby | Keywords: | Interface Builder parse |
| Cc: |
Description
Problem: IB 3.0+ stops processing ruby files properly since it fails to parse them. As a consequence, the autoupdating of ib_outlet, and ib_action fails even if you first save your ruby files in Xcode.
Solution: Apparently, there's a version mismatch for some reason (e.g., between 1.8 OSX ruby and 1.9 macruby). I believe the fix is to modify custom_require.rb like this:
old: Gem.activate(spec.name, false, "= #{spec.version}") # breaks rb_nibtool.rb (2008-07-07) new: Gem.activate(spec.name, "= #{spec.version}")
i.e., remove the "false, ", since Gem.activate no longer accepts a Boolean as an argument. (Assuming that's the newer behavior.) You should be able to find custom_require.rb here:
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb
To test from IB, run IB's File->Read Class Files... on valid ruby file with ib_outlet(s) and ib_action(s) and make sure they populate the appropriate IB inspectors with outlets and actions. To test manually, run the following command on a valid ruby file with ib_outlet(s) and ib_action(s), and you should get some appropriate XML, e.g., on MyController.rb:
/usr/bin/ruby /System/Library/Frameworks/RubyCocoa.framework/Versions/A/Tools/rb_nibtool.rb -p -s -f - < MyController.rb
And voila, your Xcode ruby can now populate your IB inspectors again.

