Exemplo n.º 1
0
 /**
  * create directories operation
  *
  * @param array|string directory path
  */
 function run($dirs)
 {
     foreach ((array) $dirs as $dir) {
         $this->logAction('create', $dir);
         Helper::mktree($dir);
     }
 }
Exemplo n.º 2
0
 function execute()
 {
     $logger = $this->getLogger();
     $path = Path::get_home_flavor_path();
     $logger->info("Creating {$path} ...");
     Helper::mktree($path);
     $logger->info("Creating flavors/...");
     Helper::mktree('flavors');
     $logger->info("Done");
 }
Exemplo n.º 3
0
 /**
  * Recursive directory copy operation
  *
  * @param string $from related path from Resource Dir
  * @param string $to related path of target
  */
 public function run($from, $to)
 {
     $resDir = $this->getResourceDir();
     $from = realpath($from) ?: $resDir . DIRECTORY_SEPARATOR . $from;
     // $from = realpath($from) ?: $from;
     $to = realpath($to) ?: $to;
     $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($from), RecursiveIteratorIterator::SELF_FIRST);
     foreach ($iterator as $path) {
         $target = $to . substr($path, strlen($from));
         if ($path->isDir()) {
             $this->logAction('copy', Helper::short_path($target));
             Helper::mktree($target);
         } else {
             $this->logAction('copy', Helper::short_path($target));
             Helper::copy($path, $target);
         }
     }
 }
Exemplo n.º 4
0
 function installFlavor($flavor)
 {
     if (isset($this->installed[$flavor->getName()])) {
         return;
     }
     $logger = $this->getLogger();
     $homePath = Path::get_home_flavor_path();
     Helper::mktree($homePath);
     $logger->info("Installing " . $flavor->getName() . "...");
     Helper::copy_dir($flavor->__toString(), $homePath . DIRECTORY_SEPARATOR . $flavor->getName(), function ($target) use($logger) {
         $logger->info("Installing " . $target, 1);
     });
     // get dependencies
     $generator = $flavor->getGenerator();
     $depGenerators = $generator->getDependencies();
     foreach ($depGenerators as $depGenerator) {
         $this->installFlavor($depGenerator->getFlavor());
     }
 }