Glob source dir

@param {String} source
@param {Function} fn
434534
function find(source, fn) {
  glob('**', {cwd: source, dot: true}, function(err, files) {
    fn(err, files);
  });
}
1367987
function globWithPromsie(pattern) {
  return new Promise((resolve, reject) => {
    glob(pattern, function(err, files) {
      if (err) {
        reject(err);
      }

      if (files.length === 0) {
        console.warn('pattern "' + pattern + '" does not match any file');
      }

      resolve(files);
    });
  });
}
918381
def glob(self):
		
		matches = []
		for root, dirnames, filenames in os.walk(self.path):
			if not self.recursive:
				while len(dirnames) > 0:
					dirnames.pop()
			for include in self.include:
				for filename in fnmatch.filter(filenames, include):
					matches.append(os.path.join(root, filename))
		return matches
56159
function lintAllFiles (src, options)
{
    glob(src,
        function (err, files)
        {
            if (err) throw err;

            for (var i = 0, l = files.length; i < l; i++)
            {
                jsHintHelper.lintFile(files[i], options.rules);
            }
        }
    );
}
1144647
def Glob(self, pathname, ondisk=True, source=True, strings=False, exclude=None, cwd=None):
        
        if cwd is None:
            cwd = self.getcwd()
        return cwd.glob(pathname, ondisk, source, strings, exclude)
990449
function outputPath(options, source) {
    var DEBUG = false;
    if (DEBUG)
        console.log('sourceFolder: ' + options.sourceFolder);
    var globBase = options.sourceFolder.replace(/\*.*/, '');
    if (globBase.endsWith('.sol')) // single file
        globBase = path.join(globBase, '../');
    if (DEBUG)
        console.log('globBase: ' + globBase);
    var optDestination = options.destinationFolder ? options.destinationFolder : globBase;
    if (DEBUG)
        console.log('optDestination: ' + optDestination);
    var destinationFolder = path.join(globBase, optDestination);
    if (optDestination === globBase)
        destinationFolder = globBase;
    if (DEBUG)
        console.log('destinationFolder: ' + destinationFolder);
    // destination-folder is absolut
    if (options.destinationFolder && options.destinationFolder.startsWith('/'))
        destinationFolder = path.join(options.destinationFolder, './');
    var fileNameRelative = source.filename.replace(globBase, '');
    if (DEBUG)
        console.log('fileNameRelative: ' + fileNameRelative);
    var goalPath = path.join(destinationFolder, fileNameRelative);
    return goalPath;
}
485744
function findCoverageFile (source, filename) {
  for (var i = 0; i < source.length; i++) {
    var file = source[i]
    if (file.filename === filename) {
      return file
    }
  }
  return null
}
756282
function (basedir, filefn, dirfn) {
        filefn = filefn || function() {};
        dirfn = dirfn || function() {};

        var readdirSync = function(dir) {
            var files = fs.readdirSync(dir);

            for (var i = 0; i < files.length; i++) {
                var file = dir+'/'+files[i];
                //debug('before fs.statsSync:', file);
                var stats = fs.statSync(file);

                if (stats.isFile()) {
                var prefix = dir.replace(basedir, '');
                    filefn(prefix, dir, files[i], stats);

                } else if (stats.isDirectory()) {
                    var prefix = file.replace(basedir, '');
                    dirfn(prefix, stats);
                    readdirSync(file);

                } else {
                    console.error('error:'.error, 'It is a file type that is not assumed. file:', file);
                    return;
                }
            }
        };
        readdirSync(basedir);
    }
902230
function(callback) {
      fs.exists(options.source, function(exists) {
        if(!exists) { callback(new Error('Source file do not exists!')); }
        else { callback(null, true); }
      });
    }
1012380
function absolutizePaths(
  config /*: stylelint$config*/,
  configDir /*: string*/
) /*: stylelint$config*/ {
  if (config.ignoreFiles) {
    config.ignoreFiles = [].concat(config.ignoreFiles).map(glob => {
      if (path.isAbsolute(glob.replace(/^!/, ""))) return glob;

      return globjoin(configDir, glob);
    });
  }

  if (config.plugins) {
    config.plugins = [].concat(config.plugins).map(lookup => {
      return getModulePath(configDir, lookup);
    });
  }

  if (config.processors) {
    config.processors = absolutizeProcessors(config.processors, configDir);
  }

  return config;
}
860461
function _relativeCopy(fileGlob, from, to) {
  return new Promise((resolve, reject) => {
    glob(
      fileGlob,
      {
        cwd: from,
        nodir: true,
      },
      (err, files) => {
        if (err) reject(err);
        files.forEach(file => {
          const origin = path.join(from, file);
          const dest = path.join(to, file);
          const data = fs.readFileSync(origin, 'utf-8');
          _recursiveMkDir(path.dirname(dest));
          fs.writeFileSync(dest, data);
          resolve();
        });
      },
    );
  });
}
83824
function ls (onEnd) {
  const FN      = require('fstream-npm')
  const color   = require('chalk')
  const glob    = require('glob')
  const exclude = require('lodash.difference')

  const included = [ ]

  const all = glob.sync('**/**', { ignore : [ 'node_modules/**/**' ], nodir : true })

  FN({ path: process.cwd() })
    .on('child', function (e) {
      included.push(e._path.replace(e.root.path + '/', ''))
    })
    .on('end', function () {
      const excluded = exclude(all, included)

      console.info(color.magenta('\n\nWILL BE PUBLISHED\n'))
      console.info(color.green(included.join('\n')))
      console.info(color.magenta('\n\nWON\'T BE PUBLISHED\n'))
      console.info(color.red(excluded.join('\n')))
      console.info('\n\nYou can use .npmignore and the "files" field of package.json to manage these files.')
      console.info('See https://docs.npmjs.com/misc/developers#keeping-files-out-of-your-package\n')

      if (typeof onEnd === 'function') {
        onEnd({
          included : included,
          excluded : excluded
        })
      }
    })
}
1050636
function find(input, options, callback) {
  expand(input, options, done)

  function done(error, result) {
    /* istanbul ignore if - glob errors are unusual.
     * other errors are on the vfile results. */
    if (error) {
      callback(error)
    } else {
      callback(null, {oneFileMode: oneFileMode(result), files: result.output})
    }
  }
}
1235015
function(root, dirs, fn) {

    if(dirs.length > 0) {

        var dir = NX.Path.normalize(root + '/' + dirs.join('/') + '/');
        var file = dir + 'extent.action.js';

        NX.Path.exists(file, function(exists) {

            if(!exists) {
                dirs.pop();
                checkExtentActionFile(root, dirs, fn);
            } else {
                fn({
                    type: 'extent',
                    path: file
                });
            }

        });

    } else {
        fn();
    }

}
1156191
function gulpReplaceRef(opts) {

    opts = opts || {};

    var stream;

    // Creating a stream through which each file will pass
    stream = through.obj(function (srcFile, enc, callback) {
        var self = this;
        if (srcFile.isNull()) {
            self.push(srcFile); // Do nothing if no contents
            return callback();
        }

        if (srcFile.isBuffer()) {

            var strToReplace = srcFile.path.match( opts.srcMatch )[0], stream, targetMatch = opts.targetMatch;

            vfs.src(opts.target).pipe(es.map(function(phpFile, cb){
                //console.log(phpFile.path);
                var content = phpFile.contents.toString();
                if(targetMatch(srcFile.path).test(content)){
                    fs.writeFile(phpFile.path, content.replace(targetMatch(srcFile.path), strToReplace));
                    console.log('php file updated: ' + phpFile.path);
                }

                cb(null, phpFile);
            }));


            self.push(srcFile);
            return callback();
        }

        if (srcFile.isStream()) {
            this.emit('error', new PluginError(PLUGIN_NAME, 'Streams are not supported!'));
            return callback();
        }
    });

    // returning the file stream
    return stream;
}
1007877
function expandGlobs(main, cwd) {
  if (!main) { return; }
  // expand each glob in main (coerce it to array first)
  var globs = [].concat(main).map(function(pattern) {
    return glob.sync(pattern, {cwd: cwd});
  });
  // flatten globs to single array
  return [].concat.apply([], globs);
}
444098
function convertGlobPaths(globs) {
  return globs
    .map(globString => glob.sync(globString))
    .reduce((previous, current) => previous.concat(current), []);
}