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.

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?

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

syntax:

ln -s

HTH,

Zach

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 malteDELETETHIS@gmx-topmail.de, on Sat, Jan 17, 2004 at 05:00:05AM +0900:

···

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.

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

···

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

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?


_ _

__ __ | | ___ _ __ ___ __ _ _ __
'_ \ / | __/ __| '_ _ \ / ` | ’ \
) | (| | |
__ \ | | | | | (| | | | |
.__/ _,
|_|/| || ||_,|| |_|
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

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 documentation 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

···

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

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

install-doc.rb

Quick ‘n’ dirty script to generate and install the documentation. 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

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

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 documentation 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.”

I wrote:

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.

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.

Quoteing batsman.geo@yahoo.com, on Sat, Jan 17, 2004 at 05:31:42AM +0900:

···

On Sat, Jan 17, 2004 at 05:00:05AM +0900, Malte Milatz wrote:
> 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?

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

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

Cheers,
Sam

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.

···

On Sat, Jan 17, 2004 at 05:48:11AM +0900, Sam Roberts wrote:

Quoteing batsman.geo@yahoo.com, on Sat, Jan 17, 2004 at 05:31:42AM +0900:

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

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?

setup.rb

setup.rb installs documentation? It’s documentation doesn’t say anything
about that!


_ _

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

  • LG loves czech girls.
    LG: do they have additional interesting “features” other girls don’t have? :wink:
    #Debian

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

batsman@tux-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 documentation' ] ],
    
    [ ‘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
···

On Tue, Jan 20, 2004 at 09:05:00PM +0900, Malte Milatz wrote:

I wrote:

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.

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.

  • 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

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

···

On Tue, Jan 20, 2004 at 11:01:25PM +0900, Mauricio Fern?ndez wrote:

On Tue, Jan 20, 2004 at 09:05:00PM +0900, Malte Milatz wrote:

I wrote:

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.

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.

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

 [ 'data-dir',  [ '$prefix/share',
                  'path',
                  'the directory for shared data' ] ],
  • [ ‘doc-dir’, [ ‘$prefix/share/doc’,
  •                 'path',
    
  •                 'the directory for documentation' ] ],
    


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

C:/Ruby

Gavin

···

On Wednesday, January 21, 2004, 5:15:43 AM, Zachary wrote:

 [ 'data-dir',  [ '$prefix/share',
                  'path',
                  'the directory for shared data' ] ],
  • [ ‘doc-dir’, [ ‘$prefix/share/doc’,
  •                 'path',
    
  •                 'the directory for documentation' ] ],
    

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

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.

···

On Wed, Jan 21, 2004 at 03:15:43AM +0900, Zachary P. Landau wrote:

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

 [ 'data-dir',  [ '$prefix/share',
                  'path',
                  'the directory for shared data' ] ],
  • [ ‘doc-dir’, [ ‘$prefix/share/doc’,
  •                 'path',
    
  •                 'the directory for documentation' ] ],
    

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


_ _

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

Never trust an operating system you don’t have sources for. :wink:
– Unknown source

Hi,

···

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

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

Don’t worry, you’re correct, … in both meanings.


Nobu Nakada