PageRenderTime 38ms CodeModel.GetById 10ms RepoModel.GetById 0ms app.codeStats 0ms

/dev/build/publication/license/license-tool.php

https://bitbucket.org/sunil_nextbits/magento2
PHP | 63 lines | 40 code | 11 blank | 12 comment | 5 complexity | 6aa020463dd17eecc5178255db44a172 MD5 | raw file
  1. #!/usr/bin/php
  2. <?php
  3. /**
  4. * {license_notice}
  5. *
  6. * @category build
  7. * @package license
  8. * @copyright {copyright}
  9. * @license {license_link}
  10. */
  11. /**
  12. * Command line tool for processing file docblock of Magento source code files.
  13. */
  14. require dirname(__FILE__) . '/Routine.php';
  15. require dirname(__FILE__) . '/LicenseAbstract.php';
  16. define('USAGE', <<<USAGE
  17. php -f license-tool.php -- -e <edition> [-w <dir>] [-v] [-d] [-0]
  18. -e <edition> name of product edition (see "conf" directory relatively to this script)
  19. -w <dir> use specified working dir instead of current
  20. -v verbose output
  21. -d dry run
  22. -0 exit with a zero status even when not all replacements have succeeded
  23. USAGE
  24. );
  25. $options = getopt('e:w:vd0');
  26. if (!isset($options['e'])) {
  27. print USAGE;
  28. exit(1);
  29. }
  30. if (isset($options['v'])) {
  31. Routine::$isVerbose = true;
  32. }
  33. $dryRun = false;
  34. if (isset($options['d'])) {
  35. Routine::$dryRun = true;
  36. }
  37. $workingDir = '.';
  38. if (isset($options['w'])) {
  39. $workingDir = rtrim($options['w'], DIRECTORY_SEPARATOR);
  40. }
  41. if (!is_dir($workingDir)) {
  42. Routine::printLog("Directory '{$workingDir}' does not exist.\n");
  43. exit(1);
  44. }
  45. $config = require __DIR__ . "/conf/{$options['e']}.php";
  46. $blackList = require __DIR__ . '/../../../../dev/tools/license_placeholder/blacklist.php';
  47. try {
  48. Routine::run($workingDir, $config, $blackList);
  49. } catch(Exception $e) {
  50. Routine::printLog($e->getMessage());
  51. exit(isset($options['0']) ? 0 : 1);
  52. }