Sha256: 0373f6fb0aa5766e2248b7eb7985e0507fb9ae427bf498b515834c18c6ebb541

Contents?: true

Size: 1.25 KB

Versions: 3

Compression:

Stored size: 1.25 KB

Contents

module YARD
  module Server

    class Adapter

      class << self

        alias_method :yard_setup, :setup

        #
        # To provide the templates necessary for `yard-gherkin-turnip` to integrate
        # with YARD the adapter has to around-alias the setup method to place
        # the `yard-gherkin-turnip` server templates as the last template in the list.
        #
        # When they are normally loaded with the plugin they cause an error with
        # the `yardoc` command. They are also not used because the YARD server
        # templates are placed after all plugin templates.
        #
        def setup
          yard_setup
          YARD::Templates::Engine.template_paths +=
          [File.dirname(__FILE__) + '/../../templates',File.dirname(__FILE__) + '/../../docserver']
        end

        alias_method :yard_shutdown, :shutdown

        #
        # Similar to the addition, it is good business to tear down the templates
        # that were added by again around-aliasing the shutdown method.
        #
        def shutdown
          yard_shutdown
          YARD::Templates::Engine.template_paths -=
          [File.dirname(__FILE__) + '/../../templates',File.dirname(__FILE__) + '/../../docserver']
        end

      end


    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
yard-gherkin-turnip-1.0.2 lib/yard/server/adapter.rb
yard-gherkin-turnip-1.0.1 lib/yard/server/adapter.rb
yard-gherkin-turnip-1.0.0 lib/yard/server/adapter.rb