summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordave <dave@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-02-24 04:24:02 +0000
committerdave <dave@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-02-24 04:24:02 +0000
commit571a907ffa76df8d6b55e0857f4bf66bb7882a2a (patch)
treeb3bd99e46e53ce36c202d110155880e53ada0a16
parentd776187d4fec0b269dd99afd4aa1593facb61ff7 (diff)
Improve heuristic for which files to include. See ChangeLog
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@5821 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--lib/rdoc/rdoc.rb16
2 files changed, 18 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index a9a3c10a83..db6e45c12d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Tue Feb 24 13:22:21 2004 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/rdoc.rb (RDoc::RDoc::normalized_file_list): Attempt to get better
+ heuristics on which files to include and exclude. Now only include
+ non-standard files if they are explicitly named in ARGV.
+
Tue Feb 24 07:23:30 2004 Dave Thomas <dave@pragprog.com>
* lib/rdoc/generators/html_generator.rb: Deal with :stopdoc: when
diff --git a/lib/rdoc/rdoc.rb b/lib/rdoc/rdoc.rb
index 24e268a8f5..5f477f7fea 100644
--- a/lib/rdoc/rdoc.rb
+++ b/lib/rdoc/rdoc.rb
@@ -150,14 +150,22 @@ module RDoc
# Given a list of files and directories, create a list
# of all the Ruby files they contain.
-
- def normalized_file_list(options, relative_files)
+ #
+ # If +force_dic+ is true, we always add the given files.
+ # If false, only add files that we guarantee we can parse
+ # It is true when looking at files given on the command line,
+ # false when recursing through subdirectories.
+ #
+ # The effect of this is that if you want a file with a non-
+ # standard extension parsed, you must name it explicity.
+
+ def normalized_file_list(options, relative_files, force_doc = false)
file_list = []
relative_files.each do |rel_file_name|
case type = File.stat(rel_file_name).ftype
when "file"
- file_list << rel_file_name
+ file_list << rel_file_name if force_doc || ParserFactory.can_parse(rel_file_name)
when "directory"
next if rel_file_name == "CVS" || rel_file_name == ".svn"
next if options.exclude && options.exclude =~ rel_file_name
@@ -194,7 +202,7 @@ module RDoc
files = options.files
files = ["."] if files.empty?
- file_list = normalized_file_list(options, files)
+ file_list = normalized_file_list(options, files, true)
file_list.each do |fn|
$stderr.printf("\n%35s: ", File.basename(fn)) unless options.quiet