Class: YARD::CLI::Server

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

Overview

A local documentation server

Since:

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from Command

#common_options, #load_script, #parse_options, run

Instance Attribute Details

- (Adapter) adapter

Returns the adapter to use for loading the web server

Since:

  • 0.6.0



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

def adapter
  @adapter
end

- (Hash) libraries

Returns a list of library names and yardoc files to serve

Since:

  • 0.6.0



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

def libraries
  @libraries
end

- (Hash) options

Returns a list of options to pass to the doc server

Since:

  • 0.6.0



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

def options
  @options
end

- (Array<String>) scripts

Returns a list of scripts to load

Since:

  • 0.6.2



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

def scripts
  @scripts
end

- (Hash) server_options

Returns a list of options to pass to the web server

Since:

  • 0.6.0



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

def server_options
  @server_options
end

- (Array<String>) template_paths

Returns a list of template paths to register

Since:

  • 0.6.2



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

def template_paths
  @template_paths
end

Instance Method Details

- (Object) description

Since:

  • 0.6.0



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

def description
  "Runs a local documentation server"
end

- (Object) run(*args)

Since:

  • 0.6.0



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/yard/cli/server.rb', line 30

def run(*args)
  self.scripts = []
  self.template_paths = []
  self.libraries = {}
  self.options = SymbolHash.new(false).update(
    :single_library => true,
    :caching => false
  )
  self.server_options = {:Port => 8808}
  optparse(*args)

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