Class: Guard::CometHtml
- Inherits:
-
Plugin
- Object
- Plugin
- Guard::CometHtml
- Defined in:
- lib/guard/comet-html.rb
Instance Method Summary collapse
- #generate_command ⇒ Object
-
#initialize(options = {}) ⇒ CometHtml
constructor
A new instance of CometHtml.
- #run_all ⇒ Object
- #run_on_modifications(paths) ⇒ Object
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 = super end |
Instance Method Details
#generate_command ⇒ Object
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_all ⇒ Object
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 |