Installation of files

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

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/ruby.html ?

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?

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?... :wink:

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.erikveen.dds.nl/

[1] Distributing Ruby Applications - Theory and Practice of Building, Packing and Distributing Ruby Applications
[2] Tar2RubyScript - A Tool for Distributing Ruby Applications
[3] http://www.erikveen.dds.nl/rubyscript2exe/index.html

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

dirname, basename = File::split(File::expand_path(__FILE__))
$:.unshift dirname

or maybe better

$:.unshift(File::join(dirname, "share"))

hth.

-a

···

On Tue, 12 Jul 2005, mathew wrote:

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.)

--

email :: ara [dot] t [dot] howard [at] noaa [dot] gov
phone :: 303.497.6469
My religion is very simple. My religion is kindness.
--Tenzin Gyatso

===============================================================================