summaryrefslogtreecommitdiff
path: root/lib/rdoc/rdoc.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rdoc/rdoc.rb')
-rw-r--r--lib/rdoc/rdoc.rb26
1 files changed, 19 insertions, 7 deletions
diff --git a/lib/rdoc/rdoc.rb b/lib/rdoc/rdoc.rb
index 5255e043fd..2da6d9b575 100644
--- a/lib/rdoc/rdoc.rb
+++ b/lib/rdoc/rdoc.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rdoc'
+require_relative '../rdoc'
require 'find'
require 'fileutils'
@@ -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
@@ -108,7 +119,7 @@ class RDoc::RDoc
# +files+.
def gather_files files
- files = ["."] if files.empty?
+ files = [@options.root.to_s] if files.empty?
file_list = normalized_file_list files, true, @options.exclude
@@ -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
@@ -415,9 +429,7 @@ The internal error was:
files.reject do |file, *|
file =~ /\.(?:class|eps|erb|scpt\.txt|svg|ttf|yml)$/i or
(file =~ /tags$/i and
- File.open(file, 'rb') { |io|
- io.read(100) =~ /\A(\f\n[^,]+,\d+$|!_TAG_)/
- })
+ /\A(\f\n[^,]+,\d+$|!_TAG_)/.match?(File.binread(file, 100)))
end
end
@@ -440,11 +452,11 @@ The internal error was:
if RDoc::Options === options then
@options = options
- @options.finish
else
@options = RDoc::Options.load_options
@options.parse options
end
+ @options.finish
if @options.pipe then
handle_pipe