Class: Guard::DocbookStatus

Inherits:
Guard
  • Object
show all
Defined in:
lib/guard/docbook-status.rb,
lib/guard/docbook-status/version.rb

Constant Summary collapse

VERSION =
'0.1.0'

Instance Method Summary collapse

Constructor Details

#initialize(watchers = [], options = {}) ⇒ DocbookStatus

Returns a new instance of DocbookStatus.



9
10
11
12
13
14
# File 'lib/guard/docbook-status.rb', line 9

def initialize(watchers=[], options={})
  super
  @options = {
    :trigger_on_start => true
  }.update(options)
end

Instance Method Details

#run_allObject



21
22
23
# File 'lib/guard/docbook-status.rb', line 21

def run_all
  run_on_changes([])
end

#run_on_changes(paths) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/guard/docbook-status.rb', line 25

def run_on_changes(paths)
  ::Guard::UI.info("Guard::DocbookStatus detected a change",{})
  output = system("docbook_status #{@options[:cli]}")
  command_failure = ($?.to_i != 0)
  if command_failure
    ::Guard::UI.error("docbook_status indicated an error",{})
  end
end

#startObject



16
17
18
19
# File 'lib/guard/docbook-status.rb', line 16

def start
  ::Guard::UI.info("Guard::DocbookStatus has started watching your files",{})
  run_all if @options[:trigger_on_start]
end