Relocatable ruby distribution

Hi All:

I’ve convinced the java project to allow ruby (yay!), and now we
want to include and control the ruby dist, libraries and gems and all
in svn. Since the project can be checked out anywhere I want to be
able to relocate ruby. I tried allinoneruby (happily used ruby2exe on
a different project), and can’t figure out how to get it to include
all the libs and gems. I also tried to point $: at the correct
locations, but got an unresolved lib.

Is there a std way to do this?

Thanks

Forrest

I should also point out we’re running RHEL4 64 bit, though we want to
move to running windows builds as well.

Thanks in advance

Forrest

On 4/30/07, fkc_email-news @ yahoo dot com [email protected]
wrote:

Is there a std way to do this?

Seems like, since you are already using java, that it would be better to
use
jruby. http://jruby.codehaus.org/

Thanks

On 4/30/07, fkc_email-news @ yahoo dot com [email protected]
wrote:

I’ve convinced the java project to allow ruby (yay!), and now we
want to include and control the ruby dist, libraries and gems and all
in svn. Since the project can be checked out anywhere I want to be
able to relocate ruby. I tried allinoneruby (happily used ruby2exe on
a different project), and can’t figure out how to get it to include
all the libs and gems. I also tried to point $: at the correct
locations, but got an unresolved lib.

Is there a std way to do this?

Check out:
http://developers.joyent.com/
it looks like they build a tree with the ruby binaries and libraries and
have a script to override the environment to point to that version of
Ruby.

On 4/30/07, fkc_email-news @ yahoo dot com [email protected]
wrote:

Hi All:
I’ve convinced the java project to allow ruby (yay!), and now we
want to include and control the ruby dist, libraries and gems and all
in svn. Since the project can be checked out anywhere I want to be
able to relocate ruby. I tried allinoneruby (happily used ruby2exe on
a different project), and can’t figure out how to get it to include
all the libs and gems. I also tried to point $: at the correct
locations, but got an unresolved lib.

What was your error? A quick test seems to indicate that hijacking $:
works:

/opt/bin/ruby -e ‘puts $:; require “rubygems”’
/opt/lib/ruby/site_ruby/1.8
/opt/lib/ruby/site_ruby/1.8/i686-linux
/opt/lib/ruby/site_ruby
/opt/lib/ruby/1.8
/opt/lib/ruby/1.8/i686-linux
.
mv /opt /tmp/
/tmp/opt/bin/ruby -e ‘puts $:; require “rubygems”’
/opt/lib/ruby/site_ruby/1.8
/opt/lib/ruby/site_ruby/1.8/i686-linux
/opt/lib/ruby/site_ruby
/opt/lib/ruby/1.8
/opt/lib/ruby/1.8/i686-linux
.
-e:1:in `require’: no such file to load – rubygems (LoadError)
from -e:1
/tmp/opt/bin/ruby -e ‘$:.map{|d|d.gsub!(/^/, “/tmp”)}; puts $:; require “rubygems”’
/tmp/opt/lib/ruby/site_ruby/1.8
/tmp/opt/lib/ruby/site_ruby/1.8/i686-linux
/tmp/opt/lib/ruby/site_ruby
/tmp/opt/lib/ruby/1.8
/tmp/opt/lib/ruby/1.8/i686-linux
.

On 5/1/07, Logan C. [email protected]ain.invalid wrote:

On 4/30/07, fkc_email-news @ yahoo dot com [email protected] wrote:

Is there a std way to do this?

Seems like, since you are already using java, that it would be better to use
jruby. http://jruby.codehaus.org/

Yes I second that. JRuby has some excellent features, but one of the
nicest
for a Java shop is that you can bundle Ruby code in java containers
(jar/war).
Which I think would really help the OP, if he wants a convenient way to
organise the Ruby elements under SVN.

Though I have to wonder about about storing the Ruby runtime - thats
kind of
overkill isn’t it?

OT: This brings me to an issue that I have been pondering for some time:

  • what is the minimum (file size) configuration of a Ruby Runtime
    install?

I recently did a portable apps install of Ruby onto my usb drive, but it
was
formatted as FAT so all those little files ended up taking huge amounts
of
space (The Ruby Runtime takes over 1.2 GB of the usb drive). Admittedly
there were quite a few gems installed there too.

What can be safely deleted? The RDoc & RI stuff comes to mind (I would
hate to be offline if I needed them … but RI takes 200MB on its own)

Richard C. wrote:

(jar/war).
Which I think would really help the OP, if he wants a convenient way to
organise the Ruby elements under SVN.

Though I have to wonder about about storing the Ruby runtime - thats
kind of
overkill isn’t it?

OT: This brings me to an issue that I have been pondering for some time:

  • what is the minimum (file size) configuration of a Ruby Runtime install?

With no gems and no docs included, we have a “jruby-complete” jar file
that has the full JRuby runtime plus the standard libraries we support
(most of them) that’s around 3MB. Not too shabby for a complete Ruby
interpreter.

java -jar jruby-complete.jar -e “puts ‘hello’”

  • Charlie

On 5/3/07, Charles Oliver N. [email protected] wrote:

Richard C. wrote:

OT: This brings me to an issue that I have been pondering for some time:

  • what is the minimum (file size) configuration of a Ruby Runtime install?

With no gems and no docs included, we have a “jruby-complete” jar file
that has the full JRuby runtime plus the standard libraries we support
(most of them) that’s around 3MB. Not too shabby for a complete Ruby
interpreter.

Niiice. Didn’t think it would go that low. Its not what I expected, but
getting
it that lean has implications for say getting a DSL into a Java app. I
know
in our line of work the size of the Java runtime is always an issue.

Any resources on trimming the non-essentials? Considering that I do
wish to use gems and such. Its one thing to trim out docs &
non-essentials
from the 1-click, but I would probably need to install local gems and
stuff.

Might be nice if there was a Rake task to do this all.

java -jar jruby-complete.jar -e “puts ‘hello’”

Hmmm … I am going to have to start messing with JRuby pretty hardcore

it would map well to some of the Camping I am doing now.

/opt/lib/ruby/site_ruby
/opt/lib/ruby/1.8
/opt/lib/ruby/1.8/i686-linux

I’m away from my system at work (at RailsConf), but if I recall, it
has to do with C based extensions that I compiled.

I’d make a guess that the c libs are trying to link to libs that are
now not where they were when they were compiled. Thus the unresolved
lib errors.

Dunno if I tried to manipulate LD_LIBRARY_PATH, mebbe that’s it.
Maybe I’ll try that when I get back.

Richard C. wrote:

Any resources on trimming the non-essentials? Considering that I do
wish to use gems and such. Its one thing to trim out docs & non-essentials
from the 1-click, but I would probably need to install local gems and
stuff.

Gems are a bit tricky, since they want to be loose on the filesystem and
we don’t (yet) have a way to fake Ruby’s “File” class to work from
within a JAR file. You could get around it by installing the gem
contents directly, I suppose. We’ll have a better answer here in the
future (post 1.0).

Might be nice if there was a Rake task to do this all.

Yes, that would be very nice, and it’s a good idea. In general though
you’s currently have to trim it yourself. Of course the “complete” JAR
is just a zip file, so you could unpack, delete, repack and get the same
results. I’ve done this to trim it down to just have IRB included, which
lowers the total size to more like 1.6MB. With better compression
(pack200 for example) it could be even smaller.

java -jar jruby-complete.jar -e “puts ‘hello’”

Hmmm … I am going to have to start messing with JRuby pretty hardcore -
it would map well to some of the Camping I am doing now.

Last I’d heard, Camping works well in JRuby.

  • Charlie

On May 3, 3:12 am, “Richard C.” [email protected] wrote:

Which I think would really help the OP, if he wants a convenient way to
organise the Ruby elements under SVN.

My problem is the already developed apps use a number of C extension/c
library backed apps, so w/o needing to create substitute libs to be
able run under jruby isn’t in the cards.

However, I’ve already added jruby to our dists and have extended ant
to support jruby scripting, and plan to leverage jruby in other
situations.

Jim W. was telling about Charles and Tom’s (hi guys) tutorial
this morning and the way he described them deploying to mongrel, then
glassfish, then hot refresh under glassfish seems quite promising. I
used JRuby about 2.5 years ago on a project that needed to communicate
w/JMS, JRuby has come quite a ways since then.

Though I have to wonder about about storing the Ruby runtime - thats kind of
overkill isn’t it?

It’s all about configuration mgmt - ensuring that we have the same env
anywhere we deploy got my gems and extensions that I need.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs