Class: Guard::CometHtml

Inherits:
Plugin
  • Object
show all
Defined in:
lib/guard/comet-html.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ CometHtml

Returns a new instance of CometHtml.



3
4
5
6
# File 'lib/guard/comet-html.rb', line 3

def initialize options = {}
  @options = options
  super
end

Instance Method Details

#generate_commandObject



12
13
14
15
16
17
18
19
# File 'lib/guard/comet-html.rb', line 12

def generate_command
  gemspec  = Gem::Specification.find_all_by_name("comet-cpp").first
  command  = "#{gemspec.bin_dir}/comet-html"
  command += " -i '#{@options[:source]}'" unless @options[:source].nil?
  command += " -o '#{@options[:output]}'" unless @options[:output].nil?
  command += " -c '#{@options[:config]}'" unless @options[:config].nil?
  command
end

#run_allObject



21
22
23
24
25
26
27
28
29
30
# File 'lib/guard/comet-html.rb', line 21

def run_all
  PTY.spawn(generate_command) do |stdout,stdin,pid|
    begin
      stdout.each {|line| print line}
    rescue Errno::EIO
    end
    Process.wait(pid)
  end
  if $?.success? then :success else :failure end
end

#run_on_modifications(paths) ⇒ Object



8
9
10
# File 'lib/guard/comet-html.rb', line 8

def run_on_modifications(paths)
  run_all
end