Not logged inGosu Forums
Forum back to Help Search Register Login
Up Topic Gosu / Gosu Exchange / Ruby Libraries in Mac Apps
- - By Jwosty Date 2011-12-07 03:31
This isn't completely about Gosu, but I've been writing a simple Ruby graphics library (just for fun) ( based off of SDL, and I wanted to see how much it would take to be able to package it up into a nice little Mac App that could run on theoretically any Mac. Everything is working fine and dandy, but currently the end user would have to have a few gems installed. I tried adding them to a subdirectory in Resources (entitled "Libraries"), then adding it to $LOAD_PATH. It still wouldn't work; it tries to load the gems from the gem folder. And I know it adds the completely correct directory to $LOAD_PATH; I had it print it once and it was fine. Anyone know how to do this?

Parent - - By jlnr (dev) Date 2011-12-07 23:14
This should work just fine. What do you mean by "gem folder"? Can you post the error message and $LOAD_PATH?
Parent - - By Jwosty Date 2011-12-08 00:12 Edited 2011-12-08 00:27
Here's $LOAD_PATH:

And this is the error message (backticks replaced with single quotes):
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in 'gem_original_require': no such file to load -- rubydraw (LoadError)
  from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in 'require'
  from /Users/alanwostenberg/Desktop/HelloWorld/
  from /Users/alanwostenberg/Desktop/HelloWorld/ 'require'
  from /Users/alanwostenberg/Desktop/HelloWorld/

And finally, the structure of the package is attached.
Parent - - By jlnr (dev) Date 2011-12-08 00:34
Oh, I thought you'd use Gosu's wrapper app. I have no idea what you use for wrapping, but using system Ruby has only given me trouble...that's why I built the monolothic .app wrapper. But my wrapper does not understand gem folder structures either. I think you'd need to grok rubygems' internals and then mess with the "gem environment".
Parent - By Jwosty Date 2011-12-08 04:26
Oh, I wrote my own short Ruby script and marked it as an executable; that's that "rubyapp" thing. Yeah, it does just load whatever version of Ruby the user has as their default; it'd be nice to try to control that sort of thing. And I don't really want to package up an entire Ruby interpreter myself; it just takes up extra space, and Macs come with Ruby installed by default.

But I think that gem environment thing is exactly what I need! Thanks; I'll check this out (the GEM_HOME constant, specifically).
Up Topic Gosu / Gosu Exchange / Ruby Libraries in Mac Apps

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill