/*
 * grunt-ractive-parse
 * https://github.com/alisonailea/grunt-extjsractive-parse
 *
 * Copyright (c) 2014 Alison Stump
 * Licensed under the MIT license.
 */

'use strict';
var Ractive = require('ractive'),
    chalk = require('chalk'),
    path = require('path');

module.exports = function (grunt) {
  var desc = 'pre-parse Ractive templates for use in MVC projects';
  
  grunt.registerMultiTask('ractive_parse', desc, make);

  function make(){
      this.files.forEach(function(file){
          var templates = file.src.map(parse);
          grunt.file.write(file.dest,
              'Ext.define("Savanna.components.templates", {\n' + templates.join(',\n') + '\n}');

          grunt.log.writeln(chalk.cyan(file.src) + ' parsed.');
      });
  }

  function parse(template){
      var name = path.basename(template, '.html'),
          html = grunt.file.read(template),
          parsed = Ractive.parse(html);

      return  '\t' + name + ': ' + JSON.stringify(parsed);
  }
};

@@ -672,73 +672,8 @@
 %7D');
-%0A%0A          grunt.log.writeln(chalk.cyan(file.src) + ' parsed.');
 %0A   
@@ -848,16 +848,78 @@
 html);%0A%0A
+      grunt.log.writeln(chalk.cyan(name) + '.html parsed.');%0A%0A
       re

update console logs