From e04eef6d7af9a2f3887c8fa07b46ed18e9fcbc83 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Thu, 7 Aug 2014 11:04:33 -0600 Subject: [PATCH] moved .dependencies back to root, and added support for root or user destinations --- user/.dependencies => .dependencies | 0 system/src/Grav/Console/InstallCommand.php | 20 ++++++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) rename user/.dependencies => .dependencies (100%) 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