exclude the ignored directories and files.

@param AssetInterface $asset_holder
515133
private function excludeThis(AssetInterface $asset_holder)
    {
        // add or ignore hidden directories
        $this->ignoreDotFiles($asset_holder->getExcludeHidden());

        // exclude ignored files
        foreach ($asset_holder->getExcludedFiles() as $name) {
            $this->notName($name);
        }

        // exclude files (if exist) with this extensions
        $excluded_extensions = $asset_holder->getExcludedExtensions();
        if (!empty($excluded_extensions)) {
            foreach ($asset_holder->getExcludedExtensions() as $extension) {
                $this->notName('*'.$extension);
            }
        }

        // exclude the regex pattern
        foreach ($asset_holder->getExcludedPatterns() as $pattern) {
            $this->notName($pattern);
        }
    }
399127
def exclude_paths(root, patterns, dockerfile=None):
    

    if dockerfile is None:
        dockerfile = 'Dockerfile'

    patterns.append('!' + dockerfile)
    pm = PatternMatcher(patterns)
    return set(pm.walk(root))
1129152
def _GetIgnoredDirs(self):
    
    goodlogging.Log.Info("CLEAR", "Loading ignored directories from database:")
    goodlogging.Log.IncreaseIndent()
    ignoredDirs = self._db.GetIgnoredDirs()

    if ignoredDirs is None:
      goodlogging.Log.Info("CLEAR", "No ignored directories exist in database")
      ignoredDirs = self._UserUpdateIgnoredDirs()
    else:
      goodlogging.Log.Info("CLEAR", "Got ignored directories from database: {0}".format(ignoredDirs))

    if self._archiveDir not in ignoredDirs:
      ignoredDirs.append(self._archiveDir)

    goodlogging.Log.Info("CLEAR", "Using ignored directories: {0}".format(ignoredDirs))
    goodlogging.Log.DecreaseIndent()
    return ignoredDirs
936818
public function onBeforeDelete()
    {
        $currentVersion = $this->owner->CurrentVersion();

        // make sure there actually is a current version, otherwise we're going
        // to end up deleting a bunch of incorrect stuff!
        if ($currentVersion && $currentVersion->ID > 0) {
            $folder = dirname($this->owner->CurrentVersion()->getFullPath());

            if ($versions = $this->owner->Versions()) {
                foreach ($versions as $version) {
                    $version->delete();
                }
            }

            if (is_dir($folder)) {
                Filesystem::removeFolder($folder);
            }

            // If the _versions folder is now empty - because there are no other versions of any assets - then we can
            // delete the _versions folder
            $folder = dirname($folder); // We want the parent of $folder, as we just deleted $folder
            if (is_dir($folder)) {
                $dir = opendir($folder);
                $foundOtherFile = false;

                while ($file = readdir($dir)) {
                    if (($file == '.' || $file == '..')) {
                        continue;
                    }
                    $foundOtherFile = true;
                }

                if (!$foundOtherFile) {
                    // No other files found, so we can delete the _versions folder
                    rmdir($folder);
                }
            }
        }
    }
1306581
public function setFilters($path, AssetInterface $asset)
    {
        $filters = $this->getFilters($path, $asset);

        foreach ($filters as $filter) {
            $this->setFilter($filter, $asset);
        }
    }
323440
public function filterLoad(AssetInterface $asset)
    {
        $max_nesting_level = ini_get('xdebug.max_nesting_level');

        $memory_limit = ini_get('memory_limit');

        if ($max_nesting_level && $max_nesting_level < 200) {
            ini_set('xdebug.max_nesting_level', 200);
        }

        if ($memory_limit && $memory_limit < 256) {
            ini_set('memory_limit', '256M');
        }

        $root = $asset->getSourceRoot();
        $path = $asset->getSourcePath();

        $dirs = array();

        $lc = new \Less_Parser(array(
            'compress' => true,
        ));

        if ($root && $path) {
            $dirs[] = dirname($root.'/'.$path);
        }

        foreach ($this->loadPaths as $loadPath) {
            $dirs[] = $loadPath;
        }

        $lc->SetImportDirs($dirs);

        $url = parse_url($this->getRequest()->getUriForPath(''));

        // Strip the document root from the path.
        if (strpos($root, app('path.public')) !== false) {
            $absolutePath = str_replace(app('path.public'), '', $root);
        } elseif (strpos($root, app('path.resources')) !== false) {
            $absolutePath = str_replace(app('path.resources'), '', $root);
        }

        if (isset($url['path'])) {
            $absolutePath = $url['path'] . $absolutePath;
        }

        $lc->parseFile($root.'/'.$path, $absolutePath);

        $asset->setContent($lc->getCss());
    }
50621
public function dirRemove()
    {
        $paths = $this->getPaths();
        $filesystem = $this->getFilesystem();
        $this->info('Removing artifact directories');
        $filesystem->remove([
            $paths['coverage'],
            $paths['reports']
        ]);
        $this->info('Artifact directories removed');
    }
1317599
protected function deleteIgnoredFiles()
    {
        if ($this->ignore) {
            foreach ($this->phpci->ignore as $file) {
                $cmd = 'rm -Rf "%s/%s"';
                if (IS_WIN) {
                    $cmd = 'rmdir /S /Q "%s\%s"';
                }
                $this->phpci->executeCommand($cmd, $this->directory, $file);
            }
        }
    }
1327266
protected function deleteMatchingFiles($wildcard, $ignored = null)
    {
        if (is_array($files = $this->files->glob($wildcard)))
        {
            foreach ($files as $path)
            {
                if ( ! is_null($ignored))
                {
                    // Spin through each of the ignored assets and if the current file path ends
                    // with any of the ignored asset paths then we'll skip this asset as it
                    // needs to be kept.
                    foreach ((array) $ignored as $ignore)
                    {
                        if (ends_with($path, $ignore)) continue 2;
                    }
                }

                $this->files->delete($path);
            }
        }
        
    }
624028
public function emptyCompileDir()
    {
        $this->console("Deleting compiled assets");
        $dir = $this->compilePath() . $this->prefix();
        if (is_dir($dir)) {
            Rails\Toolbox\FileTools::emptyDir($dir);
        }
    }
171044
public function filterLoad(AssetInterface $asset)
    {
        static $format = <<<'EOF'
#!/usr/bin/env ruby

require %s
%s
options = { :load_path    => [],
            :source_files => [%s],
            :expand_paths => false }

%ssecretary = Sprockets::Secretary.new(options)
secretary.install_assets if options[:asset_root]
print secretary.concatenation

EOF;

        $more = '';

        foreach ($this->includeDirs as $directory) {
            $more .= 'options[:load_path] << '.var_export($directory, true)."\n";
        }

        if (null !== $this->assetRoot) {
            $more .= 'options[:asset_root] = '.var_export($this->assetRoot, true)."\n";
        }

        if ($more) {
            $more .= "\n";
        }

        $tmpAsset = tempnam(sys_get_temp_dir(), 'assetic_sprockets');
        file_put_contents($tmpAsset, $asset->getContent());

        $input = tempnam(sys_get_temp_dir(), 'assetic_sprockets');
        file_put_contents($input, sprintf($format,
            $this->sprocketsLib
                ? sprintf('File.join(%s, \'sprockets\')', var_export($this->sprocketsLib, true))
                : '\'sprockets\'',
            $this->getHack($asset),
            var_export($tmpAsset, true),
            $more
        ));

        $pb = $this->createProcessBuilder(array(
            $this->rubyBin,
            $input,
        ));

        $proc = $pb->getProcess();
        $code = $proc->run();
        unlink($tmpAsset);
        unlink($input);

        if (0 !== $code) {
            throw FilterException::fromProcess($proc)->setInput($asset->getContent());
        }

        $asset->setContent($proc->getOutput());
    }
405767
def exclude_data_files(self, package, src_dir, files):
        """'"""
        files = list(files)
        patterns = self._get_platform_patterns(
            self.exclude_package_data,
            package,
            src_dir,
        )
        match_groups = (
            fnmatch.filter(files, pattern)
            for pattern in patterns
        )
        # flatten the groups of matches into an iterable of matches
        matches = itertools.chain.from_iterable(match_groups)
        bad = set(matches)
        keepers = (
            fn
            for fn in files
            if fn not in bad
        )
        # ditch dupes
        return list(_unique_everseen(keepers))
87226
protected function removeFilesAndDirectories()
    {
        $this->laravel['files']->deleteDirectory(config('lia.directory'));
        $this->laravel['files']->deleteDirectory(public_path('vendor/lia/'));
        $this->laravel['files']->delete(config_path('lia.php'));
        $this->laravel['files']->delete(config_path('terminal.php'));
    }
871648
public function copyStaticFiles()
    {
        $exclude = ['js', 'javascripts', 'stylesheets', 'less', 'sass'];

        // Include the excludes from the config
        $exclude = array_merge($exclude, (array) $this->app->getSetting('exclude', []));

        // Create pattern
        $pattern = '/\\.(' . implode("|", $exclude) . ')$/';

        // Get list of files & directories to copy
        $to_copy = (array) $this->app->getSetting('copy', []);

        // Assets folder is hardcoded into copy
        $to_copy = array_merge(['assets'], $to_copy);
        $to_copy = array_unique($to_copy);

        // Initialize file system
        $filesystem = new Filesystem();

        // Fire event
        if ($response = Event::fire('copy.before', [$this, $to_copy])) {
            $to_copy = $response[0];
        }

        // Copy
        foreach ($to_copy as $location)
        {
            $fileInfo = new \SplFileInfo($this->source . DIRECTORY_SEPARATOR . $location);

            // Copy a complete directory
            if ($fileInfo->isDir())
            {
                $finder = new Finder();
                $finder->files()
                    ->exclude($exclude)
                    ->notName($pattern)
                    ->in($this->source . DIRECTORY_SEPARATOR . $location);

                foreach ($finder as $file)
                {
                    $path = $location . DIRECTORY_SEPARATOR . $file->getRelativePathname();
                    echo "$path\n";
                    $source = $file->getRealPath();
                    $target = $this->target . DIRECTORY_SEPARATOR . $path;

                    $filesystem->copy($source, $target);

                    $this->app->writeln("Copied: <info>$path</info>");
                }
            }

            // Copy Single File
            else {
                $filesystem->copy($fileInfo->getRealPath(), $this->target . DIRECTORY_SEPARATOR . $location);
                $this->app->writeln("Copied: <info>$location</info>");
            }
        }
    }
860789
public function cleanArchives($projectRoot, $maxAge = null, $keepMax = 10, $quiet = true)
    {
        return $this->cleanDirectory(
            $projectRoot . '/' . $this->config->get('local.archive_dir'),
            $maxAge,
            $keepMax,
            [],
            $quiet
        );
    }
1206649
function _pauseAssetGeneration(id) {
        if (_waitingDocuments.hasOwnProperty(id)) {
            _canceledDocuments[id] = true;
        } else if (_assetManagers.hasOwnProperty(id)) {
            _assetManagers[id].stop();
        }
    }
116890
def remove_excluded_files(files)
      return files if @exclude.empty?
      files.reject do |file|
        @exclude.any? { |exclude| File.fnmatch(exclude, file) }
      end
    end