Not logged inGosu Forums
Forum back to libgosu.org 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) (https://rubygems.org/gems/rubydraw) 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?

Thanks!
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:
/Users/alanwostenberg/Desktop/HelloWorld/HelloWorld.app/Contents/Resources/libraries
/Library/Ruby/Site/1.8
/Library/Ruby/Site/1.8/powerpc-darwin10.0
/Library/Ruby/Site/1.8/universal-darwin10.0
/Library/Ruby/Site
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/vendor_ruby/1.8
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/vendor_ruby/1.8/universal-darwin10.0
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/vendor_ruby
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/powerpc-darwin10.0
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0
.


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/HelloWorld.app/Contents/Resources/lib/main.rb:2
  from /Users/alanwostenberg/Desktop/HelloWorld/HelloWorld.app/Contents/MacOS/rubyapp:13:in 'require'
  from /Users/alanwostenberg/Desktop/HelloWorld/HelloWorld.app/Contents/MacOS/rubyapp:13


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