From: Ferlander D. <fer...@gm...> - 2009-08-01 08:37:15
|
Thanks, it looks like this is working: Dir.glob("#{File.join(OSX::NSBundle.mainBundle.resourcePath, 'vendor/gems')}/*").each do |gem| $:.unshift File.join(gem, 'lib') puts "We made it this far 2" #require gem end Look ok? Thanks for your help! =) Ferlander On Fri, Jul 31, 2009 at 6:34 AM, Eloy Duran <elo...@gm...> wrote: > Oh and you shouldn't require rubygems anymore. It should work without > it and your app will boot much faster. > > On Fri, Jul 31, 2009 at 10:34 PM, Eloy Duran<elo...@gm...> > wrote: > > Ah, I forgot to add the the "lib" part of the gem path, which is > > usually the only needed search path that a gem needs. (You can check > > the gemspec of the gem to see if it needs any additional load paths.) > > > > So try something like: $:.unshift File.join(gem, 'lib') > > > > And maybe inspect the load paths with: p $: > > > > Eloy > > > > On Thu, Jul 30, 2009 at 7:10 PM, Ferlander > > Davids<fer...@gm...> wrote: > >> Thanks for your reply, > >> I'm still having some trouble, though. I've implemented your suggestion, > but > >> the gem is still not found. > >> I think I may be off course, though, because if I require 'rubygems' > before > >> I require the particular gem the app does run (only on my computer, of > >> course). So I'm afraid my app may not be pointing to the bundled gems. > Sorry > >> in advance if this next thought is way off base, but does rubygems > create > >> some kind of directory/path list that I might need to include? > >> Are there any other details about requiring gems that might seem > obvious? I > >> am pretty inexperienced, and what's obvious to some might have gone over > my > >> head. > >> Ferlander > >> > >> On Tue, Jul 28, 2009 at 8:56 PM, Eloy Duran <elo...@gm...> > wrote: > >>> > >>> Hi, > >>> > >>> What I generally do is: > >>> * Create a vendor/gems directory > >>> * Unpack the gems into that directory > >>> * Add the directory to your xcode project as a folder reference (this > >>> means xcode will copy the dir and its contents to the Resources dir > >>> * Add the gem dirs to the load path. For instance something like this > >>> in rb_main.rb: > >>> Dir.glob("#{File.join(NSBundle.mainBundle.resourcesPath, > >>> 'vendor/gems')}/*").each do |gem| > >>> $:.unshift gem > >>> require gem > >>> end > >>> > >>> (Note that I just wrote this down and might contain slight errors.) > >>> > >>> HTH, > >>> Eloy > >>> > >>> > >>> On Wed, Jul 29, 2009 at 12:25 PM, Ferlander > >>> Davids<fer...@gm...> wrote: > >>> > I'm building an application with the intent of distributing it to > people > >>> > that won't have rubycocoa installed. I believe I've successfully > >>> > included > >>> > the rubycocoa framework and the ruby runtime library, however I still > >>> > need > >>> > to include one or two gems before I'm done. > >>> > I read: > >>> > http://rubycocoa.sourceforge.net/EmbedRubyCocoa > >>> > I tried standaloneify.rb, but as far as I could tell it broke my > >>> > application. > >>> > Is there a simple way to include ruby gems? I thought maybe I could > >>> > store > >>> > them in Resources, but xcode doesn't seem to like it when I do that. > I > >>> > read > >>> > that you can specify the path to modules, but does anyone have any > >>> > suggestions as to the right way to get the gems included in the > >>> > application? > >>> > I hope this is an appropriate question. I'm inexperienced. > >>> > Ferlander > >>> > > >>> > > ------------------------------------------------------------------------------ > >>> > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 > >>> > 30-Day > >>> > trial. Simplify your report design, integration and deployment - and > >>> > focus > >>> > on > >>> > what you do best, core application coding. Discover what's new with > >>> > Crystal Reports now. http://p.sf.net/sfu/bobj-july > >>> > _______________________________________________ > >>> > Rubycocoa-talk mailing list > >>> > Rub...@li... > >>> > https://lists.sourceforge.net/lists/listinfo/rubycocoa-talk > >>> > > >>> > > >>> > >>> > >>> > ------------------------------------------------------------------------------ > >>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 > >>> 30-Day > >>> trial. Simplify your report design, integration and deployment - and > focus > >>> on > >>> what you do best, core application coding. Discover what's new with > >>> Crystal Reports now. http://p.sf.net/sfu/bobj-july > >>> _______________________________________________ > >>> Rubycocoa-talk mailing list > >>> Rub...@li... > >>> https://lists.sourceforge.net/lists/listinfo/rubycocoa-talk > >> > >> > >> > ------------------------------------------------------------------------------ > >> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 > 30-Day > >> trial. Simplify your report design, integration and deployment - and > focus > >> on > >> what you do best, core application coding. Discover what's new with > >> Crystal Reports now. http://p.sf.net/sfu/bobj-july > >> _______________________________________________ > >> Rubycocoa-talk mailing list > >> Rub...@li... > >> https://lists.sourceforge.net/lists/listinfo/rubycocoa-talk > >> > >> > > > > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus > on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > Rubycocoa-talk mailing list > Rub...@li... > https://lists.sourceforge.net/lists/listinfo/rubycocoa-talk > |