sbraford / go-plugins

Go plugins used by sbraford. Feel free to clone individually or as a whole.

This URL has Read+Write access

go-plugins / html2haml_recursive.rb
44cfc5ee » shanti 2008-11-07 first commit 1 class Html2hamlRecursive < Go::Plugin
2 call_with 'convert html2haml'
3 usage 'convert html2haml /path/to/app/views/'
4
5 def run
6 if @options.params.size < 2
7 puts "Please provide a target directory."
8 else
9 @target_dir = @options.params[1]
10 res = `which html2haml`
11 if res.nil? || res.empty?
12 puts "Could not find html2haml. Please ensure the haml gem is installed"; return
13 end
14 res.chop!
15 @cmd = "for x in `find #{@target_dir} | grep erb`; do #{res} $x > `dirname $x`\"/\"`basename $x \".erb\"`\".haml\"; done"
16 system(@cmd)
17 end
18 end
19 end