installation of files

M

Michael Gebhart

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
 
J

Joel VanderWerf

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

Have you considered Erik Veenstra's tar2rubyscript and rubyscript2exe,
at http://www.erikveen.dds.nl/ruby.html ?
But this isn=B4t what I am looking for.=20
=20
What is the official target for such files, which are not libraries and
shouldn=B4t be accessed by any other program?=20

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?
 
A

Ara.T.Howard

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

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

or maybe better

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

hth.

-a
--
===============================================================================
| 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
===============================================================================
 
E

Erik Veenstra

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

[1] http://www.erikveen.dds.nl/distributingrubyapplications/index.html
[2] http://www.erikveen.dds.nl/tar2rubyscript/index.html
[3] http://www.erikveen.dds.nl/rubyscript2exe/index.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top