Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions lib/sdoc/generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ class RDoc::Generator::SDoc

DESCRIPTION = 'Searchable HTML documentation'

FILE_DIR = "files"
CLASS_DIR = "classes"

RESOURCES_DIR = File.join('resources', '.')

attr_reader :options
Expand Down Expand Up @@ -63,6 +66,14 @@ def self.setup_options(options)
ENV["HORO_BADGE_VERSION"] || ENV["HORO_PROJECT_VERSION"],
"API documentation"
].compact.join(" ")

if options.respond_to?(:class_module_path_prefix)
options.class_module_path_prefix = CLASS_DIR
end

if options.respond_to?(:file_path_prefix)
options.file_path_prefix = FILE_DIR
end
end

def initialize(store, options)
Expand Down Expand Up @@ -90,12 +101,14 @@ def generate
generate_class_files
end

# For compatibility with RDoc < 6.13.0
def class_dir
nil
CLASS_DIR
end

# For compatibility with RDoc < 6.13.0
def file_dir
nil
FILE_DIR
end

### Determines index page based on @options.main_page (or lack thereof)
Expand Down
14 changes: 0 additions & 14 deletions lib/sdoc/rdoc_monkey_patches.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
require "rdoc"

RDoc::TopLevel.prepend(Module.new do
def path
File.join("files", super)
end
end)


RDoc::ClassModule.prepend(Module.new do
def path
File.join("classes", super)
end
end)


RDoc::TopLevel.prepend(Module.new do
attr_writer :path

Expand Down
2 changes: 1 addition & 1 deletion spec/helpers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ module Foo; module Bar; module Qux; end; end; end

it "returns the commit time of the most recent commit in HEAD (smoke test)" do
_(@helpers.og_modified_time).
must_match %r"\A\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}[-+]\d{2}:\d{2}\z"
must_match %r"\A\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:Z|[-+]\d{2}:\d{2})\z"
end

it "returns nil when git is not installed or project is not a git repository" do
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def rdoc_top_level_for(ruby_code)
# foolproof way to initialize it is by simply running it with a dummy file.
$rdoc_for_specs ||= rdoc_dry_run("--files", __FILE__)

$rdoc_for_specs.store = RDoc::Store.new(RDoc::Options.new)
$rdoc_for_specs.store = RDoc::Store.new($rdoc_for_specs.options)

Dir.mktmpdir do |dir|
path = "#{dir}/ruby_code.rb"
Expand Down