开发者

What did I actually delete by running "gem sources -c"?

开发者 https://www.devze.com 2022-12-10 01:23 出处:网络
I ran \"gem sources -c\" so that I have to deliberately specify where I want to install a gem from since I now have 3 different sources for gem installs - RubyForge, Github and Gemcutter.开发者_运维问

I ran "gem sources -c" so that I have to deliberately specify where I want to install a gem from since I now have 3 different sources for gem installs - 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 running this command I again ran gem sources to make sure I no longer have any default sources and I get this:

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 help for gem sources -c below it seems to be the correct command to remove all gem sources at once:

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

Otherwise, it seems you have to remove them one by one. Not a big deal since I only have 4 but I wonder what I actually 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


For each source rubygems keeps local caches of information about gems hosted at each source etc to speed up operations and that command just clears those caches.

Looking at the rubygems source, on my system it for example removes

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'll still have to remove the actual sources yourself.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号