moved .dependencies back to root, and added support for root or user destinations

This commit is contained in:
Andy Miller
2014-08-07 11:04:33 -06:00
parent 96481dd25b
commit e04eef6d7a
2 changed files with 12 additions and 8 deletions

View File

@@ -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 <cyan>' . $local_config_file . '</cyan>');
}
// 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('<red>ERROR</red> Missing .dependencies file in <cyan>user/</cyan> 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('<red>ERROR</red> Missing .dependencies file in <cyan>user/</cyan> folder');
$output->writeln('<red>ERROR</red> invalid YAML in '. $dependencies_file);
}
}
// loops over the array of paths and deletes the files/folders