Sha256: 293f3a295bb65f26d7edde835154e5834542f79209a6de09726d508d39a815a0

Contents?: true

Size: 943 Bytes

Versions: 11

Compression:

Stored size: 943 Bytes

Contents

require "yard"

module Lookbook
  class Parser
    YARDOC_FILE_PATH = Rails.root.join("tmp/storage/.yardoc").to_s

    def initialize(paths)
      @paths = paths.map { |p| "#{p}/**/*preview.rb" }
      YARD::Registry.yardoc_file = YARDOC_FILE_PATH
    end

    def parse
      YARD::Registry.clear
      YARD::Registry.lock_for_writing do
        YARD.parse(@paths)
        YARD::Registry.save(false, YARDOC_FILE_PATH)
      end
    end

    def get_code_object(path)
      registry = YARD::RegistryStore.new
      registry.load!(YARDOC_FILE_PATH)
      registry.get(path)
    end

    class << self
      def define_tags
        YARD::Tags::Library.define_tag("Hidden status", :hidden)
        YARD::Tags::Library.define_tag("Label", :label)
        YARD::Tags::Library.define_tag("Display", :display)
        YARD::Tags::Library.define_tag("Position", :position)
        YARD::Tags::Library.define_tag("ID", :id)
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
lookbook-0.7.4 lib/lookbook/parser.rb
lookbook-0.7.3 lib/lookbook/parser.rb
lookbook-0.7.2 lib/lookbook/parser.rb
lookbook-0.7.2.beta.5 lib/lookbook/parser.rb
lookbook-0.7.2.beta.4 lib/lookbook/parser.rb
lookbook-0.7.2.beta.3 lib/lookbook/parser.rb
lookbook-0.7.2.beta.2 lib/lookbook/parser.rb
lookbook-0.7.2.beta.1 lib/lookbook/parser.rb
lookbook-0.7.2.beta.0 lib/lookbook/parser.rb
lookbook-0.7.1 lib/lookbook/parser.rb
lookbook-0.7.0 lib/lookbook/parser.rb