Class: Guard::Comet

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

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Comet



5
6
7
8
# File 'lib/guard/comet.rb', line 5

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

Instance Method Details

#compile_commandObject



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 @options[:cheerp_path].nil?
  command += " -i '#{@options[:cmakelists]}'"  unless @options[:cmakelists].nil?
  command += " -o '#{@options[:output]}'"      unless @options[:output].nil?
  command += " -g" if @options[:debug] == true
  command
end

#run_allObject



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