Copy the report assets to the report dir, ignoring inline assets

@param {Object} opts Report options
171409
function copyAssets({ assetsDir }) {
  if (_shouldCopyAssets(assetsDir)) {
    fs.copySync(distDir, assetsDir, {
      filter: src => !/inline/.test(src)
    });
  }
}
846036
function exportArchiveToFilesystem (opts, cb) {
  return maybe(cb, async function () {
    assert(opts && typeof opts === 'object', 'opts object is required')

    // core arguments, dstPath and srcArchive
    var srcArchive = opts.srcArchive
    var dstPath = opts.dstPath
    assert(srcArchive && typeof srcArchive === 'object', 'srcArchive is required')
    assert(dstPath && typeof dstPath === 'string', 'dstPath is required')

    // options
    var srcPath = typeof opts.srcPath === 'string' ? opts.srcPath : '/'
    var overwriteExisting = opts.overwriteExisting === true
    var skipUndownloadedFiles = opts.skipUndownloadedFiles === true
    var ignore = Array.isArray(opts.ignore) ? opts.ignore : DEFAULT_IGNORE

    // abort if nonempty and not overwriting existing
    if (!overwriteExisting) {
      let files
      try {
        files = await fse.readdir(dstPath)
      } catch (e) {
        // target probably doesnt exist, continue and let ensureDirectory handle it
      }
      if (files && files.length > 0) {
        throw new DestDirectoryNotEmpty()
      }
    }

    const statThenExport = async function (srcPath, dstPath) {
      // apply ignore filter
      if (ignore && match(ignore, srcPath)) {
        return
      }

      // export by type
      var srcStat = await stat(srcArchive, srcPath)
      if (srcStat.isFile()) {
        await exportFile(srcPath, srcStat, dstPath)
      } else if (srcStat.isDirectory()) {
        await exportDirectory(srcPath, dstPath)
      }
    }

    const exportFile = async function (srcPath, srcStat, dstPath) {
      // skip undownloaded files
      if (skipUndownloadedFiles && srcStat.downloaded < srcStat.blocks) {
        return
      }

      // fetch dest stats
      var dstFileStats = null
      try {
        dstFileStats = await fse.stat(dstPath)
      } catch (e) {}

      // track the stats
      stats.fileCount++
      stats.totalSize += srcStat.size || 0
      if (dstFileStats) {
        if (dstFileStats.isDirectory()) {
          // delete the directory-tree
          await fse.remove(dstPath)
          stats.addedFiles.push(dstPath)
        } else {
          stats.updatedFiles.push(dstPath)
        }
      } else {
        stats.addedFiles.push(dstPath)
      }

      // write the file
      return new Promise((resolve, reject) => {
        pump(
          srcArchive.createReadStream(srcPath),
          fse.createWriteStream(dstPath),
          err => {
            if (err) reject(err)
            else resolve()
          }
        )
      })
    }

    const exportDirectory = async function (srcPath, dstPath) {
      // make sure the destination folder exists
      await fse.ensureDir(dstPath)

      // list the directory
      var fileNames = await readdir(srcArchive, srcPath)

      // recurse into each
      var promises = fileNames.map(name => {
        return statThenExport(path.join(srcPath, name), path.join(dstPath, name))
      })
      await Promise.all(promises)
    }

    // recursively export
    var stats = { addedFiles: [], updatedFiles: [], skipCount: 0, fileCount: 0, totalSize: 0 }
    await statThenExport(srcPath, dstPath)
    return stats
  })
}
1287852
function copyFile(assetPath, dest, hexFolder) {

      // Copy the asset file to the hashed folder and store the mapping.
      var relativeAssetPath = stripPrefixAndNormalise(assetPath, options.srcBasePath),
          hashDir  = path.join(dest, path.dirname(relativeAssetPath), hexFolder),
          destPath = path.join(hashDir, path.basename(assetPath));

      if (options.hashType === 'file') {
        var ext = path.extname(assetPath),
            hashedFilename = path.basename(assetPath, ext) + '.' + hexFolder + ext;
        hashDir  = path.join(dest, path.dirname(relativeAssetPath));
        destPath = path.join(hashDir, hashedFilename);
      }

      var relativeDestPath = stripPrefixAndNormalise(destPath, options.destBasePath);

      grunt.file.copy(assetPath, destPath);
      assetFileMapping[relativeAssetPath] = relativeDestPath;
      grunt.log.writeln('Copied asset: ' + assetPath + ' -> ' + destPath);

      // Copy the source map file to the same hashed folder.
      var sourceMapPath = sourceMaps[assetPath];
      if (sourceMapPath) {
        var destSourceMapPath = path.join(hashDir, path.basename(sourceMapPath)),
            relativeSourceMapPath = stripPrefixAndNormalise(sourceMapPath, options.srcBasePath),
            relativeDestSourceMapPath = stripPrefixAndNormalise(destSourceMapPath, options.destBasePath);

        grunt.file.copy(sourceMapPath, destSourceMapPath);
        sourceFileMapping[relativeSourceMapPath] = relativeDestSourceMapPath;
        grunt.log.writeln('Copied source map: ' + destSourceMapPath);
      }

      if (Object.keys(assetFileMapping).length === numSourceFiles) {
        writeMappingFile();
        renameReferences();
        done();
      }
    }
589369
function (opts) {
            var self = this;
            opts.meta.modules = [];
            opts.meta.allModules = [];
            Y.each(this.data.modules, function (v) {
                if (v.external) {
                    return;
                }
                opts.meta.allModules.push({
                    displayName: v.displayName || v.name,
                    name: self.filterFileName(v.name),
                    description: v.description
                });
                if (!v.is_submodule) {
                    var o = {
                        displayName: v.displayName || v.name,
                        name: self.filterFileName(v.name)
                    };
                    if (v.submodules) {
                        o.submodules = [];
                        Y.each(v.submodules, function (i, k) {
                            var moddef = self.data.modules[k];
                            if (moddef) {
                                o.submodules.push({
                                    displayName: k,
                                    description: moddef.description
                                });
                                // } else {
                                //     Y.log('Submodule data missing: ' + k + ' for ' + v.name, 'warn', 'builder');
                            }
                        });
                        o.submodules.sort(self.nameSort);
                    }
                    opts.meta.modules.push(o);
                }
            });
            opts.meta.modules.sort(this.nameSort);
            opts.meta.allModules.sort(this.nameSort);
            return opts;
        }
106349
def copy_file_tree(src: str,
                   dest: str,
                   ctx: Optional[Dict[str, Any]] = None,
                   option_locations: Optional[List[Tuple[str, List[str]]]] = None):
    
    if os.path.exists(dest):
        shutil.rmtree(dest, ignore_errors=True)
    shutil.copytree(src, dest)

    if option_locations:
        for option, paths in option_locations:
            for path in paths:
                path = os.path.join(dest, path)
                if os.path.isfile(path):
                    os.remove(path)
                else:
                    shutil.rmtree(path, ignore_errors=True)

    if 'app_bundle_module_name' in ctx:
        shutil.move(os.path.join(dest, 'app'),
                    os.path.join(dest, ctx['app_bundle_module_name']))
        shutil.move(os.path.join(dest, 'tests', 'app'),
                    os.path.join(dest, 'tests', ctx['app_bundle_module_name']))

    _render_file_tree(dest, ctx)
487747
function saveFiles(path, opts, obj, cb) {
  const noDot = opts.noDot
  var root  = ''

  walk.walk(path, walkFn, function (err) {
    if (err) cb(err)
    cb(null, obj)
  })

  function walkFn(baseDir, filename, stat, next) {
    if (!root) root = baseDir
    baseDir = stripLeadingSlash(baseDir.split(root)[1])

    if (stat.isDirectory()) return next()
    if (noDot) {
      if (/^\./.test(filename)) return next()
    }
    pushArr(baseDir, obj, filename)
    next()
  }
}
788071
function mergeDefaultOptions(opts) {
    const copy = {};
    copyKeys(copy, _defaultOptions);
    copyKeys(copy, opts);
    Object.keys(_defaultOptions).forEach((key) => {
        const obj = _defaultOptions[key];
        if (typeof obj === 'object') {
            const objCopy = {};
            copyKeys(objCopy, obj);
            copyKeys(objCopy, copy[key]);
            copy[key] = objCopy;
        }
    });
    return copy;
}
823726
function Service(opts) {
  _.extend(this,
    {
      description: '',
      utils: require('./utils'),
      logger: require('./logger')
    },
    require('./config')(),
    opts
  );

  // scoped modules contain a '/' (@foo/bar).
  // this causes problems when generating logs/scripts
  // on some platforms.
  this.name = this.name.replace('/', '_');

  // run the script within its ndm
  // node_modules directory.
  this.workingDirectory = this._workingDirectory();

  this.logFile = this.utils.resolve(
    this.logsDirectory,
    this.name + '.log'
  );

  this._copyFieldsFromPackageJson(); // try to grab some sane defaults from package.json.
}
1291682
function normalizePaths(opts) {
  for (var srcKey in opts.src) {
    if (!path.isAbsolute(opts.src[srcKey].glob)) {
      opts.src[srcKey].glob = path.resolve(opts.src[srcKey].glob);
    }
    if (!path.isAbsolute(opts.src[srcKey].basedir)) {
      opts.src[srcKey].basedir = path.resolve(opts.src[srcKey].basedir);
    }
  }
}
65633
function getOptions(opts) {
  const mergedOptions = getMergedOptions(opts || {});

  // For saving JSON from mochawesome reporter
  if (mergedOptions.saveJson) {
    mergedOptions.jsonFile = `${getFilename(mergedOptions)}.json`;
  }

  mergedOptions.htmlFile = `${getFilename(mergedOptions)}.html`;
  return mergedOptions;
}
1031274
def add_html_report_optgroup(parser):
    

    g = parser.add_argument_group("HTML Report Options")

    g.add_argument("--html-stylesheet", action="append",
                   dest="html_stylesheets", default=list())

    g.add_argument("--html-javascript", action="append",
                   dest="html_javascripts", default=list())

    g.add_argument("--html-copy-data", action="store", default=None,
                   help="Copy default resources to the given directory and"
                   " enable them in the template")
280773
function(compose, project, opts) {

    // Default options
    // NOTE: background=true causes rm to be ignored
    // So we are setting mode to default to collect on win32
    var defaults = {
      environment: [],
      noDeps: false,
      rm: true,
      background: (process.platform === 'win32') ? true : false,
      cmd: ''
    };

    // Get opts
    var options = (opts) ? _.merge(defaults, opts) : defaults;

    // Get whether we want to attach/collect or not
    var mode = (options.background) ? false : (opts.mode || false);

    // Execute
    return shCompose(
      buildCmd(compose, project, 'run', options),
      {
        app: opts.app,
        mode: mode
      }
    );

  }
1226017
function opts(options){

  options.documentSize = options.documentSize || "A4";
  options.landscape  = options.landscape || "portrait";
  options.orientation  = options.orientation || "portrait";
  options.type = options.type || "base64";
  options.fileName  = options.fileName || "default.pdf";
  options.baseUrl = options.baseUrl || null;

  return options;
}
697689
function (opts) {
            var self = this;
            opts.meta.files = [];
            Y.each(this.data.files, function (v) {
                if (v.external) {
                    return;
                }
                opts.meta.files.push({
                    displayName: v.name,
                    name: self.filterFileName(v.name),
                    path: v.path || v.name
                });
            });

            var tree = {};
            var files = [];
            Y.each(this.data.files, function (v) {
                if (v.external) {
                    return;
                }
                files.push(v.name);
            });
            files.sort();
            Y.each(files, function (v) {
                var p = v.split('/'),
                    par;
                p.forEach(function (i, k) {
                    if (!par) {
                        if (!tree[i]) {
                            tree[i] = {};
                        }
                        par = tree[i];
                    } else {
                        if (!par[i]) {
                            par[i] = {};
                        }
                        if (k + 1 === p.length) {
                            par[i] = {
                                path: v,
                                name: self.filterFileName(v)
                            };
                        }
                        par = par[i];
                    }
                });
            });

            opts.meta.fileTree = tree;

            return opts;
        }
98519
function rename(opts) {
    opts = opts || {};

    return through.obj(function (file, enc, cb) {
        file.path = opts.path;
        cb(null, file);
    });
}
1186560
function (opts) {
  var paths = es.through();
  var files = es.through();
  
  paths.pipe(es.writeArray(function (err, srcs) {
    gulp.src(srcs, opts).pipe(files);
  }));
  
  return es.duplex(paths, files);
}
806146
function(sourceDir, newDirLocation, opts) {

        if (!opts || !opts.preserve) {
            try {
                if(fs.statSync(newDirLocation).isDirectory()) {
                    exports.rmdirSyncRecursive(newDirLocation);
                }
            }
            catch(e) { }
        }

        /*  Create the directory where all our junk is moving to; read the mode of the source directory and mirror it */
        var checkDir = fs.statSync(sourceDir);
        try {
            fs.mkdirSync(newDirLocation, checkDir.mode);
        }
        catch (e) {
            //if the directory already exists, that's okay
            if (e.code !== 'EEXIST') {
                throw e;
            }
        }

        var files = fs.readdirSync(sourceDir);

        for(var i = 0; i < files.length; i++) {
            var currFile = fs.lstatSync(sourceDir + "/" + files[i]);

            if(currFile.isDirectory()) {
                /*  recursion this thing right on back. */
                copyDirectoryRecursiveSync(sourceDir + "/" + files[i], newDirLocation + "/" + files[i], opts);
            }
            else if(currFile.isSymbolicLink()) {
                var symlinkFull = fs.readlinkSync(sourceDir + "/" + files[i]);
                fs.symlinkSync(symlinkFull, newDirLocation + "/" + files[i]);
            }
            else {
                /*  At this point, we've hit a file actually worth copying... so copy it on over. */
                var contents = fs.readFileSync(sourceDir + "/" + files[i]);
                fs.writeFileSync(newDirLocation + "/" + files[i], contents);
            }
        }
    }