Copy asset files to the output
491574
def copy_assets(app, exception):
    
    if 'getLogger' in dir(logging):
        log = logging.getLogger(__name__).info  # pylint: disable=no-member
    else:
        log = app.info
    builders = get_compatible_builders(app)
    if exception:
        return
    if app.builder.name not in builders:
        if not app.config['sphinx_tabs_nowarn']:
            app.warn(
                'Not copying tabs assets! Not compatible with %s builder' %
                app.builder.name)
        return

    log('Copying tabs assets')

    installdir = os.path.join(app.builder.outdir, '_static', 'sphinx_tabs')

    for path in FILES:
        source = resource_filename('sphinx_tabs', path)
        dest = os.path.join(installdir, path)

        destdir = os.path.dirname(dest)
        if not os.path.exists(destdir):
            os.makedirs(destdir)

        copyfile(source, dest)
456658
def setup_output(cssd=None, jsd=None, imgd=None):
    
    # Check if we need to back up an old run
    if os.path.isdir(livvkit.index_dir):
        print("-------------------------------------------------------------------")
        print('  Previous output data found in output directory!')
        try:
            f = open(os.path.join(livvkit.index_dir, "data.txt"), "r")
            prev_time = f.readline().replace(":", "").replace("-", "").replace(" ", "_").rstrip()
            f.close()
        except IOError:
            prev_time = "bkd_"+datetime.now().strftime("%Y%m%d_%H%M%S")
        print('   Backing up data to:')
        print('   ' + livvkit.index_dir + "_" + prev_time)
        print("-------------------------------------------------------------------")
        shutil.move(livvkit.index_dir, livvkit.index_dir + "_" + prev_time)
    else:
        print("-------------------------------------------------------------------")

    # Copy over js, css, & imgs directories from source
    if cssd:
        shutil.copytree(cssd, os.path.join(livvkit.index_dir, "css"))
    else:
        shutil.copytree(os.path.join(livvkit.resource_dir, "css"),
                        os.path.join(livvkit.index_dir, "css"))
    if jsd:
        shutil.copytree(jsd, os.path.join(livvkit.index_dir, "js"))
    else:
        shutil.copytree(os.path.join(livvkit.resource_dir, "js"),
                        os.path.join(livvkit.index_dir, "js"))
    if imgd:
        shutil.copytree(imgd, os.path.join(livvkit.index_dir, "js"))
    else:
        shutil.copytree(os.path.join(livvkit.resource_dir, "imgs"),
                        os.path.join(livvkit.index_dir, "imgs"))

    # Get the index template from the resource directory
    shutil.copy(os.path.join(livvkit.resource_dir, "index.html"),
                os.path.join(livvkit.index_dir, "index.html"))
    # Record when this data was recorded so we can make nice backups
    with open(os.path.join(livvkit.index_dir, "data.txt"), "w") as f:
        f.write(livvkit.timestamp + "\n")
        f.write(livvkit.comment)
803807
protected function copyFiles()
    {
        $files = new Filesystem;
        array_map(function ($file) use ($files) {
            $files->copy("{$this->stubDirectory}/{$file}", "{$this->sageRoot}/resources/assets/{$file}");
        }, $this->getFileList());
    }
702852
def build_assets():
    """"""
    cwd = os.getcwd()
    try:
        from webassets.script import GenericArgparseImplementation
        from django_assets.env import get_env
        prog = "%s assets" % os.path.basename(sys.argv[0])
        impl = GenericArgparseImplementation(
            env=get_env(), log=LOGGER, no_global_options=True, prog=prog)
        impl.run_with_argv(["build"])
    except ImportError:
        pass
    os.chdir(cwd)
1323560
function BuildAssetsMiddleware (context)
{
  var grunt = context.grunt
    , options = context.options.assets;

  /**
   * Records which files have been already exported.
   * Prevents duplicate asset exports.
   * It's a map of absolute file names to boolean `true`.
   * @type {Object.<string,boolean>}
   */
  var exportedAssets = {};

  //--------------------------------------------------------------------------------------------------------------------
  // PUBLIC API
  //--------------------------------------------------------------------------------------------------------------------

  this.analyze = function (filesArray)
  {
    /* jshint unused: vars */
    // Do nothing
  };

  this.trace = function (module)
  {
    /* jshint unused: vars */
    // Do nothing.
  };

  this.build = function (targetScript)
  {
    if (!options.enabled) return;
    // Import file paths.
    var stylehseets = grunt.config (context.options.requiredStylesheets.exportToConfigProperty);
    if (!stylehseets) return; // No stylesheet sources are configured.
    var targetPath = path.dirname (targetScript);
    stylehseets.forEach (function (filePath)
    {
      var src = grunt.file.read (filePath);
      scan (path.dirname (filePath), targetPath, src);
    });

  };

  //--------------------------------------------------------------------------------------------------------------------
  // PRIVATE
  //--------------------------------------------------------------------------------------------------------------------

  /**
   * Scans a stylesheet for asset URL references and copies the assets to the build folder.
   * @private
   * @param {string} basePath
   * @param {string} targetPath
   * @param {string} sourceCode
   */
  function scan (basePath, targetPath, sourceCode)
  {
    var match;
    while ((match = MATCH_URLS.exec (sourceCode))) {
      var url = match[2];
      if (!url.match (/^http/i) && url[0] !== '/') { // Skip absolute URLs
        var absSrcPath = path.resolve (basePath, url)
          , absDestPath = path.resolve (targetPath, options.targetDir, url)
          , relDestPath = path.relative (targetPath, absDestPath);
        if (relDestPath[0] === '.')
          return util.warn ('Relative asset url falls outside the build folder: <cyan>%</cyan>%', url, util.NL);
        if (exportedAssets[absDestPath]) // skip already exported asset
          continue;
        else exportedAssets[absDestPath] = true;
        var absTargetFolder = path.dirname (absDestPath);
        grunt.file.mkdir (absTargetFolder);
        if (options.symlink)
          fs.symlinkSync (absSrcPath, absDestPath);
        else grunt.file.copy (absSrcPath, absDestPath);
      }
    }
  }

}
196020
public function copyAssets()
    {
        // copy ASSETS
        //$source = $this->basePath . "resources" . $this->ds . "assets";
        //$this->copyFilesFromSource($source, resource_path("assets"));

        // copy WEBPACK.js
        $base = $source = $this->basePath . "resources" . $this->ds . "assets_setup" . $this->ds;
        $source = [
            $base . "webpack.mix.js",
            $base . "package.json",
            $base . "package-lock.json",
        ];
        $this->copyFilesFromSource($source, base_path(), false);
    }
753047
public void copySingleFile(File asset) {
        try {
            if ( !asset.isDirectory() ) {
                String targetPath = config.getDestinationFolder().getCanonicalPath() + File.separatorChar + assetSubPath(asset);
                LOGGER.info("Copying single asset file to [{}]", targetPath);
                copyFile(asset, new File(targetPath));
            } else {
                LOGGER.info("Skip copying single asset file [{}]. Is a directory.", asset.getPath());
            }
        } catch (IOException io) {
            LOGGER.error("Failed to copy the asset file.", io);
        }
    }
1054879
function prepareAssets(output) {
    var book = output.getBook();
    var pages = output.getPages();
    var logger = output.getLogger();

    return Parse.listAssets(book, pages)
    .then(function(assets) {
        logger.info.ln('found', assets.size, 'asset files');

        return output.set('assets', assets);
    });
}
260008
def write_asset(environment, asset)
      filename = path_for(environment, asset)
      FileUtils.mkdir_p File.dirname(filename)
      asset.write_to filename
      asset.write_to "#{filename}.gz" if gzip?(filename)
      asset.digest
    end
1326995
def copy_assets(self, output_path):
        
        src_paths = []

        # if we have a theme
        if self.config.theme is not None:
            # assume it's in the folder: "themes/theme_name/assets"
            src_paths.append(os.path.join(
                self.path,
                StatikProject.THEMES_DIR,
                self.config.theme,
                StatikProject.ASSETS_DIR
            ))
            # NOTE: Adding the theme's assets directory *before* the project's internal assets
            #       directory always ensures that the project's own assets are copied *after* the
            #       theme's, thereby ensuring that the project's assets folder takes precedence
            #       over the theme's.

        # always attempt to copy from our base assets folder
        if os.path.isabs(self.config.assets_src_path):
            src_paths.append(self.config.assets_src_path)
        else:
            src_paths.append(os.path.join(self.path, self.config.assets_src_path))

        for src_path in src_paths:
            if os.path.exists(src_path) and os.path.isdir(src_path):
                dest_path = self.config.assets_dest_path
                if not os.path.isabs(dest_path):
                    dest_path = os.path.join(output_path, dest_path)

                asset_count = copy_tree(src_path, dest_path)
                logger.info("Copied %s asset(s) from %s to %s", asset_count, src_path, dest_path)
            else:
                logger.info(
                    "Missing assets source path - skipping copying of assets: %s",
                    src_path
                )
666913
def copy_images(from, to)
      return unless File.exist?(from)
      Dir.mkdir(to)
      ReVIEW::MakerHelper.copy_images_to_dir(from, to)
      Dir.chdir(to) do
        images = Dir.glob('**/*').find_all { |f| File.file?(f) and f =~ /\.(jpg|jpeg|png|pdf|ai|eps|tif)\z/i }
        break if images.empty?
        if @config['pdfmaker']['bbox']
          system_with_info('extractbb', '-B', @config['pdfmaker']['bbox'], *images)
          system_or_raise('ebb', '-B', @config['pdfmaker']['bbox'], *images) unless system('extractbb', '-B', @config['pdfmaker']['bbox'], '-m', *images)
        else
          system_with_info('extractbb', *images)
          system_or_raise('ebb', *images) unless system('extractbb', '-m', *images)
        end
      end
    end
1155491
function copyReadmeFiles() {

    const resolvedSrcReadmePaths = path.resolve(rootDir, srcReadmePaths);

    dryRun ? console.log(`In ${destDir}, this script would...`) : console.log(`In ${destDir}...`);

    fs.readdir('packages', (err, files) => {
        totalDocsCount = files.length;
    });

    createDirectory(destDir);
    glob(resolvedSrcReadmePaths, {realpath:true}, function(error, srcFiles) {
        
        srcFiles.forEach((srcReadmePath) => {    
            createDestReadme(srcReadmePath);
            const srcDirPath = path.dirname(srcReadmePath);
            const lastSrcDir = srcDirPath.split(path.sep).pop();
            sidebarEntries.push(`en/packages/${lastSrcDir}/index`);
        });

        console.log(chalk.green(`${updatedDocsCount} of ${totalDocsCount} package readme.md files updated`));
        updateSidebar();
       
    });

}
985126
function writeMappingFile() {
      // The full mapping combines the asset and source map files.
      var fullMapping = {};
      copyObjectProperties(assetFileMapping, fullMapping);
      copyObjectProperties(sourceFileMapping, fullMapping);

      // Sort the keys.
      var sortedMapping = {};
      var sortedAssets = Object.keys(fullMapping).sort();
      sortedAssets.forEach(function(asset) {
        // track which assets were renamed
        // for filename reference replacement
        // (eg. in CSS files referencing renamed images)
        renameInfos.push({
          from: asset,
          fromRegex: new RegExp('\\b' + asset + '\\b', 'g'),
          to: fullMapping[asset]
        });
        sortedMapping[asset] = fullMapping[asset];
      });

      if (options.assetMap) {
        grunt.file.write(options.assetMap, JSON.stringify(sortedMapping, null, 2));
        grunt.log.oklns('Asset map saved as ' + options.assetMap);
      }
    }
1202345
function copyCss() {
  return gulp.src(['./src/assets/stylesheets/*.css'], {base: './src/assets/stylesheets'})
    .pipe(gulp.dest(function (file) {
      return libraryDist + '/dist/css' + file.base.slice(__dirname.length); // save directly to dist
    }));
}
920812
protected function copyAssets()
    {
        $packagePath = $this->packagePath();

        if ($this->useWindows()) {
            $source = $packagePath."/public/assets";
        } else {
            $source = $packagePath."/public/assets/";
        }
        $destination = $this->normalizePath(public_path('assets'));
        if (! File::exists($source)) {
            File::makeDirectory($source);
        }
        if (! File::exists($destination)) {
            File::makeDirectory($destination);
        }
        $copyAssetsCommand = $this->copyCommand().' '.$this->copyOptions().' "'.$source.'" "'.$destination.'" > nul';

        shell_exec($copyAssetsCommand);
    }
96745
def build(self, input_path, output_paths):
        """"""
        for output in output_paths:
            shutil.copy(input_path, output_paths)
1316189
def compile_assets(self):
        
        try:
            # Move into client dir
            curdir = os.path.abspath(os.curdir)
            client_path = os.path.join(os.path.dirname(__file__), 'longclaw', 'client')
            os.chdir(client_path)
            subprocess.check_call(['npm', 'install'])
            subprocess.check_call(['npm', 'run', 'build'])
            os.chdir(curdir)
        except (OSError, subprocess.CalledProcessError) as err:
            print('Error compiling assets:  {}'.format(err))
            raise SystemExit(1)