Q:

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

I'm building a large .NET project using Rake . We committed the Ruby environment to our source control and install gems to this "local" environment (like Albacore, Nokogiri, etc). We're essentially following this  guidance, using the RubyInstaller for Windows zip package.
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. 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?

A:

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.
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. For example, rake.bat contains this line
@"%~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)
@"%~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.
cmd> ruby\bin\ruby.exe ruby\bin\gem install <whatever>

And, as of Ruby 1.9.3, that's only saving you 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)
The ruby/include directory appears to contain only C header files for developing against Ruby (I'm winging it here). I removed it and everything ran fine.
lib/tcltk (4.7 MB)
The ruby/lib/tcltk looks a lot like the include directory, but for Tcl programming.
lib/ruby
The ruby/lib/ruby directory contains the gems for this installation and a whole lot more scary stuff. I'd stay out of this directory unless you want to inadvertently cripple your environment.
share (27 KB)
The ruby/share directory appears to contain only help pages, dump 'em!

