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

Alex Vollmer alex.vollmer at gmail.com
Sun Apr 19 21:53:27 PDT 2009


I have a bit of code that uses the Ruby base64 library and I would  
like to package the MacRuby framework into my application. I've added  
the "Embed MacRuby" target to my build and the MacRuby framework shows  
up properly in my application's contents directory. The problem is  
that when the program launches the call for requiring the base64.rb  
file causes the runtime to bomb out saying it couldn't find  
'base64.rb'. After a bit of hacking I ended up adding this stanza in  
the rb_main.rb file prior to the loop that requires all the local files:

$:.unshift(File.join(NSBundle.mainBundle.privateFrameworksPath,
                      "MacRuby.framework",
                      "Versions",
                      "Current",
                      "usr/lib/ruby/1.9.1"))

This seems a little hacky to me. Is there a better way of doing this?

Thanks,

Alex V.

----
Musings & Notes — http://alexvollmer.com
Track what you lend and borrow — http://moochbot.com







More information about the MacRuby-devel mailing list