Skip to content
Permalink
Browse files

[Settings:set] update to check first config available stating in curr…

…ent site first, added french to documentation
  • Loading branch information...
enzolutions committed May 9, 2018
1 parent eb59489 commit c62582c9f7aaf9a0fdc719b9dd1b911b224ba0d0
Showing with 27 additions and 9 deletions.
  1. +1 −1 dist/chain/update-gitbook.yml
  2. +6 −8 src/Command/Settings/SetCommand.php
  3. +20 −0 src/Utils/ConfigurationManager.php
@@ -17,7 +17,7 @@ commands:
- views
- features
- command: 'develop:translation:sync'
{% set languages = ['en', 'ca', 'es', 'hi', 'hu', 'ja', 'mr', 'pt-br', 'ro', 'ru', 'vn' , 'zh-hans'] %}
{% set languages = ['en', 'ca', 'es', 'fr', 'hi', 'hu', 'ja', 'mr', 'pt-br', 'ro', 'ru', 'vn' , 'zh-hans'] %}
{% for language in languages %}
- command: settings:set
arguments:
@@ -82,24 +82,22 @@ protected function execute(InputInterface $input, OutputInterface $output)
$settingName = $input->getArgument('name');
$settingValue = $input->getArgument('value');
$userConfigFile = sprintf(
'%s/.console/config.yml',
$this->configurationManager->getHomeDirectory()
);
// get configuration file
$configFile = $this->configurationManager->getConfigurationFile();
if (!file_exists($userConfigFile)) {
if (!file_exists($configFile)) {
$this->getIo()->error(
sprintf(
$this->trans('commands.settings.set.messages.missing-file'),
$userConfigFile
$configFile
)
);
return 1;
}
try {
$userConfigFileParsed = $parser->parse(
file_get_contents($userConfigFile)
file_get_contents($configFile)
);
} catch (\Exception $e) {
$this->getIo()->error(
@@ -151,7 +149,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
try {
file_put_contents($userConfigFile, $userConfigFileDump);
file_put_contents($configFile, $userConfigFileDump);
} catch (\Exception $e) {
$this->getIo()->error(
[
@@ -54,6 +54,7 @@ public function loadConfiguration($directory)
true
);
}
$input = new ArgvInput();
$root = $input->getParameterOption(['--root']);
if ($root && is_dir($root)) {
@@ -285,20 +286,39 @@ public function getConfigurationDirectories($includeVendorCore = false)
return [];
}
public function getConfigurationFile()
{
foreach (array_reverse($this->configurationDirectories) as $directory) {
$file = sprintf(
'%s/config.yml',
$directory
);
if (file_exists($file)) {
return $file;
}
}
return null;
}
private function addConfigurationFilesByDirectory(
$directory,
$addDirectory = false
) {
if ($addDirectory) {
$this->configurationDirectories[] = $directory;
}
$configurationFiles = [
'config' => 'config.yml',
'drush' => 'drush.yml',
'aliases' => 'aliases.yml',
'mappings' => 'mappings.yml',
'defaults' => 'defaults.yml',
];
foreach ($configurationFiles as $key => $file) {
$configFile = $directory.$file;
if (is_file($configFile)) {

0 comments on commit c62582c

Please sign in to comment.
You can’t perform that action at this time.