Commit 03d59240 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Remove export type 'api'.

It was implemented long-long time ago and I doubt it's of much use.
Even if somebody uses it, the same information can be retrieved from
--export=full.
parent 4598fcf8
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
require 'jsduck/util/stdout'
require 'jsduck/exporter/api'
require 'jsduck/exporter/full'
require 'jsduck/exporter/examples'
require 'jsduck/batch_formatter'
@@ -38,7 +37,6 @@ module JsDuck
    def get_exporter
      exporters = {
        :full => Exporter::Full,
        :api => Exporter::Api,
        :examples => Exporter::Examples,
      }
      exporters[@opts.export]

lib/jsduck/exporter/api.rb

deleted100644 → 0
+0 −49
Original line number Diff line number Diff line
require 'jsduck/class'

module JsDuck
  module Exporter

    # Exporter for simple JSON format listing only class name and names
    # of all of its members.
    #
    # It produces the following structure:
    #
    # {
    #   :name => "Panel",
    #   :members => {
    #     :cfg => ["width", "height", "title"],
    #     :method => ["getWidth", "setWidth"],
    #     ...
    #   },
    #   :statics => { ... }
    # }
    #
    class Api
      def initialize(relations, opts)
        # All params ignored, they're present to be compatible with
        # other exporters.
      end

      # Returns hash of class name and member names
      def export(cls)
        {
          :name => cls[:name],
          :members => export_members(cls, false),
          :statics => export_members(cls, true),
        }
      end

      private

      def export_members(cls, static)
        h = {}
        Class.each_member_type do |tagname|
          h[tagname] = cls.find_members(:tagname => tagname, :static => static).map {|m| m[:name] }
        end
        h
      end

    end

  end
end
+7 −2
Original line number Diff line number Diff line
@@ -171,9 +171,14 @@ module JsDuck
          "TYPE is one of:",
          "",
          "- full     - full class docs.",
          "- api      - only class- and member names.",
          "- examples - extracts inline examples from classes.") do |format|
          @export = format.to_sym
          export_type = format.to_sym
          if [:full, :examples].include?(export_type)
            @export = export_type
          else
            Logger.fatal("Unsupported export type: '#{export_type}'")
            exit(1)
          end
        end

        opts.on('--builtin-classes',