phar-manifest.php 738 B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env php
  2. <?php
  3. print 'sebastian/phpcpd: ';
  4. $tag = @exec('git describe --tags 2>&1');
  5. if (strpos($tag, '-') === false && strpos($tag, 'No names found') === false) {
  6. print $tag;
  7. } else {
  8. $branch = @exec('git rev-parse --abbrev-ref HEAD');
  9. $hash = @exec('git log -1 --format="%H"');
  10. print $branch . '@' . $hash;
  11. }
  12. print "\n";
  13. $lock = json_decode(file_get_contents(__DIR__ . '/../composer.lock'));
  14. foreach ($lock->packages as $package) {
  15. print $package->name . ': ' . $package->version;
  16. if (!preg_match('/^[v= ]*(([0-9]+)(\\.([0-9]+)(\\.([0-9]+)(-([0-9]+))?(-?([a-zA-Z-+][a-zA-Z0-9\\.\\-:]*)?)?)?)?)$/', $package->version)) {
  17. print '@' . $package->source->reference;
  18. }
  19. print "\n";
  20. }