[Rubygems-developers] can 2 Gem directories co-exist?

Jim Weirich jim.weirich at gmail.com
Fri Feb 3 15:33:29 EST 2006


On 2/3/06, Jim Freeze <rubygems at freeze.org> wrote:
> On 2/3/06, Jim Weirich <jim.weirich at gmail.com> wrote:
> >
> > Assuming everything was setup correctly, that should have worked.
> > I'll investigate this weekend.
>
> Ok, I have checked again. I had a few path issues, but still no worky.
>
> Here is what I have. First, GEM_HOME lists two directories.

Oh?  Did you try it with GEM_PATH rather than GEM_HOME.  GEM_HOME
specifies your primary repository, where gems will be installed
(unless overriden with the -i switch).  GEM_PATH specifies what
respositories to search for resolving gem names.  There should only be
one repository in GEM_HOME, but you can have multiple in GEM_PATH. 
(Also, GEM_HOME will be appended to the GEM_PATH list if it is not
included in it).

--
-- Jim Weirich


>
>         % env | grep -i gem
>         GEM_HOME=/Users/jdf/my_gems:/opt/local/ruby-1.8.4/lib/ruby/gems/1.8/
>
> First the local gems dir (notice no rake installed):
>
>         % ls /Users/jdf/my_gems
>         bin             doc             lib             specifications
>         cache           gems            source_cache
>         % ls /Users/jdf/my_gems/gems/
>         commandline-0.7.10      sources-0.0.1           text-hyphen-1.0.0
>         rubygems-update-0.8.11  text-format-1.0.0
>
> Next the native gems dir
>
>         % ls /opt/local/ruby-1.8.4/lib/ruby/gems/1.8/
>         cache           doc             gems            source_cache    specifications
>         % ls /opt/local/ruby-1.8.4/lib/ruby/gems/1.8/gems/
>         RedCloth-3.0.4          actionwebservice-1.0.0  mysql-2.7
>   rubygems-update-0.8.11
>         actionmailer-1.1.5      activerecord-1.13.2     rails-1.0.0
>   sources-0.0.1
>         actionpack-1.11.2       activesupport-1.2.5     rake-0.7.0
>
> Results with 2 paths in GEM_HOME:
>
>          % rake --task
>         /opt/local/ruby-1.8.4/lib/ruby/site_ruby/1.8/rubygems.rb:204:in
> `report_activate_error': Could not find RubyGem rake (> 0)
> (Gem::LoadError)
>                 from /opt/local/ruby-1.8.4/lib/ruby/site_ruby/1.8/rubygems.rb:141:in
> `activate'
>                 from /opt/local/ruby-1.8.4/lib/ruby/site_ruby/1.8/rubygems.rb:37:in
> `require_gem_with_options'
>                 from /opt/local/ruby-1.8.4/lib/ruby/site_ruby/1.8/rubygems.rb:31:in
> `require_gem'
>                 from /opt/local/ruby-1.8.4/bin/rake:17
>
> GEM_HOME with native path:
>
>         % setenv GEM_HOME /opt/local/ruby-1.8.4/lib/ruby/gems/1.8/
>         % rake --task
>         (in /Users/jdf/tmp)
>         /Users/jdf/tmp
>         ["demo/chunkybacon.rb", "demo/code.rb", "demo/colornames.rb",
> "demo/demo.rb", "demo/gettysburg.rb", "demo/hello.rb",
> "demo/individual-i.rb", "demo/pac.rb", "demo/pagenumber.rb",
> "demo/qr-language.rb", "demo/qr-library.rb"]
>         nil
>
> Now, GEM_HOME with local path:
>
>         % setenv GEM_HOME /Users/jdf/my_gems
>         % cat app.rb
>         require 'rubygems'
>         require 'commandline'
>         class App < CommandLine::Application
>           def initialize
>             puts "running app"
>           end
>         end#class App
>
>         % ruby app.rb
>         running app
>
> So, a single directory works.
>
> --
> Jim Freeze
>
> _______________________________________________
> Rubygems-developers mailing list
> Rubygems-developers at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rubygems-developers
>


--
--
-- Jim Weirich    jim at weirichhouse.org     http://onestepback.org
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)



More information about the Rubygems-developers mailing list