[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Must .gemrc -> gemhome point to Gems installation?

ES

3/8/2005 6:09:00 AM

On my system, anything in the gemhome field in .gemrc seems to render
Gems unusable. Here's some output for your viewing pleasure:

# Version
05:45:46 ruerue@purr> ruby -v
ruby 1.8.2 (2004-12-25) [i686-linux]

05:51:28 ruerue@purr> gem --version
0.8.6

# This is what I'd like to have
05:51:35 ruerue@purr> cat .gemrc
gem: --gen-rdoc --run-tests
rdoc: --all --line-numbers --inline-source
gemhome: /home/ruerue/lib/ruby
gempath:
- /usr/lib/ruby/site_ruby/1.8/rubygems

# But then this happens
05:51:55 ruerue@purr> gem install -r og
Attempting remote installation of 'og'
/usr/lib/ruby/site_ruby/1.8/rubygems.rb:131:in `activate': (Gem::LoadError)
Could not find RubyGem sources (> 0.0.0)
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:34:in `require_gem'
# Backtrace snipped

# I can change it to the default location, but to no avail
05:57:54 ruerue@purr> nano -w .gemrc

06:00:36 ruerue@purr> cat .gemrc
gem: --gen-rdoc --run-tests
rdoc: --all --line-numbers --inline-source
gemhome: /usr/lib/ruby/site_ruby/1.8/rubygems
gempath:
- /usr/lib/ruby/site_ruby/1.8/rubygems

06:00:39 ruerue@purr> gem install -r og
Attempting remote installation of 'og'
/usr/lib/ruby/site_ruby/1.8/rubygems.rb:131:in `activate': (Gem::LoadError)
Could not find RubyGem sources (> 0.0.0)
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:34:in `require_gem'
# ...

# Removing it works, though
06:00:48 ruerue@purr> nano -w .gemrc

06:04:11 ruerue@purr> cat .gemrc
gem: --gen-rdoc --run-tests
rdoc: --all --line-numbers --inline-source
gempath:
- /usr/lib/ruby/site_ruby/1.8/rubygems

06:04:15 ruerue@purr> gem install -r og
Attempting remote installation of 'og'
Install required dependency extensions? [Yn]


2 Answers

Jim Weirich

3/8/2005 12:21:00 PM

0

On Tuesday 08 March 2005 01:09 am, ES wrote:
> On my system, anything in the gemhome field in .gemrc seems to render
> Gems unusable.

The reason it is failing is that gems requires a "sources" gem be available to
tell it where to the sites to use to get remote gems. You can work around
this by putting the standard gem repository in the gem path, while leaving
the new gemhome be the target for new installations.

Here's what worked for me on my linux system.

First, with an unmodified .gemrc file, find the directory of the current gem
home:

$ gem env gemdir
/usr/local/lib/ruby/gems/1.8

Now edit .gemrc to contain ...

gem: --gen-rdoc --run-tests
rdoc: --all --line-numbers --inline-source
gemhome: /home/ruerue/lib/ruby
gempath:
- /usr/local/lib/ruby/gems/1.8

Now the .gemrc file will direct all new installations to
the /home/ruerue/lib/ruby directory.

It would be nice to have a way of initializing a new gem home directory with
the sources package. Then you wouldn't need to have the original gem
directory in the gem path. I suppose you could do it by hand, but I haven't
tried it.

--
-- Jim Weirich jim@weirichhouse.org http://onest...
-----------------------------------------------------------------
"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)


ES

3/8/2005 4:30:00 PM

0

Jim Weirich wrote:
> On Tuesday 08 March 2005 01:09 am, ES wrote:
>
>>On my system, anything in the gemhome field in .gemrc seems to render
>>Gems unusable.
>
>
> The reason it is failing is that gems requires a "sources" gem be available to
> tell it where to the sites to use to get remote gems. You can work around
> this by putting the standard gem repository in the gem path, while leaving
> the new gemhome be the target for new installations.
>
> Here's what worked for me on my linux system.
>
> First, with an unmodified .gemrc file, find the directory of the current gem
> home:
>
> $ gem env gemdir
> /usr/local/lib/ruby/gems/1.8
>
> Now edit .gemrc to contain ...
>
> gem: --gen-rdoc --run-tests
> rdoc: --all --line-numbers --inline-source
> gemhome: /home/ruerue/lib/ruby
> gempath:
> - /usr/local/lib/ruby/gems/1.8
>
> Now the .gemrc file will direct all new installations to
> the /home/ruerue/lib/ruby directory.

Thanks for the idea! I had tried it already, though, but no luck. I'm
thinking it's probably got something to do with how Gentoo packages
RubyGems. I'll look into it. In the meanwhile I'm using --install-dir
and put my library path in gempath instead.

> It would be nice to have a way of initializing a new gem home directory with
> the sources package. Then you wouldn't need to have the original gem
> directory in the gem path. I suppose you could do it by hand, but I haven't
> tried it.

Maybe you can just separate RUBYGEMS_HOME from GEM_HOME?

E