Conditions | 6 |
Paths | 35 |
Total Lines | 24 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
23 | public function processCommand() |
||
24 | { |
||
25 | $this->force = $this->getRoute()->getMatchedParam('force', false); |
||
26 | |||
27 | try { |
||
28 | if ($this->fs->exists($this->getPath().'/'.self::CONFIG_FILE) && !$this->force) { |
||
29 | if (!Confirm::prompt('Website already exists. Do you want to override it? [y/n]', 'y', 'n')) { |
||
30 | exit(0); |
||
31 | } |
||
32 | } |
||
33 | $root = __DIR__.'/../../'; |
||
34 | if (Plateform::isPhar()) { |
||
35 | $root = Plateform::getPharPath().'/'; |
||
36 | } |
||
37 | $this->wlAnnonce('Creating a new website...'); |
||
38 | $this->fs->copy($root.'skeleton/config.yml', $this->getPath().'/'.self::CONFIG_FILE, true); |
||
39 | $this->fs->mirror($root.'skeleton/content', $this->getPath().'/content'); |
||
40 | $this->fs->mirror($root.'skeleton/layouts', $this->getPath().'/layouts'); |
||
41 | $this->fs->mirror($root.'skeleton/static', $this->getPath().'/static'); |
||
42 | $this->wlDone('Done!'); |
||
43 | } catch (\Exception $e) { |
||
44 | throw new \Exception(sprintf($e->getMessage())); |
||
45 | } |
||
46 | } |
||
47 | } |
||
48 |