Skip to content

Commit

Permalink
[console] Create default directories. Fix #220. (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmolivas committed Sep 2, 2017
1 parent 46d2472 commit 45637cf
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Command/InitCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Process\ProcessBuilder;
use Symfony\Component\Finder\Finder;
use Drupal\Console\Core\Utils\ConfigurationManager;
Expand Down Expand Up @@ -59,6 +60,11 @@ class InitCommand extends Command
'generate_chain' => false
];

private $directories = [
'chain',
'sites',
];

/**
* InitCommand constructor.
*
Expand Down Expand Up @@ -229,6 +235,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
$destinationFile
);

$fs = new Filesystem();
foreach ($this->directories as $directory) {
if (!$fs->exists($destination.$directory)) {
$fs->mkdir($destination.$directory);
}
}

if ($this->copyFile($sourceFile, $destinationFile, $override)) {
$copiedFiles[] = $destinationFile;
}
Expand Down

0 comments on commit 45637cf

Please sign in to comment.