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

Overview

Main guard-yard plugin class.

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.



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

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.



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

def server
  @server
end

Instance Method Details

#reloadObject



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

def reload
  boot
end

#run_allObject



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

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



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

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



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

def start
  boot
end

#stopObject



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

def stop
  server.kill
end