How to use the grunt.log function in grunt

To help you get started, we’ve selected a few grunt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github shaekuronen / grunt-ejs-static / lib / render.js View on Github external
render_file: function(layout_data, file_data, helpers) {

    grunt.log.debug('render_file(): executed');

    // set the base dir for includes
    // tj uses filename to set base dir for includes in ejs.js
    // which make the include relative to the file
    // see resolveInclude() in visionmedia/ejs/lib/ejs.js
    file_data.filename = layout_data.path_to_layout;

    // add any helpers to the file_data object
    if (_.keys(helpers).length > 0) {

      _.extend(file_data, helpers);
      grunt.log.debug('render.js render_file() the value of helpers is :' + Object.keys(helpers));

    }

    grunt.log.debug('data available for this template ' + Object.keys(file_data));

    // render the template as html and return the result
    var rendered_file = ejs.render(layout_data.layout, file_data);

    return rendered_file;

  }
  // end render the file
github shaekuronen / grunt-ejs-static / lib / write_file.js View on Github external
path_to_file = underscores_to_dashes(path_to_file);

        grunt.log.debug('path to html file is ' + path_to_file); 

        // write file to the destination directory
        grunt.file.write(path_to_file, rendered_file);
        grunt.log.debug('Rendered root level file written to ' + path_to_file);        

      } else {

        // create the file with the key as the file name
        path_to_file = path.join(options.dest, key + options.file_extension);

        path_to_file = underscores_to_dashes(path_to_file);

        grunt.log.debug('path to html file is ' + path_to_file);

        // write file to the destination directory
        grunt.file.write(path_to_file, rendered_file);
        grunt.log.debug('Rendered root level file written to ' + path_to_file);  

      }

    }
    // end create a file at root level
github ahmednuaman / grunt-scss-lint / test / scss-lint.spec.js View on Github external
beforeEach(function (done) {
    sandbox = sinon.sandbox.create();

    fs.stat(reporterOutFile, function (err, stats) {
      if (!err) {
        fs.unlink(reporterOutFile, done);
      } else {
        done();
      }
    });

    errorlnsStub = sandbox.stub(grunt.log, 'errorlns');
    oklnsStub = sandbox.stub(grunt.log, 'oklns');
    writelnStub = sandbox.stub(grunt.log, 'writeln');
  });
github prabhash1785 / NodeJS / MyPlayGround / Gruntfile.js View on Github external
grunt.registerTask('validateandruntaskv2', 'if task available then run given task with multiple args', function(taskname) {
    if(!taskname || !taskname.length) {
        grunt.fail.fatal('task name is needed to run this task');
    }

    var taskToCall = taskname;
    for(var i = 1; i < arguments.length; i++) {
        taskToCall += ':' + arguments[i];
    }
    console.log(taskToCall);

    if(!grunt.task.exists(taskname)) {
        grunt.log.writeln('this task does not exist!');
    } else {
        grunt.log.writeln(taskname + ' exists. Going to run this task');
        grunt.task.run(taskToCall);
    }
});
github pifantastic / grunt-s3 / tasks / lib / S3Task.js View on Github external
run: function () {
    var self = this;
    var s3 = this.s3;
    var done = this._origTask.async();
    var config = this.getConfig();
    var transfers = [];

    if (config.debug) {
      grunt.log.writeln('Running in debug mode, no transfers will be made'.yellow);
      grunt.log.writeln();
    }

    config.upload.forEach(function (upload) {
      var uploadFiles = self._parseUploadFiles(upload, config);

      uploadFiles.forEach(function (uploadFile) {
        transfers.push(s3.upload.bind(s3, uploadFile.file, uploadFile.dest, uploadFile.upload));
      });
    });

    config.sync.forEach(function (sync) {
      var syncFiles = self._parseUploadFiles(sync, config);

      syncFiles.forEach(function (syncFile) {
        transfers.push(s3.sync.bind(s3, syncFile.file, syncFile.dest, syncFile.upload));
github thanpolas / mantri / lib / mantri-help.js View on Github external
exports.options = function() {
  grunt.log.header('Options');
  exports.table(exports._options);

};
github bevacqua / grunt-ec2 / tasks / lib / ssh.js View on Github external
function blown () {
        var args = _.toArray(arguments);

        if (options.fatal !== false) {
            grunt.fatal.apply(grunt, args);
        } else {
            grunt.log.writeln.call(grunt.log, args);
            done();
        }
    }
}
github mattgoldspink / grunt-sencha-dependencies / tasks / lib / safelyEvalFile.js View on Github external
var safelyEvalFile = function (fileUrl) {
    if (!grunt.file.exists(fileUrl)) {
        grunt.log.error("Source file '" + fileUrl + "' not found.");
    }
    try {
        eval(grunt.file.read(fileUrl));
    } catch (e) {
        grunt.log.error("An unexpected error occured while processing " + fileUrl + ", please report a bug here if problems occur in your app " +
                          "https://github.com/mattgoldspink/grunt-sencha-dependencies/issues?state=open - " + e);
        if (e.stack) {
            grunt.log.error("Stack for debugging: \n" + e.stack);
        }
        throw e;
    }
    return Ext;
};
github TypeStrong / grunt-ts / tasks-internal / modules / compile.ts View on Github external
function getTsc(binPath: string): string {
    var pkg = JSON.parse(fs.readFileSync(path.resolve(binPath, '..', 'package.json')).toString());
    grunt.log.writeln('Using tsc v' + pkg.version);

    return path.join(binPath, 'tsc');
}