Author: Victor Farazdagi
Inheritance: extends Base, implements Phrozn\Path
Exemple #1
0
 /**
  * Clobber bundle
  *
  * @return void
  */
 private function execClobber()
 {
     $pathArg = $this->getPathArgument('path', false, $this->getCommand());
     $path = new ProjectPath($pathArg);
     $bundle = $this->getBundleParam();
     $files = $this->service->getBundleFiles($bundle);
     $this->out("Located project folder: {$path->get()}\n");
     if (is_dir($path->get()) === false) {
         throw new \Exception("No project found at {$pathArg}");
     }
     $this->out('Bundle content:');
     foreach ($files as $file) {
         // Archive_Tar defines dir as typeflag 5
         if (in_array($file['typeflag'], array(5)) === false) {
             $this->out('    ' . $file['filename']);
         }
     }
     $this->out("\nBundle files are to be removed.\n" . "This operation %rCAN NOT%n be undone.\n");
     if ($this->readLine() === 'yes') {
         $this->service->setProjectPath($path)->clobberBundle($bundle);
         $this->out(self::STATUS_OK . " Done..");
     } else {
         $this->out(self::STATUS_FAIL . " Aborted..");
     }
 }
Exemple #2
0
 public function testPathNotSetException()
 {
     $this->setExpectedException('RuntimeException', 'Path not set');
     $path = new ProjectPath();
     $path->get();
 }
Exemple #3
0
 /**
  * Render view
  *
  * @param array $vars List of variables passed to text processors
  *
  * @return string
  */
 public function render($vars = array())
 {
     // inject front matter options into template
     $vars = array_merge($vars, $this->getParams());
     // inject providers content
     if ($providers = $this->getParam('page.providers', false)) {
         $factory = new ProviderFactory();
         $projectPath = new ProjectPath($this->getOutputDir());
         foreach ($providers as $varname => $data) {
             if (!isset($data['provider'])) {
                 continue;
             }
             $provider = $factory->create($data['provider'], $data);
             $provider->setProjectPath($projectPath->get());
             $providedContent = $provider->get();
             $vars['page']['providers'][$varname] = $providedContent;
             $vars['this']['providers'][$varname] = $providedContent;
         }
     }
     // convert view into static representation
     $view = $this->getTemplate();
     foreach ($this->getProcessors() as $processor) {
         $view = $processor->render($view, $vars);
     }
     return $view;
 }
Exemple #4
0
 /**
  * Set project path.
  *
  * @param string $path Project path.
  *
  * @return \Phrozn\Has\ProjectPath
  */
 public function setProjectPath($path)
 {
     if (!$path instanceof \Phrozn\Path\Project) {
         $path = new ProjectPath($path);
     }
     $this->projectPath = $path->get();
     // calculate path
     return $this;
 }