Skip to content

Commit

Permalink
[console] Update configuration file paths. (#3657)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmolivas authored Jan 8, 2018
1 parent 7af7c4b commit 6c809c5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 42 deletions.
34 changes: 3 additions & 31 deletions src/Command/ServerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 1;
}

$router = $this->getRouterPath();
$router = $this->configurationManager
->getVendorCoreDirectory() . 'router.php';

$processBuilder = new ProcessBuilder([$binary, '-S', $address, $router]);
$processBuilder->setTimeout(null);
$processBuilder->setWorkingDirectory($this->appRoot);
Expand Down Expand Up @@ -114,36 +116,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 0;
}

/**
* @return null|string
*/
private function getRouterPath()
{
$routerPath = [
sprintf(
'%s/.console/router.php',
$this->configurationManager->getHomeDirectory()
),
sprintf(
'%s/console/router.php',
$this->configurationManager->getApplicationDirectory()
),
sprintf(
'%s/%s/config/dist/router.php',
$this->configurationManager->getApplicationDirectory(),
DRUPAL_CONSOLE_CORE
)
];

foreach ($routerPath as $router) {
if (file_exists($router)) {
return $router;
}
}

return null;
}

/**
* @param string $address
* @return string
Expand Down
13 changes: 2 additions & 11 deletions src/Command/Site/ModeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,17 +237,8 @@ protected function processServicesFile($environment, $servicesSettings, DrupalSt

protected function loadConfigurations($env)
{
$configFile = sprintf(
'%s/.console/site.mode.yml',
$this->configurationManager->getHomeDirectory()
);

if (!file_exists($configFile)) {
$configFile = sprintf(
'%s/config/dist/site.mode.yml',
$this->configurationManager->getApplicationDirectory() . DRUPAL_CONSOLE_CORE
);
}
$configFile = $this->configurationManager
->getVendorCoreDirectory() . 'site.mode.yml';

$siteModeConfiguration = Yaml::parse(file_get_contents($configFile));
$configKeys = array_keys($siteModeConfiguration);
Expand Down

0 comments on commit 6c809c5

Please sign in to comment.