I have been thinking about how to go about putting ruby in a limited resource enviroment (a PDA) and have written a little hack to pull the libraries out of a tar.gz file when needed. It seems to work but I am posting it here because I am interested to hear of any potential problems people might foresee with it, ways it could be more efficient or any other space saving ideas. I am a ruby newbie so please have mercy!
ruby needs to be invoked with ruby -r "untar.rb" which is placed in the ruby library directory along with the tar.gz file and a list of the archive members.
def require source
files = File.new("libcontents").read
source.sub! /.rb/ ,""
if files =~ Regexp.new(source + ".rb")
system "tar -Ozxf rubylib.tar.gz #{source}.rb > /tmp/#{source}.rb"
super "/tmp/#{source}.rb"
File.delete "/tmp/#{source}.rb"
else
super
end
end