Skip to content

Commit

Permalink
Trying to fixes #33.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudLigny committed Jun 11, 2016
1 parent 2c3aab9 commit 8ef6891
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
22 changes: 16 additions & 6 deletions src/Command/NewWebsite.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,22 @@ public function processCommand()
try {
$fs = new FS();
if (!$fs->exists($this->getPath().'/'.self::CONFIG_FILE) || $this->force) {
$fs->copy(__DIR__.'/../../skeleton/phpoole.yml', $this->getPath().'/'.self::CONFIG_FILE, true);
$fs->mirror(__DIR__.'/../../skeleton/content', $this->getPath().'/content');
$fs->mirror(__DIR__.'/../../skeleton/layouts', $this->getPath().'/layouts');
$fs->mirror(__DIR__.'/../../skeleton/static', $this->getPath().'/static');
$fs->mirror(__DIR__.'/../../skeleton/themes', $this->getPath().'/themes');

if (!empty(\Phar::running())) {
$phar = new \Phar(\Phar::running());
$phar->extractTo($this->getPath(), [
'skeleton/phpoole.yml',
'skeleton/content/',
'skeleton/layouts/',
'skeleton/static/',
'skeleton/themes/',
], true);
} else {
$fs->copy(__DIR__.'/../../skeleton/phpoole.yml', $this->getPath().'/'.self::CONFIG_FILE, true);
$fs->mirror(__DIR__.'/../../skeleton/content', $this->getPath().'/content');
$fs->mirror(__DIR__.'/../../skeleton/layouts', $this->getPath().'/layouts');
$fs->mirror(__DIR__.'/../../skeleton/static', $this->getPath().'/static');
$fs->mirror(__DIR__.'/../../skeleton/themes', $this->getPath().'/themes');
}
$this->wlDone('Done!');
} else {
$this->wlAlert(sprintf('File "%s" already exists.', $this->getPath().'/'.self::CONFIG_FILE));
Expand Down
12 changes: 10 additions & 2 deletions src/Command/Serve.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,16 @@ public function processCommand()

try {
$fs = new FS();
$fs->copy(__DIR__.'/../../skeleton/.router.php', $this->getPath().'/.router.php', true);
$fs->copy(__DIR__.'/../../skeleton/.watch.js', $this->getPath().'/.watch.js');
if (!empty(\Phar::running())) {
$phar = new \Phar(\Phar::running());
$phar->extractTo($this->getPath(), [
'skeleton/.router.php',
'skeleton/.watch.js',
], true);
} else {
$fs->copy(__DIR__.'/../../skeleton/.router.php', $this->getPath().'/.router.php', true);
$fs->copy(__DIR__.'/../../skeleton/.watch.js', $this->getPath().'/.watch.js', true);
}
$fs->dumpFile($this->getPath().'/.baseurl', $this->getPHPoole()->getOption('site.baseurl'));
} catch (IOExceptionInterface $e) {
echo 'An error occurred while copying file at '.$e->getPath();
Expand Down

0 comments on commit 8ef6891

Please sign in to comment.