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
- #clean_output_dir ⇒ Object
- #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
Copy over template files.
Constructor Details
#initialize(relations, assets, parsed_files, opts) ⇒ Writer
Returns a new instance of Writer.
19 20 21 22 23 24 |
# File 'lib/jsduck/web/writer.rb', line 19 def initialize(relations, assets, parsed_files, opts) @relations = relations @assets = assets @parsed_files = parsed_files @opts = opts end |
Instance Method Details
#clean_output_dir ⇒ Object
48 49 50 |
# File 'lib/jsduck/web/writer.rb', line 48 def clean_output_dir OutputDir.clean(@opts) end |
#format_classes ⇒ Object
79 80 81 |
# File 'lib/jsduck/web/writer.rb', line 79 def format_classes Format::Batch.format_all!(@relations, @assets, @opts) end |
#write ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/jsduck/web/writer.rb', line 26 def write clean_output_dir 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
90 91 92 93 |
# File 'lib/jsduck/web/writer.rb', line 90 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.
64 65 66 67 68 69 70 71 72 |
# File 'lib/jsduck/web/writer.rb', line 64 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
83 84 85 86 87 88 |
# File 'lib/jsduck/web/writer.rb', line 83 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
58 59 60 |
# File 'lib/jsduck/web/writer.rb', line 58 def write_member_icons Web::MemberIcons.write(@opts.output_dir+"/member-icons") end |