From 258f55fe96b5ffc1029dfdc06550f933deab313a Mon Sep 17 00:00:00 2001 From: Djamil Legato Date: Thu, 4 Sep 2014 16:29:10 -0700 Subject: [PATCH] Vendors get now installed via composer automatically through first run of GPM or Grav cli. --- bin/grav | 7 +++++++ system/src/Grav/Console/Cli/InstallCommand.php | 7 +++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/bin/grav b/bin/grav index ea66b07df..0ac1a7429 100755 --- a/bin/grav +++ b/bin/grav @@ -5,6 +5,13 @@ if (version_compare($ver = PHP_VERSION, $req = '5.4.0', '<')) { exit(sprintf("You are running PHP %s, but Grav needs at least PHP %s to run.\n", $ver, $req)); } +if (!file_exists(__DIR__ . '/../vendor')){ + // Before we can even start, we need to run composer first + echo "Preparing to install vendor dependencies...\n\n"; + echo system('php bin/composer.phar --working-dir="'.__DIR__.'/../" --no-interaction install'); + echo "\n\n"; +} + use Symfony\Component\Console\Application; require_once(__DIR__ . '/../vendor/autoload.php'); diff --git a/system/src/Grav/Console/Cli/InstallCommand.php b/system/src/Grav/Console/Cli/InstallCommand.php index 9a3e4a62f..38664d9a3 100644 --- a/system/src/Grav/Console/Cli/InstallCommand.php +++ b/system/src/Grav/Console/Cli/InstallCommand.php @@ -54,8 +54,7 @@ class InstallCommand extends Command { 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 . ''); + $output->writeln('Read local config from ' . $local_config_file . ''); } // Look for dependencies file in ROOT and USER dir @@ -67,6 +66,10 @@ class InstallCommand extends Command { $output->writeln('ERROR Missing .dependencies file in user/ folder'); } + // Updates composer first + $output->writeln("\nInstalling vendor dependencies"); + $output->writeln(system('php bin/composer.phar --working-dir="'.$this->destination.'" --no-interaction update')); + // If yaml config, process if ($this->config) { if (!$input->getOption('symlink')) {