[MacRuby-devel] Using built-in ruby libraries in packaged applications.

Laurent Sansonetti lsansonetti at apple.com
Mon Apr 20 17:51:50 PDT 2009

That is actually a pretty good idea, the default rb_main.rb could  
require an extra file if it exists in the resource directory, and the  
target would generate it.

If anyone wants to contribute a patch I would commit it :-)


Sent from my iPhone

On Apr 20, 2009, at 4:37 PM, Alex Vollmer <alex.vollmer at gmail.com>  

> On Apr 20, 2009, at Apr 20, 1:32 PM, Laurent Sansonetti wrote:
>> This is the right way to do it. The "Embed MacRuby" target  
>> configures the linking settings of your app but you still need to  
>> hack the load path in rb_main.rb to point it to the MacRuby stdlib.
>> Here is another way:
>> $:.map! { |x| x.sub(/^\/Library\/Frameworks/,  
>> NSBundle.mainBundle.privateFrameworksPath) }
>> $:.unshift NSBundle.mainBundle.resourcePath.fileSystemRepresentation
>> I wasn't able to perform this change automatically during the  
>> target build. Maybe we could ship a new rb_main.rb in the template  
>> that does this change based on a heuristic... if you have any idea  
>> let me know.
> Thanks for the response Laurent. I wonder if there wouldn't be some  
> way to have the "Embed MacRuby" target generate an additional file  
> that would modify the load path in that way. Then it could just be  
> an additional ruby file that gets automatically required by the  
> default rb_main.rb. There would obviously be a problem of ensuring  
> the load-order so we could always do it with a conditional require.  
> Hmmm...maybe that's kind of hacky too. :-P
> Cheers,
> Alex
> ----
> Musings & Notes
> http://blog.livollmers.net
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

More information about the MacRuby-devel mailing list