Ejemplo n.º 1
0
var Mount = module.exports = function(options) {
  this.options = options
  this.fds = []
  for (var i = 0; i < 10; i++) this.fds.push(null)

  this.top = new CachedDir(options.sourceDir, fs.statSync(options.sourceDir), options)
}
Ejemplo n.º 2
0
 warnings:function(info) {
     var warns = [];
     if(!('files' in info.packageJson)) {
         warns.push({warning:'lack_of_files_section_in_package_json', scoring:{mandatories:1}});
     } else {
         var detail=[];
         //console.log("info.files", Object.keys(info.files));
         //console.log("files", info.packageJson.files.join(" "));
         var qaFiles=qaControl.projectDefinition[info.packageVersion].files;
         for(var fileName in info.packageJson.files) {
             var file = info.packageJson.files[fileName];
             if(file==='package.json') { detail.push('"'+file+'" is always included by npm'); }
             if(file.match(/^(\.)/)) { detail.push('"'+file+'" is a .dot file'); }
             if(file in qaFiles) {
                 detail.push('"'+file+'" cannot be in files section');
             } else {
                 try {
                     var stat = fs.statSync(Path.resolve(info.projectDir+'/'+file));
                     if(! stat.isDirectory()) {
                         if(!(file in info.files)) { detail.push('"'+file+'" should exist'); }
                     }
                 } catch(e) { detail.push('"'+file+'" does not exists'); }
             }
         }
         if(detail.length) {
             warns.push({warning:'invalid_files_section_in_package_json', scoring:{mandatories:1}});
             if(qaControl.verbose) {
                 console.log("Invalid files:");
                 console.log("\t"+detail.join("\n\t"));
             }
         }
     }
     return warns;
 }
Ejemplo n.º 3
0
export function lookup(pathToLookup, isExecutable) {
  const iz = module.paths.length;

  for (let i = 0; i < iz; i++) {
    let absPath = path.join(module.paths[i], pathToLookup);

    if (isExecutable && process.platform === 'win32') {
      absPath += '.cmd';
    }

    try {
      const stat = fs.statSync(absPath);

      if (stat) {
        return absPath;
      }
    } catch(err) {
      continue;
    }
  }

  return '';
}
Ejemplo n.º 4
0
	var getModified = function (filename) {
		return fs.statSync(filename).mtime.getTime();
	};