Beispiel #1
0
 public function setUpServer()
 {
     try {
         $root = __DIR__ . '/../../';
         if (Plateform::isPhar()) {
             $root = Plateform::getPharPath() . '/';
         }
         $this->fileSystem->copy($root . 'res/router.php', $this->getPath() . '/.phpoole/router.php', true);
         $this->fileSystem->copy($root . 'res/livereload.js', $this->getPath() . '/.phpoole/livereload.js', true);
         $this->fileSystem->dumpFile($this->getPath() . '/.phpoole/baseurl', $this->getPHPoole()->getOption('site.baseurl'));
     } catch (IOExceptionInterface $e) {
         echo 'An error occurred while copying file at ' . $e->getPath() . PHP_EOL;
         echo $e->getMessage() . PHP_EOL;
         exit(2);
     }
     if (!is_file(sprintf('%s/.phpoole/router.php', $this->getPath()))) {
         $this->wlError('Router not found');
         exit(2);
     }
 }
Beispiel #2
0
 public function processCommand()
 {
     $this->force = $this->getRoute()->getMatchedParam('force', false);
     $this->wlAnnonce('Creates a new website...');
     try {
         $fileSystem = new Filesystem();
         $root = __DIR__ . '/../../';
         if (Plateform::isPhar()) {
             $root = Plateform::getPharPath() . '/';
         }
         if (!$fileSystem->exists($this->getPath() . '/' . self::CONFIG_FILE) || $this->force) {
             $fileSystem->copy($root . 'skeleton/phpoole.yml', $this->getPath() . '/' . self::CONFIG_FILE, true);
             $fileSystem->mirror($root . 'skeleton/content', $this->getPath() . '/content');
             $fileSystem->mirror($root . 'skeleton/layouts', $this->getPath() . '/layouts');
             $fileSystem->mirror($root . 'skeleton/static', $this->getPath() . '/static');
             $this->wlDone('Done!');
             exit(0);
         }
         $this->wlAlert(sprintf('File "%s" already exists.', $this->getPath() . '/' . self::CONFIG_FILE));
         exit(1);
     } catch (\Exception $e) {
         $this->wlError($e->getMessage());
     }
 }