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

Alex Vollmer alex.vollmer at gmail.com
Mon Apr 20 16:37:45 PDT 2009

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



Musings & Notes

More information about the MacRuby-devel mailing list