diff --git a/user/.dependencies b/.dependencies similarity index 100% rename from user/.dependencies rename to .dependencies diff --git a/system/src/Grav/Console/InstallCommand.php b/system/src/Grav/Console/InstallCommand.php index d45bab6a9..6b33d8a4c 100644 --- a/system/src/Grav/Console/InstallCommand.php +++ b/system/src/Grav/Console/InstallCommand.php @@ -30,7 +30,7 @@ class InstallCommand extends Command { protected function execute(InputInterface $input, OutputInterface $output) { - $dependencies_file = USER_DIR . '/.dependencies'; + $dependencies_file = '.dependencies'; $local_config_file = exec('eval echo ~/.grav/config'); // Create a red output option @@ -45,23 +45,27 @@ class InstallCommand extends Command { $output->writeln('read local config from ' . $local_config_file . ''); } + // Look for dependencies file in ROOT and USER dir + if (file_exists(USER_DIR . $dependencies_file)) { + $this->config = Yaml::parse(USER_DIR . $dependencies_file); + } elseif (file_exists(ROOT_DIR . $dependencies_file )) { + $this->config = Yaml::parse(ROOT_DIR . $dependencies_file); + } else { + $output->writeln('ERROR Missing .dependencies file in user/ folder'); + } - - if (is_file($dependencies_file)) { - $this->config = Yaml::parse($dependencies_file); - + // If yaml config, process + if ($this->config) { if (!$input->getOption('symlink')) { $this->gitclone($output); } else { $this->symlink($output); } } else { - $output->writeln('ERROR Missing .dependencies file in user/ folder'); + $output->writeln('ERROR invalid YAML in '. $dependencies_file); } - - } // loops over the array of paths and deletes the files/folders