Class: EasyHtmlGenerator::Generator::Service::Grunt
- Defined in:
- lib/easy_html_generator/generator/service/grunt.rb
Overview
this generator resolves and runs a Gruntfile
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #do_file(grunt_file, *_args) ⇒ Object
-
#initialize(project, config) ⇒ Grunt
constructor
A new instance of Grunt.
Methods inherited from Base
#dest_path, #do_input, #generate, #input_to_output_file, #log, #log_running, #resolve_path_prefix, #should_do_file?, #src_path, #walk_files
Constructor Details
#initialize(project, config) ⇒ Grunt
Returns a new instance of Grunt.
8 9 10 11 12 13 |
# File 'lib/easy_html_generator/generator/service/grunt.rb', line 8 def initialize(project, config) super(project, config) @config.src = '' @config.dest = '' end |
Instance Method Details
#do_file(grunt_file, *_args) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/easy_html_generator/generator/service/grunt.rb', line 15 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 |