1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Add RDoc to build. Add --ri-system to RDoc

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
dave 2004-01-05 21:48:16 +00:00
parent 791f55ef98
commit 1b31d09edd
7 changed files with 107 additions and 39 deletions

View file

@ -1,3 +1,23 @@
Tue Jan 6 06:37:53 2004 Dave Thomas <dave@pragprog.com>
* bin/rdoc: Add --ri-system switch
* lib/.document: Update with list of files that seem to have
documentation
* lib/test/unit.rb: Reorder comment to make it RDoc friendly.
* Makefile.in: add install-nodoc target, and make it
generate RDoc on default install.
* lib/rdoc/ri/ri_options.rb (RI::Options::parse): Add
--doc-dir option to ri.
Tue Jan 6 00:04:40 2004 Dave Thomas <dave@pragprog.com>
* lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::parse_method_or_yield_parameters):
fix parsing if there are braces in a method parameter list
Tue Jan 6 01:01:04 2004 NAKAMURA Usaku <usa@ruby-lang.org> Tue Jan 6 01:01:04 2004 NAKAMURA Usaku <usa@ruby-lang.org>
* win32/dir.h, win32/win32.c: fix patch miss. * win32/dir.h, win32/win32.c: fix patch miss.

View file

@ -139,7 +139,9 @@ ruby.imp: $(LIBRUBY_A)
@@NM@ -Pgp $(LIBRUBY_A) | awk 'BEGIN{print "#!"}; $$2~/^[BD]$$/{print $$1}' | sort -u -o $@ @@NM@ -Pgp $(LIBRUBY_A) | awk 'BEGIN{print "#!"}; $$2~/^[BD]$$/{print $$1}' | sort -u -o $@
# $(MINIRUBY) $< $@ # $(MINIRUBY) $< $@
install: rbconfig.rb install: install-nodoc rdoc
install-nodoc: rbconfig.rb
$(MINIRUBY) $(srcdir)/instruby.rb $(SCRIPT_ARGS) --mantype="$(MANTYPE)" $(MINIRUBY) $(srcdir)/instruby.rb $(SCRIPT_ARGS) --mantype="$(MANTYPE)"
$(MINIRUBY) $(srcdir)/ext/extmk.rb $(SCRIPT_ARGS) install $(MINIRUBY) $(srcdir)/ext/extmk.rb $(SCRIPT_ARGS) install
@ -147,6 +149,10 @@ what-where no-install: rbconfig.rb
$(MINIRUBY) $(srcdir)/instruby.rb -n $(SCRIPT_ARGS) --mantype="$(MANTYPE)" $(MINIRUBY) $(srcdir)/instruby.rb -n $(SCRIPT_ARGS) --mantype="$(MANTYPE)"
$(MINIRUBY) $(srcdir)/ext/extmk.rb -n $(SCRIPT_ARGS) install $(MINIRUBY) $(srcdir)/ext/extmk.rb -n $(SCRIPT_ARGS) install
rdoc:
@echo Generating RDoc documentation
$(MINIRUBY) -I lib bin/rdoc --all --ri-system
clean-ext: clean-ext:
@-$(MINIRUBY) $(srcdir)/ext/extmk.rb $(SCRIPT_ARGS) clean 2> /dev/null || true @-$(MINIRUBY) $(srcdir)/ext/extmk.rb $(SCRIPT_ARGS) clean 2> /dev/null || true
@ -198,7 +204,7 @@ Makefile: $(srcdir)/Makefile.in
.PRECIOUS: @MAKEFILES@ .PRECIOUS: @MAKEFILES@
.PHONY: test .PHONY: test install install-nodoc rdoc
PHONY: PHONY:

2
bin/ri
View file

@ -28,7 +28,7 @@ class RiDisplay
def initialize def initialize
@options = RI::Options.instance @options = RI::Options.instance
@options.parse @options.parse
paths = RI::Paths::PATH paths = @options.paths || RI::Paths::PATH
if paths.empty? if paths.empty?
$stderr.puts "No ri documentation found in:" $stderr.puts "No ri documentation found in:"
[ RI::Paths::SYSDIR, RI::Paths::SITEDIR, RI::Paths::HOMEDIR].each do |d| [ RI::Paths::SYSDIR, RI::Paths::SITEDIR, RI::Paths::HOMEDIR].each do |d|

View file

@ -1,4 +1,29 @@
# We only run RDoc on the top-level files in here: we skip # We only run RDoc on the top-level files in here: we skip
# all the helper stuff in sub-directories # all the helper stuff in sub-directories
*.rb # Eventually, we hope to see...
# *.rb
# But for now
benchmark.rb
cgi.rb
complex.rb
date.rb
fileutils.rb
find.rb
generator.rb
logger.rb
matrix.rb
observer.rb
optionparser.rb
pathname.rb
set.rb
shellwords.rb
singleton.rb
tempfile.rb
test/unit.rb
thread.rb
thwait.rb
time.rb
yaml.rb

View file

@ -1997,8 +1997,11 @@ module RDoc
case tk case tk
when TkSEMICOLON when TkSEMICOLON
break break
when TkLBRACE
nest += 1
when TkRBRACE when TkRBRACE
break nest -= 1
break if nest <= 0
when TkLPAREN, TkfLPAREN when TkLPAREN, TkfLPAREN
nest += 1 nest += 1
when end_token when end_token

View file

@ -25,6 +25,9 @@ module RI
# the formatting we apply to the output # the formatting we apply to the output
attr_reader :formatter attr_reader :formatter
# the directory we search for original documentation
attr_reader :doc_dir
module OptionList module OptionList
OPTION_LIST = [ OPTION_LIST = [
@ -35,11 +38,15 @@ module RI
"Display the names of classes and modules we\n" + "Display the names of classes and modules we\n" +
"know about"], "know about"],
[ "--doc-dir", "-d", "<dirname>",
"A directory to search for documentation. If not\n"+
"specified, we search the standard rdoc/ri directories."],
[ "--format", "-f", "<name>", [ "--format", "-f", "<name>",
"Format to use when displaying output:\n" + "Format to use when displaying output:\n" +
" " + RI::TextFormatter.list + "\n" + " " + RI::TextFormatter.list + "\n" +
"Use 'bs' (backspace) with most pager programs.\n" + "Use 'bs' (backspace) with most pager programs.\n" +
"To use ANSI, either also use the -T option, or\n\n" + "To use ANSI, either also use the -T option, or\n" +
"tell your pager to allow control characters\n" + "tell your pager to allow control characters\n" +
"(for example using the -R option to less)"], "(for example using the -R option to less)"],
@ -123,26 +130,27 @@ module RI
puts "For a list of classes I know about, type 'ri -c'" puts "For a list of classes I know about, type 'ri -c'"
else else
puts "Options:\n\n" puts "Options:\n\n"
OPTION_LIST.each do |long, short, arg, desc| OPTION_LIST.each do|long, short, arg, desc|
opt = sprintf("%20s", "#{long}, #{short}") opt = sprintf("%15s", "#{long}, #{short}")
oparg = sprintf("%-7s", arg) if arg
print "#{opt} #{oparg}" opt << " " << arg
end
print opt
desc = desc.split("\n") desc = desc.split("\n")
if arg.nil? || arg.length < 7 if opt.size < 17
print " "*(18-opt.size)
puts desc.shift puts desc.shift
else else
puts puts
end end
desc.each do |line| desc.each do |line|
puts(" "*28 + line) puts(" "*18 + line)
end end
puts puts
end end
exit 0 exit 0
end end
end end
end end
# Parse command line options. # Parse command line options.
@ -164,6 +172,7 @@ module RI
when "--help" then OptionList.usage when "--help" then OptionList.usage
when "--no-pager" then @use_stdout = true when "--no-pager" then @use_stdout = true
when "--classes" then @list_classes = true when "--classes" then @list_classes = true
when "--doc-dir" then @doc_dir = arg
when "--format" when "--format"
@formatter = RI::TextFormatter.for(arg) @formatter = RI::TextFormatter.for(arg)
@ -187,6 +196,12 @@ module RI
end end
end end
# Return the doc_dir as an array, or nil if no overriding doc dir was given
def paths
@doc_dir ? [ @doc_dir ] : nil
end end
end
end end

View file

@ -1,3 +1,6 @@
require 'test/unit/testcase'
require 'test/unit/autorunner'
# = Test::Unit - Ruby Unit Testing Framework # = Test::Unit - Ruby Unit Testing Framework
# #
# == Introduction # == Introduction
@ -255,12 +258,8 @@
# missing points, etc., in this document (or any other). # missing points, etc., in this document (or any other).
require 'test/unit/testcase'
require 'test/unit/autorunner'
module Test module Test
# For documentation, see module Test
module Unit module Unit
def self.run=(flag) def self.run=(flag)
@run = flag @run = flag