Class: Guard::Yard

Inherits:
Plugin
  • Object
show all
Defined in:
lib/guard/yard.rb,
lib/guard/yard/server.rb,
lib/guard/yard/no_server.rb

Defined Under Namespace

Classes: NoServer, Server

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Yard

Returns a new instance of Yard.



11
12
13
14
15
# File 'lib/guard/yard.rb', line 11

def initialize(options = {})
  super
  options[:server] = true unless options.key?(:server)
  @server = options[:server] ? Server.new(options) : NoServer.new
end

Instance Attribute Details

#serverObject

Returns the value of attribute server.



9
10
11
# File 'lib/guard/yard.rb', line 9

def server
  @server
end

Instance Method Details

#reloadObject



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

def reload
  boot
end

#run_allObject



29
30
31
32
33
34
# File 'lib/guard/yard.rb', line 29

def run_all
  UI.info "[Guard::Yard] Generating all documentation."
  system('rm -rf .yardoc && yard doc')
  UI.info "[Guard::Yard] Documentation has been generated."
  true
end

#run_on_changes(paths) ⇒ Object



36
37
38
39
40
# File 'lib/guard/yard.rb', line 36

def run_on_changes(paths)
  UI.info "[Guard::Yard] Detected changes in #{paths.join(',')}."
  paths.each { |path| document([path]) }
  UI.info "[Guard::Yard] Updated documentation for #{paths.join(',')}."
end

#startObject



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

def start
  boot
end

#stopObject



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

def stop
  server.kill
end