diff --git a/system/src/Grav/Console/InstallCommand.php b/system/src/Grav/Console/InstallCommand.php
index 561aa695c..d45bab6a9 100644
--- a/system/src/Grav/Console/InstallCommand.php
+++ b/system/src/Grav/Console/InstallCommand.php
@@ -11,7 +11,8 @@ use \Symfony\Component\Yaml\Yaml;
class InstallCommand extends Command {
- protected $configuration;
+ protected $config;
+ protected $local_config;
protected function configure() {
$this
@@ -30,7 +31,7 @@ class InstallCommand extends Command {
{
$dependencies_file = USER_DIR . '/.dependencies';
-
+ $local_config_file = exec('eval echo ~/.grav/config');
// Create a red output option
$output->getFormatter()->setStyle('red', new OutputFormatterStyle('red'));
@@ -38,8 +39,16 @@ class InstallCommand extends Command {
$output->getFormatter()->setStyle('green', new OutputFormatterStyle('green'));
$output->getFormatter()->setStyle('magenta', new OutputFormatterStyle('magenta'));
+ if (file_exists($local_config_file)) {
+ $this->local_config = Yaml::parse($local_config_file);
+ $output->writeln('');
+ $output->writeln('read local config from ' . $local_config_file . '');
+ }
+
+
+
if (is_file($dependencies_file)) {
- $this->configuration = Yaml::parse($dependencies_file);
+ $this->config = Yaml::parse($dependencies_file);
if (!$input->getOption('symlink')) {
$this->gitclone($output);
@@ -64,7 +73,7 @@ class InstallCommand extends Command {
$output->writeln('');
exec('cd ' . ROOT_DIR);
- foreach($this->configuration['git'] as $repo => $data) {
+ foreach($this->config['git'] as $repo => $data) {
if (!file_exists($data['path'])) {
exec('git clone -b ' . $data['branch'] . ' ' . $data['url'] . ' ' . $data['path']);
$output->writeln('SUCCESS cloned ' . $data['url'] . ' -> ' . $data['path'] . '');
@@ -85,16 +94,28 @@ class InstallCommand extends Command {
$output->writeln('===============');
$output->writeln('');
+ if (!$this->local_config) {
+ $output->writeln('No local configuration available, aborting...');
+ $output->writeln('');
+ exit;
+ }
+
exec('cd ' . ROOT_DIR);
- foreach($this->configuration['links'] as $repo => $data) {
- if (!file_exists($data['path'])) {
- $from = ROOT_DIR . $data['src'];
- $to = ROOT_DIR . $data['path'];
- symlink ($from, $to);
- $output->writeln('SUCCESS symlinked ' . $data['src'] . ' -> ' . $data['path'] . '');
- $output->writeln('');
+ foreach($this->config['links'] as $repo => $data) {
+ $from = $this->local_config[$data['scm'].'_repos'] . $data['src'];
+ $to = ROOT_DIR . $data['path'];
+
+ if (file_exists($from)) {
+ if (!file_exists($to)) {
+ symlink ($from, $to);
+ $output->writeln('SUCCESS symlinked ' . $data['src'] . ' -> ' . $data['path'] . '');
+ $output->writeln('');
+ } else {
+ $output->writeln('destination: ' . $to . ' already exists, skipping...');
+ $output->writeln('');
+ }
} else {
- $output->writeln('' . $data['path'] . ' already exists, skipping...');
+ $output->writeln('source: ' . $from . ' does not exists, skipping...');
$output->writeln('');
}
diff --git a/user/.dependencies b/user/.dependencies
index 3a89a1014..bedd0a5d2 100644
--- a/user/.dependencies
+++ b/user/.dependencies
@@ -13,11 +13,14 @@ git:
branch: develop
links:
problems:
- src: ../grav-plugin-problems
+ src: grav-plugin-problems
path: user/plugins/problems
+ scm: github
error:
- src: ../grav-plugin-error
+ src: grav-plugin-error
path: user/plugins/error
+ scm: github
antimatter:
- src: ../grav-theme-antimatter
+ src: grav-theme-antimatter
path: user/themes/antimatter
+ scm: github