Compiled Ruby? Pretty sweet...

This has made life a lot easier.  I spent a decent part of the last week working on a ruby script for deploying our application on our test and development servers.  Ruby seemed a good choice for this -- especially since I could use rake inside of it -- essentially creating a custom rakefile with a slew of useful tasks.  The only problem is that you can't always expect to have root access to the box you're using (i.e. external deployments).  Not only that, it becomes a pain in the ass to set up and maintain all the ruby dependencies for 10 boxes even if you do. 

(i.e. for one box)
$ cd /etc/yum.repos.d
$ sudo wget http://dev.centos.org/centos/4/CentOS-Testing.repo
$ sudo vi CentOS-Testing.repo   # set enabled=1
$ sudo yum install -y ruby rake ruby-devel ruby-docs ruby-ri ruby-irb ruby-rdoc
$ wget http://rubyforge.org/frs/download.php/35283/rubygems-1.1.1.tgz
$ tar -zxvf rubygems-1.1.1.tgz
$ cd rubygems-1.1.1
$ sudo ruby setup.rb
$ sudo gem install archive-tar-minitar net-ssh net-sftp --include-dependencies
$ ./yourRubyScript.rb  # run the script finally!

So how do you get around dependencies and not having super user privileges? You compile the damn script to an executable!

... Or just about.  What really happens is you end up with a binary file that houses all the dependencies (stripped down to only what you need) within it so your ruby script can be executed as though they were all installed (prob. using ruby's eval() methods) locally. 

The script (or rather gem) I used for this (rubyscript2exe) was written by this guy Erik Veenstra (http://www.erikveen.dds.nl/index2.html).  Download the gem with a simple: gem install rubyscript2exe

What's more is you can create a single executable file from an entire archive by first using his tar2rubyscript beforehand (imagine compiling and entire rails app into a single executable file -- with dependencies and everything else housed within; pretty cool).

So, with his gem, I get away from having to depend on any of the setup listed below.  Instead I get to use ruby script/rakefile straight away ; )

$ ./yourRubyScript.rb  # run the script -- immediately!