Sha256: ce265a48b79fd7c76d1b711a042c26337e156b64bbe7099188fff695af6683e2

Contents?: true

Size: 1.18 KB

Versions: 5

Compression:

Stored size: 1.18 KB

Contents

module YARD
  module Server
    class Adapter
      class << self
        alias_method :yard_setup, :setup

        # To provide the templates necessary for `yard-lucid` to integrate
        # with YARD the adapter has to around-alias the setup method to place
        # the `yard-lucid` 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

5 entries across 5 versions & 1 rubygems

Version Path
yard-lucid-0.5.0 lib/yard/server/adapter.rb
yard-lucid-0.4.0 lib/yard/server/adapter.rb
yard-lucid-0.3.0 lib/yard/server/adapter.rb
yard-lucid-0.2.0 lib/yard/server/adapter.rb
yard-lucid-0.1.0 lib/yard/server/adapter.rb