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
Methods inherited from Base
#enabled?, #file_changed?, #generate, #initialize, #log, #log_running, #repetitive?, #store_file_hash, #tasks
Constructor Details
This class inherits a constructor from EasyHtmlGenerator::Generator::Base
Instance Method Details
#generate!(config) ⇒ Object
8 9 10 11 |
# File 'lib/easy_html_generator/generator/service/grunt.rb', line 8 def generate!(config) return unless File.exist? config.source log ` #{grunt_command(config)} ` end |
#grunt_command(config) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/easy_html_generator/generator/service/grunt.rb', line 17 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 |
#grunt_folder(config) ⇒ Object
13 14 15 |
# File 'lib/easy_html_generator/generator/service/grunt.rb', line 13 def grunt_folder(config) File.dirname(config.source) end |