Class: YARD::CLI::Server

Inherits:
Command show all
Defined in:
lib/yard/cli/server.rb

Overview

A local documentation server

Since:

  • 0.6.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeServer

Creates a new instance of the Server command line utility

Since:

  • 0.6.0



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/yard/cli/server.rb', line 28

def initialize
  super
  self.scripts = []
  self.template_paths = []
  self.libraries = {}
  self.options = SymbolHash.new(false).update(
    :single_library => true,
    :caching => false
  )
  self.server_options = {:Port => 8808}
end

Instance Attribute Details

#adapterYARD::Server::Adapter

Returns the adapter to use for loading the web server.

Returns:

Since:

  • 0.6.0



17
18
19
# File 'lib/yard/cli/server.rb', line 17

def adapter
  @adapter
end

#librariesHash

Returns a list of library names and yardoc files to serve.

Returns:

  • (Hash)

    a list of library names and yardoc files to serve

Since:

  • 0.6.0



14
15
16
# File 'lib/yard/cli/server.rb', line 14

def libraries
  @libraries
end

#optionsHash

Returns a list of options to pass to the doc server.

Returns:

  • (Hash)

    a list of options to pass to the doc server

Since:

  • 0.6.0



8
9
10
# File 'lib/yard/cli/server.rb', line 8

def options
  @options
end

#scriptsArray<String>

Returns a list of scripts to load.

Returns:

Since:

  • 0.6.2



21
22
23
# File 'lib/yard/cli/server.rb', line 21

def scripts
  @scripts
end

#server_optionsHash

Returns a list of options to pass to the web server.

Returns:

  • (Hash)

    a list of options to pass to the web server

Since:

  • 0.6.0



11
12
13
# File 'lib/yard/cli/server.rb', line 11

def server_options
  @server_options
end

#template_pathsArray<String>

Returns a list of template paths to register.

Returns:

  • (Array<String>)

    a list of template paths to register

Since:

  • 0.6.2



25
26
27
# File 'lib/yard/cli/server.rb', line 25

def template_paths
  @template_paths
end

Instance Method Details

#descriptionObject

Since:

  • 0.6.0



40
41
42
# File 'lib/yard/cli/server.rb', line 40

def description
  "Runs a local documentation server"
end

#run(*args) ⇒ Object

Since:

  • 0.6.0



44
45
46
47
48
49
50
51
# File 'lib/yard/cli/server.rb', line 44

def run(*args)
  optparse(*args)

  select_adapter.setup
  load_scripts
  load_template_paths
  adapter.new(libraries, options, server_options).start
end