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

Allow multiple --exclude options to RDoc

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6084 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
dave 2004-04-04 05:03:00 +00:00
parent 45edb83b9a
commit 440c26186c
3 changed files with 14 additions and 3 deletions

View file

@ -1,3 +1,8 @@
Sun Apr 4 14:01:20 2004 Dave Thomas <dave@pragprog.com>
* lib/rdoc/options.rb (Options::parse): Allow multiple -x options to RDoc.
Fix bug where files weren't being excluded properly
Sat Apr 3 09:36:38 2004 why the lucky stiff <why@ruby-lang.org> Sat Apr 3 09:36:38 2004 why the lucky stiff <why@ruby-lang.org>
* ext/syck/syck.h: version 0.43. * ext/syck/syck.h: version 0.43.

View file

@ -346,7 +346,7 @@ class Options
@show_all = false @show_all = false
@main_page = nil @main_page = nil
@marge = false @marge = false
@exclude = nil @exclude = []
@quiet = false @quiet = false
@generator_name = 'html' @generator_name = 'html'
@generator = generators[@generator_name] @generator = generators[@generator_name]
@ -386,7 +386,7 @@ class Options
when "--all" then @show_all = true when "--all" then @show_all = true
when "--charset" then @charset = arg when "--charset" then @charset = arg
when "--debug" then $DEBUG = true when "--debug" then $DEBUG = true
when "--exclude" then @exclude = Regexp.new(arg) when "--exclude" then @exclude << Regexp.new(arg)
when "--inline-source" then @inline_source = true when "--inline-source" then @inline_source = true
when "--line-numbers" then @include_line_numbers = true when "--line-numbers" then @include_line_numbers = true
when "--main" then @main_page = arg when "--main" then @main_page = arg
@ -473,6 +473,12 @@ class Options
@rdoc_include << "." if @rdoc_include.empty? @rdoc_include << "." if @rdoc_include.empty?
if @exclude.empty?
@exclude = nil
else
@exclude = Regexp.new(@exclude.join("|"))
end
check_files check_files
# If no template was specified, use the default # If no template was specified, use the default

View file

@ -163,12 +163,12 @@ module RDoc
file_list = [] file_list = []
relative_files.each do |rel_file_name| relative_files.each do |rel_file_name|
next if options.exclude && options.exclude =~ rel_file_name
case type = File.stat(rel_file_name).ftype case type = File.stat(rel_file_name).ftype
when "file" when "file"
file_list << rel_file_name if force_doc || ParserFactory.can_parse(rel_file_name) file_list << rel_file_name if force_doc || ParserFactory.can_parse(rel_file_name)
when "directory" when "directory"
next if rel_file_name == "CVS" || rel_file_name == ".svn" next if rel_file_name == "CVS" || rel_file_name == ".svn"
next if options.exclude && options.exclude =~ rel_file_name
dot_doc = File.join(rel_file_name, DOT_DOC_FILENAME) dot_doc = File.join(rel_file_name, DOT_DOC_FILENAME)
if File.file?(dot_doc) if File.file?(dot_doc)
file_list.concat(parse_dot_doc_file(rel_file_name, dot_doc, options)) file_list.concat(parse_dot_doc_file(rel_file_name, dot_doc, options))