Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specify source when using gem install with two sources

Tags:

ruby

gem

We do have an internal gem server (http://my.gem.server) and at this server we store the gem foo-1.2.3.gem

Our users add this server to the gem source. Our gem source looks like::

*** CURRENT SOURCES ***

https://rubygems.org/
http://my.gem.server/

So far it was working wonderfully.

Then someone at the community created the foo-0.0.1.gem

Now, when our internal clients perform a gem install, the foo-0.0.1.gem from the community is installed instead of our foo-1.2.3.gem

We have tried putting our source before the standard rubygems.org but still get the same results.

Does anyone know how can I tell gem install to get the gem from our internal source?

It would be even better if it would just hit the community source if it does not find on ours.

like image 687
Edu Avatar asked Feb 05 '15 17:02

Edu


1 Answers

You have two options:

Specify the source in the command

gem install --source http://my.gem.server/ install foo

Edit the ${HOME}/.gemrc file

change

:sources:
  - http://rubygems.org
  - http://my.gem.server

to

:sources:
  - http://my.gem.server
  - http://rubygems.org
like image 83
ptierno Avatar answered Nov 15 '22 00:11

ptierno