示例#1
0
 private function finalizePackage($package)
 {
     $fs = new FileSystem();
     $base = $this->getPackageBasePath($package);
     $fs->ensureDirectoryExists("{$base}/css");
     $compiler = new \lessc();
     $compiler->compileFile("{$base}/less/tiki.less", "{$base}/css/{$base}.css");
     // Clean-up undesired files
     $fs->remove("{$base}/dist");
     $fs->remove("{$base}/docs");
     $fs->remove("{$base}/grunt");
     $fs->remove("{$base}/js");
     $fs->remove("{$base}/test-infra");
 }
 /**
  * Restore previously backed up paths.
  *
  * @see PathPreserver::backupSubpaths()
  */
 public function rollback()
 {
     if (empty($this->backups)) {
         return;
     }
     foreach ($this->backups as $original => $backup_location) {
         // Remove any code that was placed by the package at the place of
         // the original path.
         if (static::file_exists($original)) {
             if (is_dir($original)) {
                 $this->filesystem->emptyDirectory($original, false);
                 $this->filesystem->removeDirectory($original);
             } else {
                 $this->filesystem->remove($original);
             }
             $this->io->write(sprintf('<comment>Files of installed package were overwritten with preserved path %s!</comment>', $original), true);
         }
         $folder = dirname($original);
         $this->filesystem->ensureDirectoryExists($folder);
         // Make sure we can write the file to the folder.
         $this->makePathWritable($folder);
         $this->filesystem->rename($backup_location, $original);
         if ($this->filesystem->isDirEmpty(dirname($backup_location))) {
             $this->filesystem->removeDirectory(dirname($backup_location));
         }
     }
     // Restore all path permissions, that where set for the sake of moving
     // things around.
     $this->restorePathPermissions();
     // With a clean array, we can start over.
     $this->backups = array();
 }
示例#3
0
 private static function removeMultiple($base, array $files)
 {
     $fs = new FileSystem();
     foreach ($files as $file) {
         $path = $base . '/' . $file;
         if (file_exists($path) || is_dir($path)) {
             $fs->remove($path);
         }
     }
 }