# encoding: utf-8
require 'easy_html_generator/generator/base'
# this generator resolves and runs a Gruntfile
class EasyHtmlGenerator::Generator::Service::Grunt <
EasyHtmlGenerator::Generator::Base
def generate!(config)
return unless File.exist? config.source
log ` #{grunt_command(config)} `
end
def grunt_folder(config)
File.dirname(config.source)
end
def grunt_command(config)
command = "cd #{grunt_folder(config)} \
&& npm install && grunt #{config.task}"
"if which grunt >/dev/null; then echo '\e[32m | ->running grunt \
\e[0m' && #{command}; else echo '\e[31mplease install grunt \
\"npm install -g grunt\" http://gruntjs.com/ \e[0m'; fi"
end
end