How to use the grunt.warn 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 sindresorhus / grunt-recess / tasks / lib / util / log-error.js View on Github external
// parse error
		grunt.log.error(chalk.red('Parser error') + (err.filename ? ' in ' + chalk.yellow(err.filename) : '') + '\n');
	} else {
		// other exception
		grunt.log.error((err.name ? chalk.red(err.name) + ': ' : '') + err.message +
			(err.filename ? ' in ' + chalk.yellow(err.filename) : '') + '\n');
	}

	// if extract - then log it
	if (err.extract) {
		err.extract.forEach(function (line, index) {
			grunt.log.error(padLine(err.line + index) + line);
		});
	}

	grunt.warn('');
};
github sindresorhus / grunt-recess / tasks / lib / RecessTask.js View on Github external
data.forEach(function (item) {
				if (item.options.compile || reporter) {
					min.push(item.output);
					max.push(item.data);
					// Extract status and check
				} else if (item.output[1] && item.output[1].indexOf('Perfect!') !== -1) {
					grunt.log.writeln(item.output.join('\n'));
				} else {
					grunt.warn(item.output.join('\n'));
				}

				if (reporter) {
					reporter.inst.startFile(dest);

					if (item.definitions && item.definitions.length) {
						// loop over definitions to get errors
						item.definitions.forEach(function (definition) {
							if (definition.errors && definition.errors.length) {
								definition.errors.forEach(function (definitionErr) {
									// report that error
									reporter.inst.logError(definitionErr);
								});
							}
						});
					}
github MeoMix / StreamusChromeExtension / node_modules / grunt-text-replace / lib / grunt-text-replace.js View on Github external
replace: function (settings) {
    var src = grunt.file.expand(settings.src || []);
    var dest = settings.dest;
    var overwrite = settings.overwrite;
    var replacements = settings.replacements;
    var isDestinationDirectory = (/\/$/).test(dest);
    var initialWarnCount = grunt.fail.warncount;

    if (typeof dest === 'undefined' &&
        typeof src === 'undefined' &&
        typeof replacements === 'undefined') {
      grunt.warn(gruntTextReplace.errorMessages.noTargetsDefined);
    } else if (typeof dest === 'undefined' && overwrite !== true) {
      grunt.warn(gruntTextReplace.errorMessages.noDestination);
    } else if (typeof replacements === 'undefined') {
      grunt.warn(gruntTextReplace.errorMessages.noReplacements);
    } else if (typeof dest !== 'undefined' && overwrite === true) {
      grunt.warn(gruntTextReplace.errorMessages.overwriteFailure);
    } else if ((isDestinationDirectory === false && src.length > 1) && overwrite !== true) {
      grunt.warn(gruntTextReplace.errorMessages.multipleSourceSingleDestination);
    } else if (grunt.fail.warncount - initialWarnCount === 0) {
      gruntTextReplace.replaceFileMultiple({
        src: src,
        dest: dest,
        replacements: replacements
      });
    }
  },
github yoniholmes / grunt-text-replace / lib / grunt-text-replace.js View on Github external
replace: function (settings) {
    var src = grunt.file.expand(settings.src || []);
    var dest = settings.dest;
    var overwrite = settings.overwrite;
    var replacements = settings.replacements;
    var isDestinationDirectory = (/\/$/).test(dest);
    var initialWarnCount = grunt.fail.warncount;

    if (typeof dest === 'undefined' &&
        typeof src === 'undefined' &&
        typeof replacements === 'undefined') {
      grunt.warn(gruntTextReplace.errorMessages.noTargetsDefined);
    } else if (typeof dest === 'undefined' && overwrite !== true) {
      grunt.warn(gruntTextReplace.errorMessages.noDestination);
    } else if (typeof replacements === 'undefined') {
      grunt.warn(gruntTextReplace.errorMessages.noReplacements);
    } else if (typeof dest !== 'undefined' && overwrite === true) {
      grunt.warn(gruntTextReplace.errorMessages.overwriteFailure);
    } else if ((isDestinationDirectory === false && src.length > 1) && overwrite !== true) {
      grunt.warn(gruntTextReplace.errorMessages.multipleSourceSingleDestination);
    } else if (grunt.fail.warncount - initialWarnCount === 0) {
      gruntTextReplace.replaceFileMultiple({
        src: src,
        dest: dest,
        replacements: replacements
      });
    }
  },
github MeoMix / StreamusChromeExtension / node_modules / grunt-text-replace / lib / grunt-text-replace.js View on Github external
replace: function (settings) {
    var src = grunt.file.expand(settings.src || []);
    var dest = settings.dest;
    var overwrite = settings.overwrite;
    var replacements = settings.replacements;
    var isDestinationDirectory = (/\/$/).test(dest);
    var initialWarnCount = grunt.fail.warncount;

    if (typeof dest === 'undefined' &&
        typeof src === 'undefined' &&
        typeof replacements === 'undefined') {
      grunt.warn(gruntTextReplace.errorMessages.noTargetsDefined);
    } else if (typeof dest === 'undefined' && overwrite !== true) {
      grunt.warn(gruntTextReplace.errorMessages.noDestination);
    } else if (typeof replacements === 'undefined') {
      grunt.warn(gruntTextReplace.errorMessages.noReplacements);
    } else if (typeof dest !== 'undefined' && overwrite === true) {
      grunt.warn(gruntTextReplace.errorMessages.overwriteFailure);
    } else if ((isDestinationDirectory === false && src.length > 1) && overwrite !== true) {
      grunt.warn(gruntTextReplace.errorMessages.multipleSourceSingleDestination);
    } else if (grunt.fail.warncount - initialWarnCount === 0) {
      gruntTextReplace.replaceFileMultiple({
        src: src,
        dest: dest,
        replacements: replacements
      });
    }
  },
github yoniholmes / grunt-text-replace / lib / grunt-text-replace.js View on Github external
replace: function (settings) {
    var src = grunt.file.expand(settings.src || []);
    var dest = settings.dest;
    var overwrite = settings.overwrite;
    var replacements = settings.replacements;
    var isDestinationDirectory = (/\/$/).test(dest);
    var initialWarnCount = grunt.fail.warncount;

    if (typeof dest === 'undefined' &&
        typeof src === 'undefined' &&
        typeof replacements === 'undefined') {
      grunt.warn(gruntTextReplace.errorMessages.noTargetsDefined);
    } else if (typeof dest === 'undefined' && overwrite !== true) {
      grunt.warn(gruntTextReplace.errorMessages.noDestination);
    } else if (typeof replacements === 'undefined') {
      grunt.warn(gruntTextReplace.errorMessages.noReplacements);
    } else if (typeof dest !== 'undefined' && overwrite === true) {
      grunt.warn(gruntTextReplace.errorMessages.overwriteFailure);
    } else if ((isDestinationDirectory === false && src.length > 1) && overwrite !== true) {
      grunt.warn(gruntTextReplace.errorMessages.multipleSourceSingleDestination);
    } else if (grunt.fail.warncount - initialWarnCount === 0) {
      gruntTextReplace.replaceFileMultiple({
        src: src,
        dest: dest,
        replacements: replacements
      });
    }
  },
github prabhash1785 / NodeJS / MyPlayGround / Gruntfile.js View on Github external
grunt.registerTask('hello', 'greeting task', function(name) {
   if(!name || !name.length) {
       grunt.warn('you need to provide a name');
   }

    console.log('hello ' + name + '!');

});
github yoniholmes / grunt-text-replace / lib / grunt-text-replace.js View on Github external
var dest = settings.dest;
    var overwrite = settings.overwrite;
    var replacements = settings.replacements;
    var isDestinationDirectory = (/\/$/).test(dest);
    var initialWarnCount = grunt.fail.warncount;

    if (typeof dest === 'undefined' &&
        typeof src === 'undefined' &&
        typeof replacements === 'undefined') {
      grunt.warn(gruntTextReplace.errorMessages.noTargetsDefined);
    } else if (typeof dest === 'undefined' && overwrite !== true) {
      grunt.warn(gruntTextReplace.errorMessages.noDestination);
    } else if (typeof replacements === 'undefined') {
      grunt.warn(gruntTextReplace.errorMessages.noReplacements);
    } else if (typeof dest !== 'undefined' && overwrite === true) {
      grunt.warn(gruntTextReplace.errorMessages.overwriteFailure);
    } else if ((isDestinationDirectory === false && src.length > 1) && overwrite !== true) {
      grunt.warn(gruntTextReplace.errorMessages.multipleSourceSingleDestination);
    } else if (grunt.fail.warncount - initialWarnCount === 0) {
      gruntTextReplace.replaceFileMultiple({
        src: src,
        dest: dest,
        replacements: replacements
      });
    }
  },
github prabhash1785 / NodeJS / MyPlayGround / Gruntfile.js View on Github external
grunt.registerTask('validateandruntask', 'if task available then run given task', function(taskname) {
   if(!taskname || !taskname.length) {
       grunt.warn('task name is needed to run this task');
   }

    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(taskname);
    }

});
github viverae / marionette.formview / node_modules / grunt-jasmine-runner / tasks / lib / phantomjs.js View on Github external
version: function(version) {
      var current = [version.major, version.minor, version.patch].join('.');
      var required = '>= 1.6.0';
      if (!semver.satisfies(current, required)) {
        halt();
        grunt.log.writeln();
        grunt.log.errorlns(
          'In order for this task to work properly, PhantomJS version ' +
          required + ' must be installed, but version ' + current +
          ' was detected.'
        );
        grunt.warn('The correct version of PhantomJS needs to be installed.', 127);
      }
    }
  };