#!/usr/bin/env php * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ $rootDir = dirname(__DIR__); $vendorDir = $rootDir.'/vendor'; array_shift($argv); if (!isset($argv[0])) { die(<< Installing/Updating $name\n"; if (!is_dir($installDir)) { system(sprintf('git clone %s "%s"', $url, $installDir)); } system(sprintf('cd "%s" && git fetch origin && git reset --hard %s', $installDir, $rev)); } // update? if ('update' === $command) { $deps = array(); foreach (file($rootDir.'/deps') as $line) { if (!trim($line)) { continue; } $parts = array_values(array_filter(explode(' ', trim($line)))); if (3 !== count($parts)) { die(sprintf('The deps file is not valid (near "%s")', $line)); } list($name, $path, $url) = $parts; ob_start(); system('cd "'.$vendorDir.'/'.$path.'/'.$name.'"; git log -n 1 --format=%H'); $deps[] = trim($name.' '.ob_get_clean()); } file_put_contents($rootDir.'/deps.lock', implode("\n", $deps)); } // php on windows can't use the shebang line from system() $interpreter = PHP_OS == 'WINNT' ? 'php.exe' : ''; // Update the bootstrap files system(sprintf('%s "%s/bin/build_bootstrap"', $interpreter, $rootDir)); // Update assets system(sprintf('%s "%s/app/console" assets:install "%s/web/"', $interpreter, $rootDir, $rootDir)); // Remove the cache system(sprintf('%s "%s/app/console" cache:clear --no-warmup', $interpreter, $rootDir));