Exemple #1
0
 private function updateProject()
 {
     list($in, $out) = $this->getPaths();
     $this->autoloadPlugins($in);
     ob_start();
     $this->out($this->getHeader());
     $this->out("Starting static site compilation.\n");
     $proceed = true;
     if (!is_dir($in)) {
         $this->out(self::STATUS_FAIL . "Source directory '{$in}' not found.");
         $proceed = false;
     } else {
         $this->out(self::STATUS_OK . "Source directory located: {$in}");
     }
     if (!is_dir($out)) {
         $this->out(self::STATUS_FAIL . "Destination directory '{$out}' not found.");
         $proceed = false;
     } else {
         $this->out(self::STATUS_OK . "Destination directory located: {$out}");
     }
     if ($proceed === false) {
         $this->out($this->getFooter());
         return;
     }
     $site = new Site($in, $out);
     $site->setOutputter($this->getOutputter())->compile();
     $this->out($this->getFooter());
     ob_end_clean();
 }
 public function testSiteCompilationProjectGuess()
 {
     $path = $this->getMockProjectPath();
     $in = $path . '.phrekyll/';
     // will guess that
     $out = $path . 'public/';
     $site = new Site($path, $out);
     $outputter = new TestOutputter($this);
     // sanity checks
     $this->assertFileNotExists($out . '2011-02-24-default-site.html');
     $this->assertFileNotExists($out . 'media/img/test.png');
     $site->setOutputter($outputter)->compile();
     // It may be enough here to simply test that no Exception is thrown
     // Still... TESTS TESTS TESTS
     // test existence of generated files
     $this->assertFileExists($out . '2011-02-24-default-site.html', "Process Twig files into HTML files");
     $this->assertFileExists($out . 'media/img/test.png', "Copy files in media folder");
     // test copy integrity
     $this->assertFileEquals($in . 'media/img/test.png', $out . 'media/img/test.png', "Fully copy file contents");
     // test processor renderers
     $this->assertFileEquals($path . 'expected/2011-02-24-default-site.html', $out . '2011-02-24-default-site.html', "Compile Twig files as expected");
 }