[Rubygems-developers] Personal repos, for development and testing?

Jim Weirich jim at weirichhouse.org
Wed Feb 1 15:15:57 EST 2006

Hugh Sasse wrote:
> On Wed, 1 Feb 2006, Jim Weirich wrote:
>> gem install PACKAGEXYZ -i my_personal_repository
>> export GEM_HOME=my_personal_repository
>> (untested ... but something like that should work)
> Thanks, I got part way with the -i, but couldn't understand where
> I'd got to.  Would a patch like:
> --- ./lib/rubygems/gem_commands.rb.orig 2005-07-10 11:20:26.000000000 +0000
> +++ ./lib/rubygems/gem_commands.rb      2006-02-01 19:47:12.113260000 +0000
> @@ -978,7 +978,7 @@
>          out = "Rubygems Environment:\n"
>          out << "  - VERSION: #{Gem::RubyGemsVersion} (#{Gem::RubyGemsPackageVersion})\n"
>          out << "  - INSTALLATION DIRECTORY: #{Gem.dir}\n"
> -        out << "  - GEM PATH:\n"
> +        out << "  - GEM PATH:  (set ENV[\"GEM_HOME\"] to change)\n"
>          Gem.path.collect { |p| out << "     - #{p}\n" }
>          out << "  - REMOTE SOURCES:\n"
>          Gem::RemoteInstaller.new.sources.collect do |s|
> be a useful thing to have?

Actually, you can set the gem path directly with the GEM_PATH 
environment variable.  GEM_PATH says what repositories to search. 
GEM_HOME says where to install new gems into.  If GEM_HOME is not in 
GEM_PATH, it will be added to the list to search.  If GEM_HOME is not 
set, the first repository on GEM_PATH is used as the home.

I'm going on memory here, so I might have some of the details wrong.  I 
thought this was written up somewhere.  If its not, we should get this 
into the docs.

Now that I think about it, you probably want to add you personal 
repository to GEM_PATH, so that the main one remains as GEM_HOME (the -i 
switch overrides GEM_HOME).  If you always want to install to your 
personal repository, then set it as GEM_HOME as mentioned in the earlier 

-- Jim Weirich       jweirich at one.net      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