Sha256: 6aa3c4a1dc342aca756001a4dd02a28c8cee7942bb4dd5a00c3e12162796ccf1

Contents?: true

Size: 1.02 KB

Versions: 15

Compression:

Stored size: 1.02 KB

Contents

require 'jsduck/batch_parser'
require 'jsduck/assets'
require 'jsduck/meta_tag_registry'
require 'jsduck/export_writer'
require 'jsduck/web_writer'

module JsDuck

  # The main application logic of jsduck
  class App
    # Initializes app with JsDuck::Options object
    def initialize(opts)
      @opts = opts
    end

    # Main App logic.
    def run
      parse

      init_assets

      if @opts.export
        generate_export
      else
        generate_web_page
      end
    end

    private

    def parse
      @batch_parser = BatchParser.new(@opts)
      @relations = @batch_parser.run
    end

    def init_assets
      # Initialize guides, videos, examples, ...
      @assets = Assets.new(@relations, @opts)

      # Give access to assets from all meta-tags
      MetaTagRegistry.instance.assets = @assets
    end

    def generate_export
      ExportWriter.new(@relations, @assets, @opts).write
    end

    def generate_web_page
      WebWriter.new(@relations, @assets, @batch_parser.parsed_files, @opts).write
    end

  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
jsduck-4.7.1 lib/jsduck/app.rb
jsduck-4.7.0 lib/jsduck/app.rb
jsduck-4.6.2 lib/jsduck/app.rb
jsduck-4.6.1 lib/jsduck/app.rb
jsduck-4.6.0 lib/jsduck/app.rb
jsduck-4.5.1 lib/jsduck/app.rb
jsduck-4.5.0 lib/jsduck/app.rb
jsduck-4.4.1 lib/jsduck/app.rb
jsduck-4.4.0 lib/jsduck/app.rb
jsduck-4.3.2 lib/jsduck/app.rb
jsduck-4.3.1 lib/jsduck/app.rb
jsduck-4.3.0 lib/jsduck/app.rb
jsduck-4.2.1 lib/jsduck/app.rb
jsduck-4.2.0 lib/jsduck/app.rb
jsduck-4.1.1 lib/jsduck/app.rb