Installing a program Unix-like

M

Malte Milatz

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

Sam Roberts

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 (e-mail address removed), on Sat, Jan 17, 2004 at 05:00:05AM +0900:
 
M

Mauricio Fernández

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

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

Mauricio Fernández

Quoteing (e-mail address removed), on Sat, Jan 17, 2004 at 05:31:42AM +0900:

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

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
 
G

Gavin Sinclair

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

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


#
# 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."
 
M

Malte Milatz

I said:
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.
 
M

Mauricio Fernández

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

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
+
#
# 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
 
Z

Zachary P. Landau

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

=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.
=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 documentation' ] ],

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

--
Zachary P. Landau <[email protected]>
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/1CwWyMCTlrZkRApabAJ9HI7uMAnw5DU3QoPGW55itmVyDxwCeKqd3
l/eJErwfycBKPs7XM7T/wHg=
=1ImK
-----END PGP SIGNATURE-----

--ikeVEW9yuYc//A+q--
 
M

Mauricio Fernández

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?

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
 
N

nobu.nokada

Hi,

At Wed, 21 Jan 2004 07:21:03 +0900,
Mauricio said:
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.
 

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
474,141
Messages
2,570,817
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top