[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Relocatable Ruby executable

Asfand Yar Qazi

2/8/2006 4:34:00 PM

Hi,

How can I create a relocatable Ruby executable? Meaning, that I can
distribute a copy of it along with the modules I need with a binary app I am
embedding Ruby into. I'm considering both actually programatically embedding
Ruby into my app using libruby.a or whatever, as well as making my app an
extension library run by the Ruby executable - if you could give details of
both, I'd be grateful.

Thanks

--
To reply, take of all ZIGs !!
5 Answers

Joel VanderWerf

2/8/2006 6:54:00 PM

0

Asfand Yar Qazi wrote:
> Hi,
>
> How can I create a relocatable Ruby executable? Meaning, that I can
> distribute a copy of it along with the modules I need with a binary app
> I am embedding Ruby into. I'm considering both actually programatically
> embedding Ruby into my app using libruby.a or whatever, as well as
> making my app an extension library run by the Ruby executable - if you
> could give details of both, I'd be grateful.
>
> Thanks
>

Are you aware of rubyscript2exe? It packages the interpreter + libraries
you require + your main script file. I've been very happy with it.

http://www.erikveen.dds.nl/rubyscript2exe/...

This is for the ruby extension approach, but not the embedding approach.

--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407


David Vallner

2/8/2006 9:24:00 PM

0

Dna Streda 08 Február 2006 17:33 Asfand Yar Qazi napísal:
> Hi,
>
> How can I create a relocatable Ruby executable? Meaning, that I can
> distribute a copy of it along with the modules I need with a binary app I
> am embedding Ruby into. I'm considering both actually programatically
> embedding Ruby into my app using libruby.a or whatever, as well as making
> my app an extension library run by the Ruby executable - if you could give
> details of both, I'd be grateful.
>
> Thanks

I -think- on Windows the ruby interpreter semiautomagically sets up the paths
it needs relative to the path where ruby.exe that was run is located, so if
you can go without the aesthetics and compactness of rubyscript2exe, you
should be able to safely get away with distributing your ruby directory along
in the application's distribution somewhere.

David Vallner


Asfand Yar Qazi

2/8/2006 9:57:00 PM

0

David Vallner wrote:
> DÅ?a Streda 08 Február 2006 17:33 Asfand Yar Qazi napísal:
>
>>Hi,
>>
>>How can I create a relocatable Ruby executable? Meaning, that I can
>>distribute a copy of it along with the modules I need with a binary app I
>>am embedding Ruby into. I'm considering both actually programatically
>>embedding Ruby into my app using libruby.a or whatever, as well as making
>>my app an extension library run by the Ruby executable - if you could give
>>details of both, I'd be grateful.
>>
>>Thanks
>
>
> I -think- on Windows the ruby interpreter semiautomagically sets up the paths
> it needs relative to the path where ruby.exe that was run is located, so if
> you can go without the aesthetics and compactness of rubyscript2exe, you
> should be able to safely get away with distributing your ruby directory along
> in the application's distribution somewhere.
>
> David Vallner
>
>

I don't think rubyscript2exe is feasible for a game - think something like
Quake 3 here. But I could be wrong. I would rather have more control over
the files I distribute, that way I can create patches that replace small files
easily - rubyscript2exe I assume bundles everything into a single file that is
unpacked at runtime.

I'll have a look at it though...

But what about when embedding Ruby in my app? How do I handle module paths then?

Thanks


--
To reply, take of all ZIGs !!

Matt Mower

2/9/2006 9:47:00 AM

0

On 08/02/06, Asfand Yar Qazi <ayZIG0106@qazizig.f2szig.com> wrote:
> But what about when embedding Ruby in my app? How do I handle module paths then?
>

After initializing the interpreter you can use rb_eval_string() to
execute arbitrary Ruby statements and, for example, setup your library
path by executing (from memory):

rb_eval_string( "$:.clear" );
rb_eval_string( "$: << "my library path" );

Regards,

Matt

--
Matt Mower :: http://matt...


Asfand Yar Qazi

2/9/2006 1:33:00 PM

0

Matt Mower wrote:
> On 08/02/06, Asfand Yar Qazi <ayZIG0106@qazizig.f2szig.com> wrote:
>
>>But what about when embedding Ruby in my app? How do I handle module paths then?
>>
>
>
> After initializing the interpreter you can use rb_eval_string() to
> execute arbitrary Ruby statements and, for example, setup your library
> path by executing (from memory):
>
> rb_eval_string( "$:.clear" );
> rb_eval_string( "$: << "my library path" );
>
> Regards,
>
> Matt
>
> --
> Matt Mower :: http://matt...
>
>

Ah....

--
To reply, take of all ZIGs !!