blo*_*ilk 23 ruby rubygems rdoc
我知道可以在没有文档的情况下安装宝石,但不幸的是,我在前三个月没有使用ruby.在那个时候,我设法安装了大量的宝石,但是自从我开始使用ruby以来我没有使用过我的计算机上的文档.我总是在互联网上查看文档.
从我的计算机安全删除文档的最佳方法是什么?另外,有没有办法将ruby配置为默认不安装文档?
mar*_*ekj 58
运行此命令:
rm -r "$(gem env gemdir)"/doc/*
Run Code Online (Sandbox Code Playgroud)
如果你使用cygwin在Windows上
Mik*_*use 10
Gem文档安装在[RUBY]/lib/ruby/gems/doc中,其中[RUBY]是您安装Ruby的目录(我的机器上的C:/ ruby).
我不明白为什么你不应该只删除代表不需要文档的宝石的文件夹:你总是可以重新生成它.
我知道可以使用.gemrc文件.
install: --no-rdoc --no-ri
update: --no-rdoc --no-ri
Run Code Online (Sandbox Code Playgroud)
将两行放入其中.我相信你把.gemrc文件放在$ Home目录中.
小智 6
将其中任何一个复制并粘贴到 Bourne 兼容的 shell 中:
(exec 1>&2; DIR="$(gem env gemdir)"; \
DOCDIR="$DIR"/doc; \
if [ -d "$DOCDIR" ]; then \
echo "Contents of '$DOCDIR': "; ls "$DOCDIR"/; echo ''; \
read -p "Do you really want to remove contents of RubyGems doc dir '$DOCDIR' ? [Yn] " ANS; \
if [ "$ANS" = y ] || [ "$ANS" = Y ]; then \
rm -rf "$DOCDIR"/*; \
fi; \
fi)
Run Code Online (Sandbox Code Playgroud)
(exec 1>&2; for DIR in $(gem env path | tr ':' '\n'); do \
DOCDIR="$DIR"/doc; \
if [ -d "$DOCDIR" ]; then \
echo "Contents of '$DOCDIR': "; ls "$DOCDIR"/; echo ''; \
echo '!! Possibly removes system-provided gem docs, review carefully before continuing ("n" if unsure or Ctrl-C to abort completely) !!'; \
read -p "Do you really want to remove RubyGems doc dir '$DOCDIR' ? [Yn] " ANS; \
if [ "$ANS" = y ] || [ "$ANS" = Y ]; then \
sudo rm -rf "$DOCDIR"/*; \
fi; \
fi; \
done)
Run Code Online (Sandbox Code Playgroud)
使用现代 RubyGems:
(X='gem: --no-document'; \
touch ~/.gemrc && \
grep -q "^$X$" ~/.gemrc || echo "$X" >> ~/.gemrc)
Run Code Online (Sandbox Code Playgroud)
使用旧的 RubyGems: X='gem: --no-ri --no-rdoc' ...
| 归档时间: |
|
| 查看次数: |
8245 次 |
| 最近记录: |