[MacRuby-devel] Packing gems in the app's folder

Eloy Duran eloy.de.enige at gmail.com
Fri Mar 27 10:20:09 PDT 2009


Hi,

Have you included the Gems directory in your xcode project so that it  
copies the complete dir when building?
This probably then tells you that the dir does not exist "p File.exist? 
(File.expand_path('../Gems', __FILE__))".

Second, are you sure you actually need rubygems if you are already  
vendoring? Removing rubygems from the dependencies will really boost  
up the load time of your application. So I would do everything to  
remove it as a dependency. In the best case scenario you only need to  
do something like (untested code):

Dir.glob(File.expand_path('../Gems/*', __FILE__)).each do |gem|
   $LOAD_PATH.unshift File.join(gem, 'lib')
end

require "mechanize"

- Eloy

On 27 mrt 2009, at 17:57, Thiago Jackiw wrote:

> Do I have to do anything special to pack gems inside my application's
> folder? The following isn't working when I require the gems inside of
> my 'Gems' folder:
>
> # rb_main.rb
> ENV['GEM_HOME'] = File.dirname(__FILE__) + '/Gems'
> require 'rubygems'
> require 'mechanize'
>
> `require': no such file to load -- mechanize (LoadError)
>
> If I do the above in IRB it works just fine.
>
> The 'Gems' folder contains the following structure:
>
> Gems
> - cache
> - doc
> - gems
>  - mechanize-0.9.2
> - specifications
>  - mechanize-0.9.2.gemspec
>
> Thanks, and I'm using MacRuby 0.4.
>
> --
> Thiago Jackiw
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel



More information about the MacRuby-devel mailing list