Professional Web Applications Themes

Installing a program Unix-like - Ruby

Users of Linux, FreeBSD etc. are used to downloading an archive, unpacking it, and typing some commands as the README file tolds. After that, they want to type the name of the program to launch it, and they want to type "man program" or "info program" to get help about it. I don't want to be forced to imagine that every Ruby programmer writes his own script, in which he moves the appropriate files into /usr/local/bin, -share, -lib, -man etc. How do you handle this issue? Thanks in advance! (I hope my attempts writing in English don't look too terrible.) ...

  1. #1

    Default Installing a program Unix-like

    Users of Linux, FreeBSD etc. are used to downloading an archive,
    unpacking it, and typing some commands as the README file tolds. After
    that, they want to type the name of the program to launch it, and they
    want to type "man program" or "info program" to get help about it.

    I don't want to be forced to imagine that every Ruby programmer writes
    his own script, in which he moves the appropriate files into
    /usr/local/bin, -share, -lib, -man etc.

    How do you handle this issue?

    Thanks in advance! (I hope my attempts writing in English don't look too
    terrible.)

    --
    Malte Milatz, konvinkita esperantisto kaj linuks-uzanto.
    Malte Guest

  2. #2

    Default Re: Installing a program Unix-like

     
     

    I've never done the man pages, but I often create symbolic links and place
    those in the bin directories.

    syntax:

    ln -s <link file> <target file>

    HTH,

    Zach


    Zach Guest

  3. #3

    Default Re: Installing a program Unix-like

    I can't find it now (in under a minute), but somebody posted an
    equivalent to the standard install.rb (install-doc.rb?) that would run
    rdoc on the .rb files, and install the docs in a "standard" location.
    If you search the RAA or ruby-talk archives, hopefully you can find it.
    I thought i bookmarked it, but its lost at the moment.

    Cheers,
    Sam

    Quoteing de, on Sat, Jan 17, 2004 at 05:00:05AM +0900: 

    Sam Guest

  4. #4

    Default Re: Installing a program Unix-like

    On Sat, Jan 17, 2004 at 05:00:05AM +0900, Malte Milatz wrote: 

    http://i.loveruby.net/en/setup.html

    --
    _ _
    | |__ __ _| |_ ___ _ __ ___ __ _ _ __
    | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \
    | |_) | (_| | |_\__ \ | | | | | (_| | | | |
    |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_|
    Running Debian GNU/Linux Sid (unstable)
    batsman dot geo at yahoo dot com

    Remember: While root can do most everything, there are certain
    privileges that only a partner can grant.
    -- Telsa Gwynne

    Mauricio Guest

  5. #5

    Default Re: Installing a program Unix-like

    Quoteing com, on Sat, Jan 17, 2004 at 05:31:42AM +0900: 
    >
    > http://i.loveruby.net/en/setup.html[/ref]

    setup.rb installs doentation? It's doentation doesn't say anything
    about that!

    Cheers,
    Sam


    Sam Guest

  6. #6

    Default Re: Installing a program Unix-like

    On Sat, Jan 17, 2004 at 05:48:11AM +0900, Sam Roberts wrote: 
    > >
    > > http://i.loveruby.net/en/setup.html[/ref]
    >
    > setup.rb installs doentation? It's doentation doesn't say anything
    > about that![/ref]

    AFAIK it doesn't cause there's no standard for where to put Ruby docs yet
    (see the discussion in ruby-core from a couple weeks ago). Extending it
    to handle docs should be trivial, though.

    --
    _ _
    | |__ __ _| |_ ___ _ __ ___ __ _ _ __
    | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \
    | |_) | (_| | |_\__ \ | | | | | (_| | | | |
    |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_|
    Running Debian GNU/Linux Sid (unstable)
    batsman dot geo at yahoo dot com

    * LG loves czech girls.
    <vincent> LG: do they have additional interesting "features" other girls don't have? ;)
    -- #Debian


    Mauricio Guest

  7. #7

    Default Re: Installing a program Unix-like

    On Saturday, January 17, 2004, 7:31:14 AM, Sam wrote:
     
     

    Here is my one, reproduced in full. It's written for a specific
    project (extensions.rubyforge.org), but could perhaps be generalised.
    It actually uses a shell script to run RDoc, but that could be
    implemented here instead.

    The target directory for doentation in the code below is
    /usr/doc/ruby, or /usr/local/doc/ruby, or C:/Ruby/doc/ruby, etc; it's
    derived from "prefix".

    Cheers,
    Gavin


    #
    # install-doc.rb
    #
    # Quick 'n' dirty script to generate and install the doentation. It uses
    # (prefix), which would be /usr or /usr/local on a Unix system, and something
    # like C:/ruby on a Windows system, and adds "doc/ruby" to make a guess at a
    # doentation directory.
    #
    # It then creates or reuses the directory "extensions-m.n", where m.n is the
    # version number as contained in VERSION.
    #
    # In order to generate the doentation in the first place, it runs
    # "sh etc/gen-rdoc.sh". This is Unix-specific; suggestions to overcome
    # this are welcome. Personally, I use Cygwin on Windows. This command
    # generates doentation in the "doc" directory, from where it is copied.
    #
    # The above assumptions mean that this program must be run from the root
    # directory of the "exstensions" project.
    #

    require "fileutils"
    require "rbconfig"

    $LOGGING = true

    module Kernel
    def log(msg = "")
    puts "LOG: #{msg}" if $LOGGING
    end
    end


    # 1. Determine the target directory.

    include Config
    prefix = CONFIG['prefix']
    rubydocdir = File.join(prefix, "doc", "ruby")
    log "Default ruby doc dir is #{rubydocdir}"

    target_base = ARGV.shift
    if target_base.nil?
    log "No target directory given; using default"
    target_base = rubydocdir
    else
    log "Using target directory given on command line: #{target_base}"
    end
    unless File.directory?(target_base)
    log "#{target_base} does not exist. Can't continue."
    exit!
    end

    version = File.read("VERSION").strip
    log "Version: #{version}"
    target_dir = File.join(target_base, "extensions-#{version}")
    log "Target directory: #{target_dir}"

    unless File.directory?(target_dir)
    FileUtils.mkdir(target_dir)
    log "Created target directory: #{target_dir}"
    end

    target_rdoc_dir = File.join(target_dir, "rdoc")
    unless File.directory?(target_rdoc_dir)
    FileUtils.mkdir(target_rdoc_dir)
    log "Created target rdoc directory: #{target_rdoc_dir}"
    end


    # 2. Generate the doentation.

    command = %w{sh -c etc/gen-rdoc.sh}
    log "Command: #{command.join(' ')}"
    unless system(*command)
    log "Command failed; exiting."
    exit!
    end


    # 3. Clean out the target directory.

    ### Not really needed?
    ###
    ### Dir.chdir(target_rdoc_dir) do
    ### FileUtils.rm_rf(".")
    ### end


    # 4. Copy the doentation to the target directory.

    FileUtils.cp_r("rdoc", target_rdoc_dir, :verbose => true)
    FileUtils.cp("README.1st", target_dir, :verbose => true)
    FileUtils.cp("HISTORY", target_dir, :verbose => true)
    FileUtils.cp("ChangeLog", target_dir, :verbose => true)


    # 5. Finished.

    log "Done."



    Gavin Guest

  8. #8

    Default Re: Installing a program Unix-like

    I wrote: 

    It's time that I thank everybody who replied to my question; I think
    setup.rb is the thing I need. Maybe together with some other things that
    are based on it, or which install the doc's.

    --
    Malte Milatz, konvinkita esperantisto kaj linuks-uzanto.
    Malte Guest

  9. #9

    Default Re: Installing a program Unix-like

    On Tue, Jan 20, 2004 at 09:05:00PM +0900, Malte Milatz wrote: 
    >
    > It's time that I thank everybody who replied to my question; I think
    > setup.rb is the thing I need. Maybe together with some other things that
    > are based on it, or which install the doc's.[/ref]

    Quick hack, just to show you how easy it is (note that this is for an
    older version; you had better modify the sources of setup.rb instead of
    the generated file itself).

    batsmantux-chan:~/src/rdocsite$ diff -u install.rb.old install.rb
    --- install.rb.old 2004-01-20 14:44:47.000000000 +0100
    +++ install.rb 2004-01-20 14:50:49.000000000 +0100
    -139,6 +139,9
    [ 'data-dir', [ '$prefix/share',
    'path',
    'the directory for shared data' ] ],
    + [ 'doc-dir', [ '$prefix/share/doc',
    + 'path',
    + 'the directory for doentation' ] ],
    [ 'ruby-path', [ rubypath,
    'path',
    'path to set to #! line' ] ],
    -472,7 +475,7
    end


    - FILETYPES = %w( bin lib ext data )
    + FILETYPES = %w( bin lib ext data doc )

    include FileOperations

    -610,6 +613,9
    def config_dir_data( rel )
    end

    + def config_dir_doc( rel )
    + end
    +
    #
    # TASK setup
    #
    -656,6 +662,9
    def setup_dir_data( relpath )
    end

    + def setup_dir_doc( relpath )
    + end
    +
    #
    # TASK install
    #
    -684,6 +693,11
    install_files target_filenames(), config('data-dir') + '/' + rel, 0644
    end

    + def install_dir_doc( rel )
    + install_files target_filenames(), config('doc-dir') + '/' + rel, 0644
    + end
    +
    +
    def install_files( list, dest, mode )
    mkdir_p dest, options['install-prefix']
    list.each do |fname|
    -776,6 +790,9
    def clean_dir_data( rel )
    end

    + def clean_dir_doc( rel )
    + end
    +
    #
    # TASK distclean
    #
    -799,6 +816,9
    def distclean_dir_data( rel )
    end

    + def distclean_dir_doc( rel )
    + end
    +
    #
    # lib
    #

    --
    _ _
    | |__ __ _| |_ ___ _ __ ___ __ _ _ __
    | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \
    | |_) | (_| | |_\__ \ | | | | | (_| | | | |
    |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_|
    Running Debian GNU/Linux Sid (unstable)
    batsman dot geo at yahoo dot com

    Dijkstra probably hates me.
    -- Linus Torvalds, in kernel/sched.c


    Mauricio Guest

  10. #10

    Default Re: Installing a program Unix-like

    --ikeVEW9yuYc//A+q
    Content-Type: text/plain; cht=us-ascii
    Content-Disposition: inline
    Content-Transfer-Encoding: quoted-printable

    On Tue, Jan 20, 2004 at 11:01:25PM +0900, Mauricio Fern?ndez wrote: 
    > >=20
    > > It's time that I thank everybody who replied to my question; I think
    > > setup.rb is the thing I need. Maybe together with some other things that
    > > are based on it, or which install the doc's.[/ref]
    >=20
    > Quick hack, just to show you how easy it is (note that this is for an
    > older version; you had better modify the sources of setup.rb instead of
    > the generated file itself).
    >=20
    > [ 'data-dir', [ '$prefix/share',
    > 'path',
    > 'the directory for shared data' ] ],
    > + [ 'doc-dir', [ '$prefix/share/doc',
    > + 'path',
    > + 'the directory for doentation' ] ],[/ref]

    Please excuse my Windows ignorance, but what is a common default for
    $prefix under Win32?=20

    --
    Zachary P. Landau <net>
    GPG: gpg --recv-key 0x24E5AD99 | http://kapheine.hypa.net/kapheine.asc

    --ikeVEW9yuYc//A+q
    Content-Type: application/pgp-signature
    Content-Disposition: inline

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.2.4 (GNU/Linux)

    iD8DBQFADW/1CwWyMCTlrZkRApabAJ9HI7uMAnw5DU3QoPGW55itmVyDxwCeK qd3
    l/eJErwfycBKPs7XM7T/wHg=
    =1ImK
    -----END PGP SIGNATURE-----

    --ikeVEW9yuYc//A+q--


    Zachary Guest

  11. #11

    Default Re: Installing a program Unix-like

    On Wednesday, January 21, 2004, 5:15:43 AM, Zachary wrote:
     [/ref]
     

    C:/Ruby

    Gavin



    Gavin Guest

  12. #12

    Default Re: Installing a program Unix-like

    On Wed, Jan 21, 2004 at 03:15:43AM +0900, Zachary P. Landau wrote: 
    >
    > Please excuse my Windows ignorance, but what is a common default for
    > $prefix under Win32?[/ref]

    IIRC $prefix would be the directory Ruby was installed into,
    e.g. c:\ruby, i.e. you would get
    c:\
    ruby
    bin/
    lib/
    ....
    share/

    Don't trust me on this however --- I'm happy I got rid of Win32 and I'm
    trying my best to forget it.

    --
    _ _
    | |__ __ _| |_ ___ _ __ ___ __ _ _ __
    | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \
    | |_) | (_| | |_\__ \ | | | | | (_| | | | |
    |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_|
    Running Debian GNU/Linux Sid (unstable)
    batsman dot geo at yahoo dot com

    Never trust an operating system you don't have sources for. ;-)
    -- Unknown source

    Mauricio Guest

  13. #13

    Default Re: Installing a program Unix-like

    Hi,

    At Wed, 21 Jan 2004 07:21:03 +0900,
    Mauricio Fernández wrote: 

    Don't worry, you're correct, ... in both meanings.

    --
    Nobu Nakada



    nobu.nokada@softhome.net Guest

Similar Threads

  1. Help: Installing GD.pm v1.20 on Tru64 Unix
    By jacks0n in forum PERL Modules
    Replies: 0
    Last Post: October 14th, 01:21 AM
  2. Installing a six-floppy-disk program on a G4
    By Pat in forum Mac Applications & Software
    Replies: 16
    Last Post: August 23rd, 02:29 AM
  3. Replies: 3
    Last Post: August 20th, 06:50 PM
  4. Recommendation: translating a Unix YACC-based program
    By Bernie Cosell in forum PERL Modules
    Replies: 1
    Last Post: July 23rd, 01:07 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139