sbraford / go-plugins
- Source
- Commits
- Network (0)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Tree:
63490e4
shanti (author)
Fri Nov 07 13:43:46 -0800 2008
go-plugins / html2haml_recursive.rb
| 44cfc5ee » | shanti | 2008-11-07 | 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 | ||||
