Class: JsDuck::Web::IndexHtml

Inherits:
Object
  • Object
show all
Defined in:
lib/jsduck/web/index_html.rb

Overview

Deals with creation of main HTML or PHP files.

Instance Method Summary collapse

Constructor Details

#initialize(assets, opts, paths = {}) ⇒ IndexHtml

Returns a new instance of IndexHtml.



11
12
13
14
15
# File 'lib/jsduck/web/index_html.rb', line 11

def initialize(assets, opts, paths={})
  @assets = assets
  @opts = opts
  @paths = paths
end

Instance Method Details

#writeObject

In normal mode creates index.html.

When –seo enabled, creates index.php, template.html and print-template.html.



20
21
22
23
24
25
26
27
28
29
# File 'lib/jsduck/web/index_html.rb', line 20

def write
  if @opts.seo
    FileUtils.cp(@opts.template_dir+"/index.php", @opts.output_dir+"/index.php")
    create_template_html(@opts.template_dir+"/template.html", @opts.output_dir+"/template.html")
    create_print_template_html(@opts.template_dir+"/print-template.html", @opts.output_dir+"/print-template.html")
    create_index_template_html(@opts.template_dir+"/index-template.html", @opts.output_dir+"/index-template.html")
  else
    create_template_html(@opts.template_dir+"/template.html", @opts.output_dir+"/index.html")
  end
end