installation of files

Discussion in 'Ruby' started by Michael Gebhart, Jul 12, 2005.

  1. 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, Jul 12, 2005
    #1
    1. Advertising

  2. Michael Gebhart wrote:
    > 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?
    Joel VanderWerf, Jul 12, 2005
    #2
    1. Advertising

  3. Michael Gebhart

    Ara.T.Howard Guest

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


    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
    ===============================================================================
    Ara.T.Howard, Jul 12, 2005
    #3
  4. > 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
    Erik Veenstra, Jul 12, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Microsoft
    Replies:
    0
    Views:
    2,932
    Microsoft
    Sep 4, 2003
  2. Oleg Ogurok
    Replies:
    4
    Views:
    344
    Sijin Joseph
    Sep 9, 2004
  3. Luis Esteban Valencia

    Change configuration files after installation.

    Luis Esteban Valencia, Jul 12, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    595
    Luis Esteban Valencia
    Jul 12, 2005
  4. 6e
    Replies:
    0
    Views:
    328
  5. David G. Hong
    Replies:
    2
    Views:
    77
    David G. Hong
    Apr 21, 2008
Loading...

Share This Page