PageRenderTime 35ms CodeModel.GetById 9ms RepoModel.GetById 0ms app.codeStats 0ms

/tests/vendor.php

https://github.com/bforchhammer/bnetlib
PHP | 41 lines | 21 code | 6 blank | 14 comment | 3 complexity | 87c116d991f76578f61dbee29b7d9d6a MD5 | raw file
  1. #!/usr/bin/env php
  2. <?php
  3. /**
  4. * This file is part of the bnetlib Library.
  5. * Copyright (c) 2012 Eric Boh <cossish@gmail.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code. You can also view the
  9. * LICENSE file online at http://coss.github.com/bnetlib/license.html
  10. *
  11. * @copyright 2012 Eric Boh <cossish@gmail.com>
  12. * @license http://coss.gitbub.com/bnetlib/license.html MIT License
  13. */
  14. set_time_limit(0);
  15. $return = 0;
  16. $dir = __DIR__ . '/vendor/';
  17. $vendors = array(
  18. // array('Aura HTTP Component', 'Aura/Http', 'git://github.com/auraphp/Aura.Http.git'),
  19. array('Buzz Library', 'Buzz', 'git://github.com/kriswallsmith/Buzz.git'),
  20. // array('CheddarGetter Library', 'CheddarGetter', 'git://github.com/marcguyer/cheddargetter-client-php.git'),
  21. array('Zend Framework 2', 'ZendFramework', 'git://github.com/zendframework/zf2.git'),
  22. );
  23. foreach ($vendors as $vendor) {
  24. $fullDir = $dir . $vendor[1];
  25. if (!is_dir($fullDir)) {
  26. printf('Installing %s...' . PHP_EOL, $vendor[0]);
  27. system(sprintf('git clone -q %s %s', $vendor[2], escapeshellarg($fullDir)), $return);
  28. } else {
  29. printf('Updating %s...' . PHP_EOL, $vendor[0]);
  30. system(sprintf('cd %s && git fetch -q origin && git reset --hard origin/master', escapeshellarg($fullDir)), $return);
  31. }
  32. if ($return > 0) {
  33. exit($return);
  34. }
  35. }