-6ren">
gpt4 book ai didi

ruby - 我通过运行 "gem sources -c"实际上删除了什么?

转载 作者:数据小太阳 更新时间:2023-10-29 07:38:46 26 4
gpt4 key购买 nike

我运行了“gem sources -c”,所以我必须特意指定我想从哪里安装 gem,因为我现在有 3 个不同的 gem 安装源 - RubyForge、Github 和 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 ***

运行此命令后,我再次运行 gem sources 以确保我不再有任何默认源并且我得到了这个:

C:\>gem sources
*** CURRENT SOURCES ***

http://gems.rubyforge.org
http://gems.github.com
http://gems.rubyforge.org/
http://gemcutter.org

换句话说,什么都没有改变

查看下面的 gem sources -c 的帮助,似乎是一次删除所有 gem 源的正确命令:

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

不然的话,貌似还得一一去掉。 没什么大不了的,因为我只有 4 个,但我想知道我通过执行“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

最佳答案

对于每个源,rubygems 都会在本地缓存有关每个源等处托管的 gems 的信息,以加快操作速度,而该命令只会清除这些缓存。

查看 ruby​​gems 源代码,例如在我的系统上它删除了

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

您仍然需要自己删除实际来源。

关于ruby - 我通过运行 "gem sources -c"实际上删除了什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1650907/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com