class Html2hamlRecursive < Go::Plugin call_with 'convert html2haml' usage 'convert html2haml /path/to/app/views/' def run if @options.params.size < 2 puts "Please provide a target directory." else @target_dir = @options.params[1] res = `which html2haml` if res.nil? || res.empty? puts "Could not find html2haml. Please ensure the haml gem is installed"; return end res.chop! @cmd = "for x in `find #{@target_dir} | grep erb`; do #{res} $x > `dirname $x`\"/\"`basename $x \".erb\"`\".haml\"; done" system(@cmd) end end end