[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

installation of files

Michael Gebhart

7/11/2005 11:44:00 PM

Hi,

I have written a program, which has several files. Now my question is,
where to install all these files.

Normally all files are installed in e.g.
/usr/lib/ruby/1.8/site_ruby/programname/. But when the files are installed
in site_ruby, they are accessable by every other program. This is not
needed, because these files are no libraries. My program simply is split
in several files. Shouldn´t program files be installed in /usr/bin? Or
maybe installing the files to: /usr/local/programname?

Programs written in C are linked to one binary and installed to /usr/bin.
This isn´t possible with ruby. I´ve heard, that there are tools for
making one ruby file, out of several ruby files. (rake)

But this isn´t what I am looking for.

What is the official target for such files, which are not libraries and
shouldn´t be accessed by any other program?

Greetings

Mike
4 Answers

Joel VanderWerf

7/12/2005 12:16:00 AM

0

Michael Gebhart wrote:
> Hi,
>
> I have written a program, which has several files. Now my question is,
> where to install all these files.
>
> Normally all files are installed in e.g.
> /usr/lib/ruby/1.8/site_ruby/programname/. But when the files are installed
> in site_ruby, they are accessable by every other program. This is not
> needed, because these files are no libraries. My program simply is split
> in several files. Shouldn´t program files be installed in /usr/bin? Or
> maybe installing the files to: /usr/local/programname?
>
> Programs written in C are linked to one binary and installed to /usr/bin.
> This isn´t possible with ruby. I´ve heard, that there are tools for
> making one ruby file, out of several ruby files. (rake)

Have you considered Erik Veenstra's tar2rubyscript and rubyscript2exe,
at http://www.erikveen.dds.nl... ?

> But this isn´t what I am looking for.
>
> What is the official target for such files, which are not libraries and
> shouldn´t be accessed by any other program?

Why not just begin your main .rb file with

$LOAD_PATH.unshift Dir.pwd

and then you can let users put the dir wherever they want?


mathew

7/12/2005 2:20:00 AM

0

Joel VanderWerf wrote:
> Why not just begin your main .rb file with
>
> $LOAD_PATH.unshift Dir.pwd
>
> and then you can let users put the dir wherever they want?

Because that way you need to change to the directory where the files
are, before running the program.

What would be really useful would be a way to find the path to the
currently executing Ruby file. Then you could stick that on the
LOAD_PATH to let the program find all the other files.

(I had a look, but couldn't find such a thing.)


mathew

Ara.T.Howard

7/12/2005 2:33:00 AM

0

Erik Veenstra

7/12/2005 6:17:00 AM

0

> Normally all files are installed in e.g.
> /usr/lib/ruby/1.8/site_ruby/programname/.

Not all files are installed in site_ruby. Only common library
files should be placed here. Files which belong to one
application should be placed in one directory tree.

> Shouldn´t program files be installed in /usr/bin? Or maybe
> installing the files to: /usr/local/programname?

That's good if you want your application to only run on Linux.
It's not good if you want your application to be more platform
agnostic.

If you want stick to FHS, you could append a private library
path to LOAD_PATH:

dirname, basename = File::split(File::expand_path(__FILE__))
$: << File.expand_path("../lib/#{basename}/libs", dirname)

> But this isn´t what I am looking for.

What is it what you're looking for?... ;)

> What is the official target for such files, which are not
> libraries and shouldn´t be accessed by any other program?

I've written down my ideas about building and distributing Ruby
applications [1], as well as implemented some of the ideas [2,
3] By the way, it's not official...

gegroet,
Erik V. - http://www.erikve...

[1] http://www.erikve...distributingrubyapplications/index.html
[2] http://www.erikve...tar2rubyscript/index.html
[3] http://www.erikve...rubyscript2exe/index.html