Need help with miniruby


(Mike Wilson) #1

I’m trying to put an app together that I would need to run on quite a few
like systems, and I’d like to not have to install ruby on each one.
Currently, I’m trying to use miniruby to accomplish this. Is this an ok way
to go?

So, far I have a directory structure that looks like this:

/usr/local/myapp
/usr/local/myapp/runmyapp <- #!bin/miniruby …
$LOAD_PATH << “lib”
/usr/local/myapp/bin/miniruby
/usr/local/myapp/lib/*.rb
/usr/local/myapp/lib/digest.so
/usr/local/myapp/lib/digest/md5.so

Which mostly works, except I need access to the md5 stuff and I seem to have
problems using it after copying the digest.so and md5.so into my lib
directory. Rather than printing an md5 hash when I do something like
digest.to_s, it prints the Object reference (#MD5:0xe77b8). Also, I have
to explicitly require “digest”. I assume that I have some issue with
autoloading, but I’m not sure. Can anyone tell me how to fix this?

What’s the best way to do this, or does everyone just install all of ruby?

···

Check your PC for viruses with the FREE McAfee online computer scan.
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963


(Gennady) #2

Mike Wilson wrote:

I’m trying to put an app together that I would need to run on quite a
few like systems, and I’d like to not have to install ruby on each one.
Currently, I’m trying to use miniruby to accomplish this. Is this an ok
way to go?

So, far I have a directory structure that looks like this:

/usr/local/myapp
/usr/local/myapp/runmyapp <- #!bin/miniruby …
$LOAD_PATH << “lib”
/usr/local/myapp/bin/miniruby
/usr/local/myapp/lib/*.rb
/usr/local/myapp/lib/digest.so
/usr/local/myapp/lib/digest/md5.so

Which mostly works, except I need access to the md5 stuff and I seem to
have problems using it after copying the digest.so and md5.so into my
lib directory. Rather than printing an md5 hash when I do something
like digest.to_s, it prints the Object reference (#MD5:0xe77b8).
Also, I have to explicitly require “digest”. I assume that I have some
issue with autoloading, but I’m not sure. Can anyone tell me how to fix
this?

What’s the best way to do this, or does everyone just install all of ruby?


Check your PC for viruses with the FREE McAfee online computer scan.
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963

Actually, you can use ruby exactly same way as you use miniruby now. I
also ship ruby executable together with my application plus all standard
ruby library files required by the application (I put them in my own
directories and adjust $LOAD_PATH as you do). Just to note, ruby
executable does not need any of the standard ruby library files to
function properly (unless your application explicitly require them).

I am not sure what’s the problem with digest.so and md5.so in
"miniruby", however with just “ruby” everything works great.

Gennady.


(Laza) #3

Why don’t you use rubyscript2exe? It creates an executable which tars/zips
rub interpreter plus all ruby files/libs used by your script.

-Laza
http://lazax.com/blog

···

On Tue, 30 Dec 2003 06:16:03 +0900, Gennady gfb@tonesoft.com wrote:

Mike Wilson wrote:

I’m trying to put an app together that I would need to run on quite a
few like systems, and I’d like to not have to install ruby on each
one. Currently, I’m trying to use miniruby to accomplish this. Is
this an ok way to go?