在gem安装nokogiri后删除不必要的临时文件 [英] Remove unnecessary temporary files after gem install nokogiri

查看:128
本文介绍了在gem安装nokogiri后删除不必要的临时文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须使用 nokogiri 进行一些xml处理。
为此,我创建一个特定于该项目的rvm gemset,并通过gem install nokogiri安装nokogiri。没有问题。

I have to use nokogiri for some xml processing. For this I create a rvm gemset specific to the project and install nokogiri by gem install nokogiri. No problems this far.

但是当我看着〜.rvm / gems / ruby​​ -... @ nokogiri / gems / nokogiri -... / ext / nokogiri /和它的子文件夹,我在文件系统中看到了价值140MB的文件。

But when I look into ~.rvm/gems/ruby-...@nokogiri/gems/nokogiri-.../ext/nokogiri/ and its subfolders I see files worth of 140MB in the filesystem.

是否有一些通用的方法来清除这个垃圾?

Is there some generic way of removing this cruft?

推荐答案

这比我得到的稍大。我在OS X上看到了108MB,主要犯罪分子是 ext 中的88MB,端口中的18MB,750k中 test 和520k在 lib

That's slightly larger than what I get. I see 108MB on OS X, with the major offenders being 88MB in ext, 18MB in ports, 750k in test and 520k in lib.

ext / nokogiri 你当然不需要87MB的 tmp 目录。所以这是一个很大的节省。

In ext/nokogiri you certainly don't need the 87MB of tmp directory. So that's a major savings right there.

phrogz$ pwd
/Users/phrogz/.rvm/gems/ruby-1.9.3-p392/gems/nokogiri-1.6.1

phrogz$ du -sh .
 108M     .

phrogz$ rm -rf ext/tmp
phrogz$ du -sh .
 21M     .

然后,您也不需要任何源代码,头文件或编译的文件:
$ b

Then again, you also don't need any of the source, header, or compiled files in there, either:

phrogz$ cd ext/nokogiri/
phrogz$ rm *.c *.h *.o
phrogz$ cd ../../
phrogz$ du -sh .
 20M     .

我敢肯定你不需要 ports / archives 目录,其中包含libxml2和libxslt的 .tar.gz 源代码:

I'm pretty sure you don't need the ports/archives directory, which contains the .tar.gz source of libxml2 and libxslt:

phrogz$ rm -rf ports/archives/
phrogz$ du -sh .
 12M     .

然后,您可以确实删除一些库文件:

And then there's a few megs of documentation for the libraries you can remove for sure:

phrogz$ rm -rf ports/x86_64-apple-darwin13.1.0/libxml2/2.8.0/share/doc/
phrogz$ rm -rf ports/x86_64-apple-darwin13.1.0/libxml2/2.8.0/share/gtk-doc/
phrogz$ rm -rf ports/x86_64-apple-darwin13.1.0/libxslt/1.1.26/share/doc/
phrogz$ du -sh .
 4.4M     .

您可能会进一步削减它,去掉 test code>目录。但现在你已经在这个问题上取得了巨大的进展。

You could probably pare it down further, removing things like the test directory. But now you've made a huge dent in the problem.

这篇关于在gem安装nokogiri后删除不必要的临时文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆