Skip to content

Instantly share code, notes, and snippets.

@samleb
Created October 22, 2009 01:05
Show Gist options
  • Select an option

  • Save samleb/215633 to your computer and use it in GitHub Desktop.

Select an option

Save samleb/215633 to your computer and use it in GitHub Desktop.
diff --git a/lib/pdoc/generators/html/website.rb b/lib/pdoc/generators/html/website.rb
index 8f24872..26e5dc3 100644
--- a/lib/pdoc/generators/html/website.rb
+++ b/lib/pdoc/generators/html/website.rb
@@ -12,8 +12,8 @@ module PDoc
def initialize(parser_output, options = {})
super
- @templates_directory = options[:templates] || TEMPLATES_DIRECTORY
- @index_page = options[:index_page]
+ @templates_directory = File.expand_path(options[:templates] || TEMPLATES_DIRECTORY)
+ @index_page = options[:index_page] && File.expand_path(options[:index_page])
load_custom_helpers
end
diff --git a/lib/pdoc/runner.rb b/lib/pdoc/runner.rb
index 47f6d5e..a9a1060 100644
--- a/lib/pdoc/runner.rb
+++ b/lib/pdoc/runner.rb
@@ -3,11 +3,10 @@ module PDoc
def initialize(*source_files)
options = source_files.last.is_a?(Hash) ? source_files.pop : {}
@source_files = source_files
- @output_directory = File.expand_path(options[:output] || OUTPUT_DIR)
- @templates_directory = options[:templates] && File.expand_path(options[:templates])
- @index_page = options[:index_page] && File.expand_path(options[:index_page])
- @generator = options[:generator] || Generators::Html::Website
+ @output_directory = File.expand_path(options.delete(:output) || OUTPUT_DIR)
+ @generator = options.delete(:generator) || Generators::Html::Website
@parser = Parser.new(source)
+ @generator_options = options
end
def source
@@ -34,10 +33,7 @@ module PDoc
def render
log "Generating documentation to: #{@output_directory}.\n\n"
start_time = Time.new
- @generator.new(@parser_output, {
- :templates => @templates_directory,
- :index_page => @index_page
- }).render(@output_directory)
+ @generator.new(@parser_output, @generator_options).render(@output_directory)
log "\c[[F Documentation generated in #{Time.new - start_time} seconds."
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment