What am I really removing by running "gem sources -c"?

I ran " gem sources -c ", so I must deliberately indicate where I want to install the gem, since now I have 3 different sources for installing gem - RubyForge, Github and Gemcutter.

 C:\>gem sources -c *** Removed specs cache *** *** Removed user source cache *** *** Removed latest user source cache *** *** Removed system source cache *** *** Removed latest system source cache *** 

After executing this command, I started gem sources again to make sure that I no longer have default sources, and I get the following:

 C:\>gem sources *** CURRENT SOURCES *** http://gems.rubyforge.org http://gems.github.com http://gems.rubyforge.org/ http://gemcutter.org 

In other words, nothing has changed .

Looking at the gem sources -c help below, it seems like the right command to remove all gem sources at once:

  -c, --clear-all Remove all sources (clear the cache) 

Otherwise, it seems you need to delete them one at a time. Not very important, since I only have 4, but I wonder what I really deleted by doing " gem sources -c " .

 C:\>gem sources --help Usage: gem sources [options] Options: -a, --add SOURCE_URI Add source -l, --list List sources -r, --remove SOURCE_URI Remove source -c, --clear-all Remove all sources (clear the cache) -u, --update Update source cache Local/Remote Options: -p, --[no-]http-proxy [URL] Use HTTP proxy for remote operations Common Options: -h, --help Get help on this command -V, --[no-]verbose Set the verbose level of output -q, --quiet Silence commands --config-file FILE Use this config file instead of default --backtrace Show stack backtrace on errors --debug Turn on Ruby debugging 
+4
source share
1 answer

For each source, rubygems stores local caches of gem information placed at each source, etc., to speed up operations, and this command simply clears these caches.

Looking at the source of rubygems, in my system it, for example, deletes

 C:/Users/Kris/.gem/specs C:/Users/Kris/.gem/source_cache C:/Users/Kris/.gem/latest_source_cache C:/Ruby/lib/ruby/gems/1.8/source_cache C:/Ruby/lib/ruby/gems/1.8/latest_source_cache 

You still have to delete the actual sources yourself.

+1
source

All Articles