src/Robo/Commands/Deploy/DeployCommand.php
protected function sanitize() {
    $this->say("Sanitizing artifact...");

    $this->logger->info("Find Drupal core text files...");
    $sanitizeFinder = Finder::create()
      ->files()
      ->name('*.txt')
      ->notName('LICENSE.txt')
      ->in("{$this->deployDir}/docroot/core");

    $this->logger->info('Find VCS directories...');
    $vcsFinder = Finder::create()
      ->ignoreDotFiles(FALSE)
      ->ignoreVCS(FALSE)
      ->directories()
      ->in(["{$this->deployDir}/docroot", "{$this->deployDir}/vendor"])
      ->name('.git');
    if ($vcsFinder->hasResults()) {
      $sanitizeFinder->append($vcsFinder);
    }

    $this->logger->info("Find Github directories...");
    $githubFinder = Finder::create()
      ->ignoreDotFiles(FALSE)
      ->directories()
      ->in(["{$this->deployDir}/docroot", "{$this->deployDir}/vendor"])
      ->name('.github');
    if ($githubFinder->hasResults()) {
      $sanitizeFinder->append($githubFinder);
    }

    $this->logger->info('Find INSTALL database text files...');
    $dbInstallFinder = Finder::create()
      ->files()
      ->in(["{$this->deployDir}/docroot"])
      ->name('/INSTALL\.[a-z]+\.(md|txt)$/');
    if ($dbInstallFinder->hasResults()) {
      $sanitizeFinder->append($dbInstallFinder);
    }

    $this->logger->info('Find other common text files...');
    $filenames = [
      'AUTHORS',
      'CHANGELOG',
      'CONDUCT',
      'CONTRIBUTING',
      'INSTALL',
      'MAINTAINERS',
      'PATCHES',
      'TESTING',
      'UPDATE',
    ];
    $textFileFinder = Finder::create()
      ->files()
      ->in(["{$this->deployDir}/docroot"])
      ->name('/(' . implode('|', $filenames) . ')\.(md|txt)$/');
    if ($textFileFinder->hasResults()) {
      $sanitizeFinder->append($textFileFinder);
    }

    $this->logger->info("Remove sanitized files from build...");
    $taskFilesystemStack = $this->taskFilesystemStack()
      ->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE);
    foreach ($sanitizeFinder->getIterator() as $fileInfo) {
      $taskFilesystemStack->remove($fileInfo->getRealPath());
    }
    $taskFilesystemStack->run();
  }
protected function sanitize() {
    $this->say("Sanitizing artifact...");

    $this->logger->info("Find Drupal core text files...");
    $sanitizeFinder = Finder::create()
      ->files()
      ->name('*.txt')
      ->notName('LICENSE.txt')
      ->in("{$this->deployDir}/docroot/core");

    $this->logger->info('Find VCS directories...');
    $vcsFinder = Finder::create()
      ->ignoreDotFiles(FALSE)
      ->ignoreVCS(FALSE)
      ->directories()
      ->in(["{$this->deployDir}/docroot", "{$this->deployDir}/vendor"])
      ->name('.git');
    if ($vcsFinder->hasResults()) {
      $sanitizeFinder->append($vcsFinder);
    }

    $this->logger->info("Find Github directories...");
    $githubFinder = Finder::create()
      ->ignoreDotFiles(FALSE)
      ->directories()
      ->in(["{$this->deployDir}/docroot", "{$this->deployDir}/vendor"])
      ->name('.github');
    if ($githubFinder->hasResults()) {
      $sanitizeFinder->append($githubFinder);
    }

    $this->logger->info('Find INSTALL database text files...');
    $dbInstallFinder = Finder::create()
      ->files()
      ->in(["{$this->deployDir}/docroot"])
      ->name('/INSTALL\.[a-z]+\.(md|txt)$/');
    if ($dbInstallFinder->hasResults()) {
      $sanitizeFinder->append($dbInstallFinder);
    }

    $this->logger->info('Find other common text files...');
    $filenames = [
      'AUTHORS',
      'CHANGELOG',
      'CONDUCT',
      'CONTRIBUTING',
      'INSTALL',
      'MAINTAINERS',
      'PATCHES',
      'TESTING',
      'UPDATE',
    ];
    $textFileFinder = Finder::create()
      ->files()
      ->in(["{$this->deployDir}/docroot"])
      ->name('/(' . implode('|', $filenames) . ')\.(md|txt)$/');
    if ($textFileFinder->hasResults()) {
      $sanitizeFinder->append($textFileFinder);
    }

    $this->logger->info("Remove sanitized files from build...");
    $taskFilesystemStack = $this->taskFilesystemStack()
      ->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE);
    foreach ($sanitizeFinder->getIterator() as $fileInfo) {
      $taskFilesystemStack->remove($fileInfo->getRealPath());
    }
    $taskFilesystemStack->run();
  }
protected function sanitize ( ) { $ this -> say ( "Sanitizing artifact..." ) ; $ this -> logger -> info ( "Find Drupal core text files..." ) ; $ sanitizeFinder = Finder :: create ( ) -> files ( ) -> name ( '*.txt' ) -> notName ( 'LICENSE.txt' ) -> in ( "{$this->deployDir}/docroot/core" ) ; $ this -> logger -> info ( 'Find VCS directories...' ) ; $ vcsFinder = Finder :: create ( ) -> ignoreDotFiles ( FALSE ) -> ignoreVCS ( FALSE ) -> directories ( ) -> in ( [ "{$this->deployDir}/docroot" , "{$this->deployDir}/vendor" ] ) -> name ( '.git' ) ; if ( $ vcsFinder -> hasResults ( ) ) { $ sanitizeFinder -> append ( $ vcsFinder ) ; } $ this -> logger -> info ( "Find Github directories..." ) ; $ githubFinder = Finder :: create ( ) -> ignoreDotFiles ( FALSE ) -> directories ( ) -> in ( [ "{$this->deployDir}/docroot" , "{$this->deployDir}/vendor" ] ) -> name ( '.github' ) ; if ( $ githubFinder -> hasResults ( ) ) { $ sanitizeFinder -> append ( $ githubFinder ) ; } $ this -> logger -> info ( 'Find INSTALL database text files...' ) ; $ dbInstallFinder = Finder :: create ( ) -> files ( ) -> in ( [ "{$this->deployDir}/docroot" ] ) -> name ( '/INSTALL\.[a-z]+\.(md|txt)$/' ) ; if ( $ dbInstallFinder -> hasResults ( ) ) { $ sanitizeFinder -> append ( $ dbInstallFinder ) ; } $ this -> logger -> info ( 'Find other common text files...' ) ; $ filenames = [ 'AUTHORS' , 'CHANGELOG' , 'CONDUCT' , 'CONTRIBUTING' , 'INSTALL' , 'MAINTAINERS' , 'PATCHES' , 'TESTING' , 'UPDATE' , ] ; $ textFileFinder = Finder :: create ( ) -> files ( ) -> in ( [ "{$this->deployDir}/docroot" ] ) -> name ( '/(' . implode ( '|' , $ filenames ) . ')\.(md|txt)$/' ) ; if ( $ textFileFinder -> hasResults ( ) ) { $ sanitizeFinder -> append ( $ textFileFinder ) ; } $ this -> logger -> info ( "Remove sanitized files from build..." ) ; $ taskFilesystemStack = $ this -> taskFilesystemStack ( ) -> setVerbosityThreshold ( VerbosityThresholdInterface :: VERBOSITY_VERBOSE ) ; foreach ( $ sanitizeFinder -> getIterator ( ) as $ fileInfo ) { $ taskFilesystemStack -> remove ( $ fileInfo -> getRealPath ( ) ) ; } $ taskFilesystemStack -> run ( ) ; }
Removes sensitive files from the deploy dir.
Removes sensitive files from the deploy dir .