Skip to content

Commit

Permalink
Improve init command (#155)
Browse files Browse the repository at this point in the history
* [init] Remove no longer necesary variable phpCheckFileDisplay

* [init] Add chain and sites copy question.

* [init] Rename language keys
  • Loading branch information
jmolivas committed Apr 29, 2017
1 parent d0f45db commit dfa6a49
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
8 changes: 1 addition & 7 deletions src/Command/CheckCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,23 +77,17 @@ protected function execute(InputInterface $input, OutputInterface $output)
$checks = $this->requirementChecker->getCheckResult();
if (!$checks) {
$phpCheckFile = $this->configurationManager->getHomeDirectory().'/.console/phpcheck.yml';
$phpCheckFileDisplay = realpath($this->configurationManager->getHomeDirectory()).'/.console/phpcheck.yml';

if (!file_exists($phpCheckFile)) {
$phpCheckFile =
$this->configurationManager->getApplicationDirectory().
DRUPAL_CONSOLE_CORE.
'config/dist/phpcheck.yml';

$phpCheckFileDisplay =
realpath($this->configurationManager->getApplicationDirectory()).
DRUPAL_CONSOLE_CORE.
'config/dist/phpcheck.yml';
}

$io->newLine();
$io->info($this->trans('commands.check.messages.file'));
$io->comment($phpCheckFileDisplay);
$io->comment($phpCheckFile);

$checks = $this->requirementChecker->validate($phpCheckFile);
}
Expand Down
20 changes: 19 additions & 1 deletion src/Command/InitCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ class InitCommand extends Command
private $configParameters = [
'language' => 'en',
'temp' => '/tmp',
'chain' => false,
'sites' => false,
'learning' => false,
'generate_inline' => false,
'generate_chain' => false
Expand Down Expand Up @@ -146,8 +148,18 @@ protected function interact(InputInterface $input, OutputInterface $output)
);

$this->configParameters['learning'] = $io->confirm(
$this->trans('commands.init.questions.chain'),
false
);

$this->configParameters['sites'] = $io->confirm(
$this->trans('commands.init.questions.sites'),
false
);

$this->configParameters['chain'] = $io->confirm(
$this->trans('commands.init.questions.learning'),
true
false
);

$this->configParameters['generate_inline'] = $io->confirm(
Expand Down Expand Up @@ -191,6 +203,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
DRUPAL_CONSOLE_CORE
)
);
if (!$this->configParameters['chain']){
$finder->exclude('chain');
}
if (!$this->configParameters['sites']){
$finder->exclude('sites');
}
$finder->files();

foreach ($finder as $configFile) {
Expand Down

0 comments on commit dfa6a49

Please sign in to comment.