lib/hooks.js
function validate(task, options) {
    if (!task) {
      if (options.verbose) {
        console.log('  -', chalk.bold.yellow('[WARNING]:'), 'Task does not exist');
      }

      return Promise.resolve(false);
    }

    return new Promise(function(resolve, reject) {
      var hooks = task.hooks(options) || {};

      if (hooks.validate) {
        var result = hooks.validate();

        if (isPromise(result)) {
          result.then(function(result) {
            resolve(result !== false); // undefined should represent truthy
          });
        } else {
          resolve(result);
        }
      } else {
        resolve(true);
      }
    });
  }
function validate(task, options) {
    if (!task) {
      if (options.verbose) {
        console.log('  -', chalk.bold.yellow('[WARNING]:'), 'Task does not exist');
      }

      return Promise.resolve(false);
    }

    return new Promise(function(resolve, reject) {
      var hooks = task.hooks(options) || {};

      if (hooks.validate) {
        var result = hooks.validate();

        if (isPromise(result)) {
          result.then(function(result) {
            resolve(result !== false); // undefined should represent truthy
          });
        } else {
          resolve(result);
        }
      } else {
        resolve(true);
      }
    });
  }
function validate ( task , options ) { if ( ! task ) { if ( options . verbose ) { console . log ( '  -' , chalk . bold . yellow ( '[WARNING]:' ) , 'Task does not exist' ) ; } return Promise . resolve ( false ) ; } return new Promise ( function ( resolve , reject ) { var hooks = task . hooks ( options ) || { } ; if ( hooks . validate ) { var result = hooks . validate ( ) ; if ( isPromise ( result ) ) { result . then ( function ( result ) { resolve ( result !== false ) ; // undefined should represent truthy } ) ; } else { resolve ( result ) ; } } else { resolve ( true ) ; } } ) ; }
Hook executed before task is run.

Validate whether or not the task should be run. Should return `true` or `false` to indicate whether or not to run the task.
Can also return a bluebird promise that resolves with the value of `true` or `false`.

@name validate
@param {object} task - The task object.
@param {object} [options] - Options passed to the task runner. Uses options.verbose.
@return {bluebird promise} - Resolves with `true` if the task validation succeeds, or `false` if the task validation fails.
Hook executed before task is run .