vendors.php 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/usr/bin/env php
  2. <?php
  3. /*
  4. * This file is part of the Symfony framework.
  5. *
  6. * (c) Fabien Potencier <fabien@symfony.com>
  7. *
  8. * For the full copyright and license information, please view the LICENSE
  9. * file that was distributed with this source code.
  10. */
  11. /*
  12. CAUTION: This file installs the dependencies needed to run the Symfony2 test suite.
  13. If you want to create a new project, download the Symfony Standard Edition instead:
  14. http://symfony.com/download
  15. */
  16. set_time_limit(0);
  17. if (!is_dir($vendorDir = dirname(__FILE__).'/vendor')) {
  18. mkdir($vendorDir, 0777, true);
  19. }
  20. // optional transport change
  21. $transport = false;
  22. if (isset($argv[1]) && in_array($argv[1], array('--transport=http', '--transport=https', '--transport=git'))) {
  23. $transport = preg_replace('/^--transport=(.*)$/', '$1', $argv[1]);
  24. }
  25. $deps = array(
  26. array('doctrine', 'http://github.com/doctrine/doctrine2.git', '2.1.5'),
  27. array('doctrine-dbal', 'http://github.com/doctrine/dbal.git', '2.1.5'),
  28. array('doctrine-common', 'http://github.com/doctrine/common.git', '2.1.4'),
  29. array('monolog', 'http://github.com/Seldaek/monolog.git', '1.0.2'),
  30. array('swiftmailer', 'http://github.com/swiftmailer/swiftmailer.git', 'v4.1.4'),
  31. array('twig', 'http://github.com/fabpot/Twig.git', 'v1.4.0'),
  32. );
  33. foreach ($deps as $dep) {
  34. list($name, $url, $rev) = $dep;
  35. if ($transport) {
  36. $url = preg_replace('/^(http:|https:|git:)(.*)/', $transport . ':$2', $url);
  37. }
  38. echo "> Installing/Updating $name\n";
  39. $installDir = $vendorDir.'/'.$name;
  40. if (!is_dir($installDir)) {
  41. system(sprintf('git clone %s %s', escapeshellarg($url), escapeshellarg($installDir)));
  42. }
  43. system(sprintf('cd %s && git fetch origin && git reset --hard %s', escapeshellarg($installDir), escapeshellarg($rev)));
  44. }