diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rdoc/options.rb | 12 | ||||
-rw-r--r-- | lib/rdoc/rdoc.rb | 16 |
2 files changed, 27 insertions, 1 deletions
diff --git a/lib/rdoc/options.rb b/lib/rdoc/options.rb index 55994c9dcc..eed0f6b39b 100644 --- a/lib/rdoc/options.rb +++ b/lib/rdoc/options.rb @@ -339,6 +339,10 @@ class RDoc::Options attr_reader :visibility + ## + # Indicates if files of test suites should be skipped + attr_accessor :skip_tests + def initialize loaded_options = nil # :nodoc: init_ivars override loaded_options if loaded_options @@ -386,6 +390,7 @@ class RDoc::Options @write_options = false @encoding = Encoding::UTF_8 @charset = @encoding.name + @skip_tests = true end def init_with map # :nodoc: @@ -778,6 +783,13 @@ Usage: #{opt.program_name} [options] [names...] opt.separator nil + opt.on("--no-skipping-tests", nil, + "Don't skip generating documentation for test and spec files") do |value| + @skip_tests = false + end + + opt.separator nil + opt.on("--extension=NEW=OLD", "-E", "Treat files ending with .new as if they", "ended with .old. Using '-E cgi=rb' will", diff --git a/lib/rdoc/rdoc.rb b/lib/rdoc/rdoc.rb index 400f9b5bc3..2d8a9dea8c 100644 --- a/lib/rdoc/rdoc.rb +++ b/lib/rdoc/rdoc.rb @@ -36,6 +36,17 @@ class RDoc::RDoc GENERATORS = {} ## + # List of directory names always skipped + + UNCONDITIONALLY_SKIPPED_DIRECTORIES = %w[CVS .svn .git].freeze + + ## + # List of directory names skipped if test suites should be skipped + + TEST_SUITE_DIRECTORY_NAMES = %w[spec test].freeze + + + ## # Generator instance used for creating output attr_accessor :generator @@ -280,7 +291,10 @@ option) file_list[rel_file_name] = mtime end when "directory" then - next if rel_file_name == "CVS" || rel_file_name == ".svn" + next if UNCONDITIONALLY_SKIPPED_DIRECTORIES.include?(rel_file_name) + + basename = File.basename(rel_file_name) + next if options.skip_tests && TEST_SUITE_DIRECTORY_NAMES.include?(basename) created_rid = File.join rel_file_name, "created.rid" next if File.file? created_rid |