Class: JsDuck::Web::Template

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

Overview

Copies over the template directory.

Or links when –template-links option specified.

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Template

Returns a new instance of Template.



11
12
13
14
15
16
17
18
19
20
# File 'lib/jsduck/web/template.rb', line 11

def initialize(opts)
  @opts = opts
  @files = [
    "app",
    "app*.js",
    "favicon.ico",
    "extjs",
    "resources",
  ]
end

Instance Method Details

#writeObject



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/jsduck/web/template.rb', line 22

def write
  if @opts.template_links
    Logger.log("Linking template files to", @opts.output)
    move_files(:symlink)
  else
    Logger.log("Copying template files to", @opts.output)
    move_files(:cp_r)
  end

  # always copy the eg-iframe file.
  eg_iframe = @opts.eg_iframe || @opts.template+"/eg-iframe.html"
  FileUtils.cp(eg_iframe, @opts.output+"/eg-iframe.html")
end