[Rubydoc-devel-cvs] CVS: rubydoc/src rubydoc,NONE,1.1
Status: Pre-Alpha
Brought to you by:
thetitan
|
From: Sean C. <the...@us...> - 2001-08-29 19:03:36
|
Update of /cvsroot/rubydoc/rubydoc/src
In directory usw-pr-cvs1:/tmp/cvs-serv12491/src
Added Files:
rubydoc
Log Message:
Initial checkin for the rubydoc project.
Functioning rubydoc included
--- NEW FILE: rubydoc ---
#!/usr/bin/env ruby
# All of the documentation and software included in rubydoc releases is
# copyrighted by Sean Chittenden <se...@ch...>
#
# Copyright 2001
# Sean Chittenden <se...@ch...>. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. All advertising materials mentioning features or use of this software
# must display the following acknowledgment:
#
# This product includes software developed by Sean Chittenden
# <se...@ch...> and rubydoc's contributors.
#
# 4. Neither the name of the software nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
#
# If you have any questions regarding the redistribution of this software,
# please contact the author at <se...@ch...>.
require 'getoptlong'
options = {
'path' => $:.dup
}
opts = GetoptLong.new([ "--include", "-I", GetoptLong::REQUIRED_ARGUMENT ],
[ "--rd2-path", "-r", GetoptLong::REQUIRED_ARGUMENT ])
begin
opts.quiet = true
opts.each do |opt, arg|
case opt
when '--include'
options['path'].unshift(arg)
when '--rd2-path'
options['rd2path'] = arg
end
end
rescue GetoptLong::InvalidOption
puts $0 + ": " + $!
exit
end
def find_module (paths, lib)
lib_parts = lib.gsub(/\:\:/, File::SEPARATOR)
paths.each do |p|
['', '.rb'].each do |s|
begin
file_path = File.join(p, lib_parts + (s.length > 0 ? '.' + s : ''))
if File.stat(file_path).readable? and File.stat(file_path).file?
return(file_path)
end
rescue
end
end # suffixes.each
end # paths.each
return
end # find_module
def print_module ( full_mod_path )
return unless full_mod_path
puts open ("|rd2 -rrd/rd2man-lib.rb #{full_mod_path} | nroff -man").readlines.to_s
end # def print_module
ARGV.each do |a|
full_mod_path = find_module(options['path'], a)
print_module(full_mod_path)
end # args.each
|