Class: Guard::Herbalizer

Inherits:
Guard
  • Object
show all
Defined in:
lib/guard/herbalizer.rb

Instance Method Summary collapse

Instance Method Details

#run_allObject



17
18
19
# File 'lib/guard/herbalizer.rb', line 17

def run_all
  run_on_changes(Watcher.match_files(self, Dir.glob(File.join('**', '*'))))
end

#run_on_changes(paths) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/guard/herbalizer.rb', line 6

def run_on_changes(paths)
  paths.each do |file|
    destination = file.gsub(/\.haml\Z/, '')
    IO.popen(["herbalizer", file], "r") do |input|
      File.open(destination, 'w') do |output|
        output.write(input.read)
      end
    end
  end
end