From dfa6a4977de37352094e4ebb8d65f7ca2c263c31 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sat, 29 Apr 2017 16:26:09 -0400 Subject: [PATCH] Improve init command (#155) * [init] Remove no longer necesary variable phpCheckFileDisplay * [init] Add chain and sites copy question. * [init] Rename language keys --- src/Command/CheckCommand.php | 8 +------- src/Command/InitCommand.php | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/Command/CheckCommand.php b/src/Command/CheckCommand.php index aab2f3844..a8c041d14 100644 --- a/src/Command/CheckCommand.php +++ b/src/Command/CheckCommand.php @@ -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); } diff --git a/src/Command/InitCommand.php b/src/Command/InitCommand.php index 4df95bc21..4933cf35e 100644 --- a/src/Command/InitCommand.php +++ b/src/Command/InitCommand.php @@ -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 @@ -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( @@ -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) {