简体   繁体   English

我可以从Ruby中删除什么并且仍然支持Rake / gems?

[英]What can I remove from Ruby and still have it support Rake/gems?

I'm building a large .NET project using Rake . 我正在使用Rake构建一个大型.NET项目。 We committed the Ruby environment to our source control and install gems to this "local" environment (like Albacore, Nokogiri, etc). 我们将Ruby环境委托给源代码管理,并将gems安装到此“本地”环境(如Albacore,Nokogiri等)。 We're essentially following this guidance , using the RubyInstaller for Windows zip package . 实际上,我们使用RubyInstaller for Windows zip软件包遵循此指南

trunk/
  source/
  packages/
  ruby/          <-- ruby here!
  build.bat      <-- helper scripts (call Ruby/rake)
  Solution.sln

However, our source control server is remotely hosted, on a virtual machine, and the link speed is slow. 但是,我们的源代码控制服务器是远程托管在虚拟机上的,链接速度很慢。 I've read that some people have trimmed down the Ruby environment, like in the Machine.Specifications project . 我已经读到有些人已经简化了Ruby环境,例如在Machine.Specifications project中 But, that looks extreme! 但是,那看起来太极端了! (is there even gem support there?) (那里甚至有宝石支持吗?)

I could just start deleting files and directories to see what works, but there must be some known set of files that can be removed and still support basic Ruby, Rake, and gems? 我可以开始删除文件和目录,看看有什么用,但是必须删除一些已知文件,并且仍然支持基本的Ruby,Rake和gems?

From my own experimentation and investigation, it's kind of hard to determine what's "required" and what's optional. 从我自己的实验和调查中,很难确定什么是“必需的”以及什么是可选的。 There are some files that appear very safe and easy to remove and others that I'd rather not play with. 有些文件看起来非常安全且易于删除,而另一些我不希望使用。 My results below only save about 5 MB... probably not enough to warrant doing this at all . 我下面不仅导致节省约5 MB ......可能不足以保证在所有这样做。

bin 箱子

The ruby/bin directory contains many batch scripts that are simply helpers to invoke the ruby executable with the correct "applicaton", like Rake or Gem. ruby/bin目录包含许多批处理脚本,它们只是使用正确的“ applicaton”(例如Rake或Gem)来调用ruby可执行文件的助手。 For example, rake.bat contains this line 例如, rake.bat包含以下行

@"%~dp0ruby.exe" "%~dpn0" %*

You can replace this with the right comamnd in your build.bat script (assuming it's "up" one level above the ruby environment, probably at the solution root) 您可以在build.bat脚本中用正确的命令替换它(假设它在ruby环境上方“上”一层,可能在解决方案的根目录)

@"%~dp0ruby\bin\ruby.exe" "%~dp0ruby\bin\rake" %*

You could dump the rest of the batch scripts, but then you'll have a little more trouble installing gems into the local environment. 您可以转储其余的批处理脚本,但是在将gems安装到本地环境中时会遇到更多麻烦。

cmd> ruby\bin\ruby.exe ruby\bin\gem install <whatever>

And, as of Ruby 1.9.3, that's only saving you 1.38KB. 而且,从Ruby 1.9.3开始,仅节省了1.38KB。 I'm sure some of those other non-extension files in this directory can be removed, but, without knowing what they do, it's unsafe to proceed. 我确定可以删除此目录中的其他一些非扩展文件,但是,如果不知道它们的作用,则继续操作是不安全的。

include (175 KB) 包括(175 KB)

The ruby/include directory appears to contain only C header files for developing against Ruby (I'm winging it here). ruby/include目录似乎只包含用于针对Ruby进行开发的C头文件(我在此处介绍)。 I removed it and everything ran fine. 我将其删除,一切正常。

lib/tcltk (4.7 MB) lib / tcltk(4.7 MB)

The ruby/lib/tcltk looks a lot like the include directory, but for Tcl programming. ruby/lib/tcltk看起来很像include目录,但是用于Tcl编程。

lib/ruby lib /红宝石

The ruby/lib/ruby directory contains the gems for this installation and a whole lot more scary stuff. ruby/lib/ruby目录包含此安装的gem和更多令人恐惧的内容。 I'd stay out of this directory unless you want to inadvertently cripple your environment. 除非您不经意间破坏了环境,否则我将不在此目录中。

share (27 KB) 分享(27 KB)

The ruby/share directory appears to contain only help pages, dump 'em! ruby/share目录似乎只包含帮助页面,请转储!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM