From: Robert Feldt Date: 2000-12-19T00:39:09+09:00 Subject: [ruby-talk:7581] Poor man's Ruby packaging of single script files Hi all, I've used a simple technique for packing up single scripts to standalone Windows executables. Its a very simple and inflexible variant of some of the ideas presented in the "Ruby packaging" thread. Its not very technically interesting but it works (for very limited uses!) without writing any new code. Here's an example: 1. Download and "extract" the standalone ruby interpreter by eban a, download ruby-X-Y-i386-msdosdjgpp.tar.gz b, unpack and copy usr/local/bin/ruby.exe to rubysae.exe 2. Pack rubysae.exe to reduce size of final exe [OPTIONAL] a, Download UPX from http://wildsau.idv.uni-linz.ac.at/mfx/upx.html and install it b, Pack rubysae.exe: upx -9 rubysae.exe 3. Make sure your script has a sharp-bang-ruby line Add "\n#! ruby\n" to beginning of script if not 4. Cat the standalone interpreter and the script together cat rubysae.exe myscr.rb > myscr.exe 5. Run giving itself as script myscr.exe -x myscr.exe A hello-world-exe with this technique (using upx compression as above) is about 270 kB. It actually executes faster than if you don't use upx to compress the ruby interpreter (same phenomenon as Ben mentioned earlier). This technique is similar to the wrap package for Tcl/Tk and also to rb2exe from eban's site. It could be extended to get the same kind of func as wrap for Tcl/Tk if someone would write pure Ruby code to access zip compressed archives. Anyone knows if this is available? (I briefly checked out Ruby/zlib but don't think it can handle archives, only single files. Anyone knows?). A further natural extension would be to make a custom version of the i386-msdosdjgpp ruby interpreter so that you don't need the "-x myself" workaround. Regards, Robert Feldt