tasks/auto_install.js
function(dir) {
      var results = [];

      var list = fs.readdirSync(dir);

      list.forEach(function(file) {
        // Check for every given pattern, regardless of whether it is an array or a string
        var matchesSomeExclude = [].concat(options.exclude).some(function(regexp) {
          return file.match(regexp) != null;
        });

        if(!matchesSomeExclude) {
          var matchesSomePattern = [].concat(options.match).some(function(regexp) {
            return file.match(regexp) != null;
          });

          file = path.resolve(dir, file);
          var stat = fs.statSync(file);

          if (stat && stat.isDirectory()) {
            if(matchesSomePattern) {
              results = results.concat(file);
            }
            results = results.concat(walk(file));
          }
        }
      });

      return results;
    }
function(dir) {
      var results = [];

      var list = fs.readdirSync(dir);

      list.forEach(function(file) {
        // Check for every given pattern, regardless of whether it is an array or a string
        var matchesSomeExclude = [].concat(options.exclude).some(function(regexp) {
          return file.match(regexp) != null;
        });

        if(!matchesSomeExclude) {
          var matchesSomePattern = [].concat(options.match).some(function(regexp) {
            return file.match(regexp) != null;
          });

          file = path.resolve(dir, file);
          var stat = fs.statSync(file);

          if (stat && stat.isDirectory()) {
            if(matchesSomePattern) {
              results = results.concat(file);
            }
            results = results.concat(walk(file));
          }
        }
      });

      return results;
    }
function ( dir ) { var results = [ ] ; var list = fs . readdirSync ( dir ) ; list . forEach ( function ( file ) { // Check for every given pattern, regardless of whether it is an array or a string var matchesSomeExclude = [ ] . concat ( options . exclude ) . some ( function ( regexp ) { return file . match ( regexp ) != null ; } ) ; if ( ! matchesSomeExclude ) { var matchesSomePattern = [ ] . concat ( options . match ) . some ( function ( regexp ) { return file . match ( regexp ) != null ; } ) ; file = path . resolve ( dir , file ) ; var stat = fs . statSync ( file ) ; if ( stat && stat . isDirectory ( ) ) { if ( matchesSomePattern ) { results = results . concat ( file ) ; } results = results . concat ( walk ( file ) ) ; } } } ) ; return results ; }
Synchronously walks the directory
and returns an array of every subdirectory that
matches the patterns, and doesn't match any exclude pattern
Synchronously walks the directory and returns an array of every subdirectory that matches the patterns and doesn t match any exclude pattern