From: Eric Christopherson Date: 2010-02-22T09:11:50+09:00 Subject: Re: Including gems in a bundle with Rawr (Jruby) Thanks for your response. On Sun, Feb 21, 2010 at 3:32 PM, James Britt wrote: > Eric Christopherson wrote: >> >> I'm able to make a jar/.exe/.app out of a simple script with Rawr, but >> I can't seem to run one that uses a gem. It complains that it can't >> find the gem at runtime. I've read >> >> and tried to follow the instructions, but without success. Might >> anyone be able to help? > > Is the gem installed on all system were the rawr-packaged app will run? No; the reason I want to use Rawr is to deliver a program where no Ruby installation exists. > If you are not assured of that then having code that expects a gem is asking > for trouble. > > > Also, the instructions on the page you gave has this: > > "You need to unpack the gem into lib/ruby" > > The reason for that is so that you do not need to use rubygems to load > anything.  You should be using 'require ', and all paths should be > relative to your app.  rubygems messes with the load path, making life > difficult for self-contained apps. OK. I was able to get it to load Barby, but I had to add 'lib/ruby/barby/lib' to my $LOAD_PATH. I don't understand the purpose of unpacking the gem into lib/ruby specifically, when it could reside anywhere within the hierarchy. > If you have code that is attempting to load a gem instead of trying to load > files out of your bundled app then something is likely wrong. > > (Note that the example code on that help page never makes use of rubygems. >  Only plain old 'require'.) > > Some gems contain code that makes a call to "require 'rubygems'". (There was > a previous thread on ruby-talk about how inane this is.) Yes, and I see now that prawn (which I also need) does just that. :( > I usually hate to tell people "don't do that" when they ask how do do > something, but trying to use rubygems from inside an app packaged up with > rawr is just asking for trouble.  One of the purposes of rawr is create > self-sufficient apps. That's what I want to do: make a program (that uses some gems) and package them all together so they don't need to be installed separately. I must be misunderstanding the intention of the page we're discussing; I thought it was about doing that. > Grep you code for any reference to rubygems and delete it. :)