简体   繁体   中英

Name conflict when installing a ruby gem

I am hosting a ruby gem repository which hosts several of my gems for my applications. I am running into some problems when I try to install one of my gems that has the same name as a gem on rubyforge.

gem.config

---
:benchmark: false
:update_sources: true 
:verbose: true
:backtrace: false
:sources:
- http://gems.rubyforge.org
- http://localhost:8888
:bulk_threshold: 1000

Using the command to install mygem:

gem install mygem --config-file gem.config

This will install the 'mygem' from the http://gems.rubyforge.org repository. When I re-order the sources in the gem.config file, I get the same results.

Is there a way to define my gem repository as the default and fallback to another repository if the gem can't be found?

Gem names must be globally unique. If there are multiple gems with the same name, the results are undefined.

If the gem repository is local you can use the --local option on the gem command:

gem install mygem --local --config-file gem.config 

Also I believe that if you switch the order of your sources (specifying localhost first) gem will try that repository first (and pick up the gems you have with the same name as rubygems repository)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM