Stripping down One-Click Ruby Installer folder for deployment

Hi,

I’d like to deploy an client ruby application by copying the “c:\ruby”
folder to the target computers.

It works fine, except that c:\ruby is 177 MB big, and full of things
that are not necessary at all on client computers.

I have tried keeping the following folders:

  • “c:\ruby.”
  • “c:\ruby\bin”
  • “c:\ruby\lib”

It works, but I’d like to know if anyone has a more “scientific”
approach to that problem. What folders are absolutely needed?

Note that I know about rubyscript2exe.rb; it works just fine for small
applications, but it’s not an option in this case.

Thanks!

Philippe

On Oct 22, 9:35 am, “Philippe L.” [email protected]
wrote:

  • “c:\ruby.”

Philippe

Phillipe, most of the used space is wasted on documentation (in the
form of yaml for RI and .html for Rdoc).

Those are located in lib\ruby\gems\1.8\doc and the share\ri
\1.8\system

Also, try removing gems that you don’t need for it.

I know, isn’t “scientific” nor bulletproof, but will work :slight_smile:

HTH,

Luis

Luis L. wrote:

I have tried keeping the following folders:

Also, try removing gems that you don’t need for it.

I know, isn’t “scientific” nor bulletproof, but will work :slight_smile:

I’ve asked for just a “core Ruby” distro in the past (i.e. no stdlib
even), but Matz was less than enthusiastic about it.

Regards,

Dan

On Oct 23, 10:55 am, “Philippe L.” [email protected]
wrote:

small applications, but it’s not an option in this case.

FileUtils.rm_rf($NEW_PATH + ‘\lib\ruby\gems\1.8\doc’)

If anyone is able to strip down the c:\ruby directory for deployment
even more, your help is welcome!

Yeah, it’s possible.

The thing is that Ruby (and One-Click) ship with a lot of things that
you rarely will use (or you aren’t aware they are present).

Part of the idea for next releases of One-Click cover this topic, but
still no plan on how that will be achieved. One of things will be
Installer merge modules (MSM) to modularize the whole installer.

I’m collecting a few questions for a survey [1] to focus on what users
want/need for the next release. Please jump in to rubyinstaller-
[email protected] and provide feedback of what you will love it to
have (or better/more questions for the survey).

Regards,

[1]
http://rubyforge.org/pipermail/rubyinstaller-devel/2007-October/000202.html

Luis

On 10/23/07, Philippe L. [email protected] wrote:

FileUtils.rm_rf($NEW_PATH)
FileUtils.mkdir($NEW_PATH)
FileUtils.cp_r($OLD_PATH + ‘\bin’, $NEW_PATH + ‘\bin’)
FileUtils.cp_r($OLD_PATH + ‘\lib’, $NEW_PATH + ‘\lib’)
FileUtils.rm_rf($NEW_PATH + ‘\lib\ruby\gems\1.8\doc’)

If anyone is able to strip down the c:\ruby directory for deployment
even more, your help is welcome!

You may try (but not I am not sure if this will work, I guess it
will be regenerated on demand):

FileUtils.rm_rf($NEW_PATH + ‘\lib\ruby\gems\1.8\cache’)
FileUtils.rm_rf($NEW_PATH + ‘\lib\ruby\gems\1.8\source_cache’)

If you don’t plan on compiling extensions, you may remove *.lib

Download spacemonger to see what are the largest files/dirs.

You may strip more stuff, depending on what do you need - there’s a
lot of stuff for TK for example, just make sure your stuff still runs
:wink:

On Oct 23, 4:53 pm, “Jano S.” [email protected] wrote:

$OLD_PATH = ‘c:\ruby’

Download spacemonger to see what are the largest files/dirs.

You may strip more stuff, depending on what do you need - there’s a
lot of stuff for TK for example, just make sure your stuff still runs
:wink:

The other, more complex, will involve use of something like Exerb [1]
to trace what files your application use.

(inside Exerb there is a tool called mkexy)

This will generate a .exy file containing which file and paths (and
extensions) are required by your application.

You just need to add later the ruby.exe, rubyw.exe (if you are
developing GUI applications) and of course msvcrt-libruby18.dll

Try to recreate the folder structure listed in the .exy and just put
there the files indicated.

Use this carefully, I haven’t tested enough to confirm work in all
cases.

Regards,

Luis

[1] Exerb Project

Luis L. wrote:

I have tried keeping the following folders:

Also, try removing gems that you don’t need for it.

I know, isn’t “scientific” nor bulletproof, but will work :slight_smile:

Hi Luis,

This is the script I use. It strips down the c:\ruby directory from 179
MB to 51 MB on my computer, and apparently, everything works. It is
still very big, but acceptable, especially when compressed in RAR: 14.3
MB.


$OLD_PATH = ‘c:\ruby’
$NEW_PATH = ‘c:\ruby_stripped’

require ‘fileutils’

FileUtils.rm_rf($NEW_PATH)
FileUtils.mkdir($NEW_PATH)
FileUtils.cp_r($OLD_PATH + ‘\bin’, $NEW_PATH + ‘\bin’)
FileUtils.cp_r($OLD_PATH + ‘\lib’, $NEW_PATH + ‘\lib’)
FileUtils.rm_rf($NEW_PATH + ‘\lib\ruby\gems\1.8\doc’)

If anyone is able to strip down the c:\ruby directory for deployment
even more, your help is welcome!

Regards,

Philippe

Jano S. wrote:

You may try (but not I am not sure if this will work, I guess it
You may strip more stuff, depending on what do you need - there’s a
lot of stuff for TK for example, just make sure your stuff still runs
:wink:

Hi Jano,

Thanks, I was able to strip the ruby directory even further, with your
help and the following script:


$OLD_PATH = ‘c:\ruby’
$NEW_PATH = ‘c:\ruby_stripped’

require ‘fileutils’

FileUtils.rm_rf($NEW_PATH)
FileUtils.mkdir($NEW_PATH)
FileUtils.cp_r($OLD_PATH + ‘\bin’, $NEW_PATH + ‘\bin’)
FileUtils.cp_r($OLD_PATH + ‘\lib’, $NEW_PATH + ‘\lib’)
FileUtils.rm_rf($NEW_PATH + ‘\lib\ruby\gems\1.8\doc’)
FileUtils.rm_rf($NEW_PATH + ‘\lib\ruby\gems\1.8\cache’)
FileUtils.rm_rf($NEW_PATH + ‘\lib\ruby\gems\1.8\source_cache’)
FileUtils.rm_rf($NEW_PATH + ‘\lib\msvcrt-ruby18-static.lib’)
FileUtils.rm_rf($NEW_PATH + ‘\lib\msvcrt-ruby18.lib’)
FileUtils.rm_rf($NEW_PATH +
‘\lib\ruby\gems\1.8\gems\fxruby-1.6.12-mswin32\doc’)
FileUtils.rm_rf($NEW_PATH +
‘\lib\ruby\gems\1.8\gems\fxruby-1.6.12-mswin32\rdoc-sources’)
FileUtils.rm_rf($NEW_PATH +
‘\lib\ruby\gems\1.8\gems\fxruby-1.6.12-mswin32\examples’)
FileUtils.rm_rf($NEW_PATH +
‘\lib\ruby\gems\1.8\gems\fxruby-1.6.12-mswin32\tests’)
FileUtils.rm_rf($NEW_PATH +
‘\lib\ruby\gems\1.8\gems\rubyscript2exe-0.5.3’)
FileUtils.rm_rf($NEW_PATH +
‘\lib\ruby\gems\1.8\gems\hpricot-0.6-mswin32’)

Deleting “cache” and “source_cache” did not harm the system, apparently.

Now, compressed with 7-ZIP, the whole directry is 5.2MB big, which is
more than acceptable for deployement.

I still have to try “Exerb” when I have more time.

Regards,

Philippe