Skip to content

Commit f725cfd

Browse files
WIP
1 parent 3fcc2bb commit f725cfd

File tree

3 files changed

+16
-17
lines changed

3 files changed

+16
-17
lines changed

lib/sdoc/generator.rb

+15-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ class RDoc::Generator::SDoc
2525

2626
DESCRIPTION = 'Searchable HTML documentation'
2727

28+
FILE_DIR = "files"
29+
CLASS_DIR = "classes"
30+
2831
RESOURCES_DIR = File.join('resources', '.')
2932

3033
attr_reader :options
@@ -63,6 +66,14 @@ def self.setup_options(options)
6366
ENV["HORO_BADGE_VERSION"] || ENV["HORO_PROJECT_VERSION"],
6467
"API documentation"
6568
].compact.join(" ")
69+
70+
if options.respond_to?(:class_module_path_prefix)
71+
options.class_module_path_prefix = CLASS_DIR
72+
end
73+
74+
if options.respond_to?(:file_path_prefix)
75+
options.file_path_prefix = FILE_DIR
76+
end
6677
end
6778

6879
def initialize(store, options)
@@ -90,12 +101,14 @@ def generate
90101
generate_class_files
91102
end
92103

104+
# For compatibility with RDoc < 6.13.0
93105
def class_dir
94-
nil
106+
CLASS_DIR
95107
end
96108

109+
# For compatibility with RDoc < 6.13.0
97110
def file_dir
98-
nil
111+
FILE_DIR
99112
end
100113

101114
### Determines index page based on @options.main_page (or lack thereof)

lib/sdoc/rdoc_monkey_patches.rb

-14
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,5 @@
11
require "rdoc"
22

3-
RDoc::TopLevel.prepend(Module.new do
4-
def path
5-
File.join("files", super)
6-
end
7-
end)
8-
9-
10-
RDoc::ClassModule.prepend(Module.new do
11-
def path
12-
File.join("classes", super)
13-
end
14-
end)
15-
16-
173
RDoc::TopLevel.prepend(Module.new do
184
attr_writer :path
195

spec/spec_helper.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def rdoc_top_level_for(ruby_code)
2828
# foolproof way to initialize it is by simply running it with a dummy file.
2929
$rdoc_for_specs ||= rdoc_dry_run("--files", __FILE__)
3030

31-
$rdoc_for_specs.store = RDoc::Store.new(RDoc::Options.new)
31+
$rdoc_for_specs.store = RDoc::Store.new($rdoc_for_specs.options)
3232

3333
Dir.mktmpdir do |dir|
3434
path = "#{dir}/ruby_code.rb"

0 commit comments

Comments
 (0)