# 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 initialize(project, config) super(project, config) @config.src = '' @config.dest = '' end def do_file(grunt_file, *_args) input_folder = File.dirname(grunt_file) cmd = "cd #{input_folder} && npm install && grunt #{@config.task}" cmd = "if which grunt >/dev/null; then echo '\e[32m | ->running grunt \ \e[0m' && #{cmd}; else echo '\e[31mplease install grunt \ \"npm install -g grunt\" http://gruntjs.com/ \e[0m'; fi" log ` #{cmd} ` end end