Class: Guard::Comet
- Inherits:
-
Plugin
- Object
- Plugin
- Guard::Comet
- Defined in:
- lib/guard/comet.rb
Instance Method Summary collapse
- #compile_command ⇒ Object
-
#initialize(options = {}) ⇒ Comet
constructor
A new instance of Comet.
- #run_all ⇒ Object
- #run_on_modifications(paths) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Comet
5 6 7 8 |
# File 'lib/guard/comet.rb', line 5 def initialize = {} = super end |
Instance Method Details
#compile_command ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/guard/comet.rb', line 14 def compile_command gemspec = Gem::Specification.find_all_by_name("comet-cpp").first compiler = "#{gemspec.bin_dir}/comet-make" command = "#{compiler}" command += " -c '#{@options[:cheerp_path]}'" unless [:cheerp_path].nil? command += " -i '#{@options[:cmakelists]}'" unless [:cmakelists].nil? command += " -o '#{@options[:output]}'" unless [:output].nil? command += " -g" if [:debug] == true command end |
#run_all ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/guard/comet.rb', line 25 def run_all PTY.spawn(compile_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
10 11 12 |
# File 'lib/guard/comet.rb', line 10 def run_on_modifications(paths) run_all end |