Class: JsDuck::Web::Writer
- Inherits:
-
Object
- Object
- JsDuck::Web::Writer
- Defined in:
- lib/jsduck/web/writer.rb
Overview
Performs the generation of docs web app.
Instance Method Summary collapse
- #format_classes ⇒ Object
-
#initialize(relations, assets, parsed_files, opts) ⇒ Writer
constructor
A new instance of Writer.
- #write ⇒ Object
- #write_classes ⇒ Object
-
#write_html_files ⇒ Object
Generate data.js and styles.css.
- #write_inline_examples ⇒ Object
-
#write_member_icons ⇒ Object
Copy over member icons.
- #write_source ⇒ Object
-
#write_template_files ⇒ Object
Clean output dir and copy over template files.
Constructor Details
#initialize(relations, assets, parsed_files, opts) ⇒ Writer
Returns a new instance of Writer.
18 19 20 21 22 23 |
# File 'lib/jsduck/web/writer.rb', line 18 def initialize(relations, assets, parsed_files, opts) @relations = relations @assets = assets @parsed_files = parsed_files @opts = opts end |
Instance Method Details
#format_classes ⇒ Object
73 74 75 |
# File 'lib/jsduck/web/writer.rb', line 73 def format_classes Format::Batch.format_all!(@relations, @assets, @opts) end |
#write ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/jsduck/web/writer.rb', line 25 def write write_template_files write_member_icons write_html_files # class-formatting is done in parallel which breaks the links # between source files and classes. Therefore it MUST to be done # after writing sources which needs the links to work. write_source if @opts.source format_classes write_inline_examples if @opts.tests write_classes @assets.write end |
#write_classes ⇒ Object
84 85 86 87 |
# File 'lib/jsduck/web/writer.rb', line 84 def write_classes class_writer = ClassWriter.new(Exporter::App, @relations, @opts) class_writer.write(@opts.output_dir+"/output", ".js") end |
#write_html_files ⇒ Object
Generate data.js and styles.css. Then generate HTML files, linking to the data.js and styles.css from them.
58 59 60 61 62 63 64 65 66 |
# File 'lib/jsduck/web/writer.rb', line 58 def write_html_files # Remember the MD5-fingerprinted filenames paths = { :data => Web::Data.new(@relations, @assets, @opts).write(@opts.output_dir+"/data.js"), :css => Web::Css.new(@opts).write(@opts.output_dir+"/styles.css"), } Web::IndexHtml.new(@assets, @opts, paths).write end |
#write_inline_examples ⇒ Object
77 78 79 80 81 82 |
# File 'lib/jsduck/web/writer.rb', line 77 def write_inline_examples examples = InlineExamples.new examples.add_classes(@relations) examples.add_guides(@assets.guides) examples.write(@opts.output_dir+"/inline-examples.js") end |
#write_member_icons ⇒ Object
Copy over member icons
52 53 54 |
# File 'lib/jsduck/web/writer.rb', line 52 def write_member_icons Web::MemberIcons.write(@opts.output_dir+"/member-icons") end |