summaryrefslogtreecommitdiff
path: root/tool/rdoc-srcdir
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2024-01-06 20:04:14 +0900
committerNobuyoshi Nakada <[email protected]>2024-01-06 21:19:51 +0900
commit9b78ef75522b1f6aa20fc81ddf06e5fb40db152d (patch)
tree0acde8b8ff28f89d5eea6c547ad6e415f80d93a9 /tool/rdoc-srcdir
parent3dac27897e5b48c5c95fa2f58badec1fb6da94be (diff)
[DOC] Load options and parse files from srcdir
RDoc options that do not change and can be written in `.rdoc_options` file are moved, so that they match when called without `make`. Get rid of parsing the files in `page_dir` twice (as relative paths and absolute paths).
Diffstat (limited to 'tool/rdoc-srcdir')
-rw-r--r--tool/rdoc-srcdir20
1 files changed, 20 insertions, 0 deletions
diff --git a/tool/rdoc-srcdir b/tool/rdoc-srcdir
new file mode 100644
index 0000000000..10c63caf9e
--- /dev/null
+++ b/tool/rdoc-srcdir
@@ -0,0 +1,20 @@
+#!ruby
+
+require 'rdoc/rdoc'
+
+# Make only the output directory relative to the invoked directory.
+invoked = Dir.pwd
+
+# Load options and parse files from srcdir.
+Dir.chdir(File.dirname(__dir__))
+
+options = RDoc::Options.load_options
+options.parse ARGV
+
+options.singleton_class.define_method(:finish) do
+ super()
+ @op_dir = File.expand_path(@op_dir, invoked)
+end
+
+# Do not hide errors when generating documents of Ruby itself.
+RDoc::RDoc.new.document options