vendors.php 792 B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env php
  2. <?php
  3. set_time_limit(0);
  4. $vendorDir = __DIR__.'/../../vendor';
  5. if (!is_dir($vendorDir)) {
  6. mkdir($vendorDir);
  7. }
  8. $deps = array(
  9. array('symfony', 'git://github.com/symfony/symfony.git', isset($_SERVER['SYMFONY_VERSION']) ? $_SERVER['SYMFONY_VERSION'] : 'origin/master'),
  10. array('knpmenu', 'git://github.com/knplabs/KnpMenu.git', 'origin/master')
  11. );
  12. foreach ($deps as $dep) {
  13. list($name, $url, $rev) = $dep;
  14. echo "> Installing/Updating $name\n";
  15. $installDir = $vendorDir.'/'.$name;
  16. if (!is_dir($installDir)) {
  17. system(sprintf('git clone --quiet %s %s', escapeshellarg($url), escapeshellarg($installDir)));
  18. }
  19. system(sprintf('cd %s && git fetch origin && git reset --hard %s', escapeshellarg($installDir), escapeshellarg($rev)));
  20. }