コード例 #1
0
 public function parsePluginArguments(CommandEvent $event)
 {
     $name = $event->getCommandName();
     switch ($name) {
         case 'update':
         case 'install':
             $myPrefix = $this->args_getPrefix();
             $args = $event->getInput()->getArgument('packages');
             $newArgs = [];
             foreach ($args as $arg) {
                 if (preg_match('/@([\\w\\-]+):([\\w\\-]+)(?:=(\\S+))?/', $arg, $m)) {
                     $m[] = true;
                     list($all, $prefix, $name, $value) = $m;
                     if ($prefix == $myPrefix) {
                         if ($this->args_set($name, $value)) {
                             $this->info($this->args_getFriendlyName($name) . ($value === true ? ": <info>enabled</info>" : ": <info>{$value}</info>"));
                         } else {
                             throw new \RuntimeException("Invalid argument <fg=cyan;bg=red>{$name}</> for plugin <fg=cyan;bg=red>{$prefix}</>");
                         }
                     }
                 } else {
                     $newArgs[] = $arg;
                 }
             }
             if ($newArgs != $args) {
                 $event->getInput()->setArgument('packages', $newArgs);
             }
             break;
     }
 }
コード例 #2
0
 public function onCommand(CommandEvent $event)
 {
     $command = $event->getCommandName();
     $input = $event->getInput();
     $output = $event->getOutput();
     if ($command == 'status') {
         $repos = array();
         foreach ($this->composer->getConfig()->getRepositories() as $key => $repository) {
             if ($repository['type'] == 'vcs') {
                 $protocol = parse_url($repository['url'], PHP_URL_SCHEME);
                 if ($protocol == 'file') {
                     $repos[] = $repository['url'];
                 }
             }
         }
         if (!empty($repos)) {
             $this->io->write('[composer-plugin-vcschecker: Begin]');
             $this->io->write('<error>The following file protocol URLs were detected in the composer.json repositories section:</error>');
             $indentedRepos = implode("\n", array_map(function ($line) {
                 return '    ' . ltrim($line);
             }, $repos));
             $this->io->write($indentedRepos);
             $this->io->write('<error>Please correct the URLs to point to their correct remote location.</error>');
             $this->io->write('[composer-plugin-vcschecker: End]');
             $this->io->writeError('');
         }
     }
 }
コード例 #3
0
 /**
  * Command event dispatcher
  *
  * @param \Composer\Plugin\CommandEvent $event
  */
 public function onCommand(CommandEvent $event)
 {
     switch ($event->getCommandName()) {
         case 'dump-autoload':
             $_this = new DumpAutoloadEventHandler($this->__installer->getComposer()->getPackage(), $this->__installer->getComposer());
             break;
         default:
             break;
     }
 }
コード例 #4
0
ファイル: FxpAssetPlugin.php プロジェクト: cychenyin/postmill
 /**
  * Disable the package filter for all command, but for install and update command.
  *
  * @param CommandEvent $event
  */
 public function onPluginCommand(CommandEvent $event)
 {
     if (!in_array($event->getCommandName(), array('install', 'update'))) {
         $this->packageFilter->setEnabled(false);
     }
 }
コード例 #5
0
 /**
  * 플러그인 커맨드를 통해 composer가 실행된 상태인지 조사한다.
  *
  * @param CommandEvent $event composer가 제공하는 event
  *
  * @return bool
  */
 private static function isUpdateMode(CommandEvent $event)
 {
     if ($event->getInput()->hasArgument('packages')) {
         $packages = $event->getInput()->getArgument('packages');
         $packages = array_shift($packages);
         if ($packages && strpos($packages, 'xpressengine-plugin') === 0) {
             if (!defined('__XE_PLUGIN_MODE__')) {
                 define('__XE_PLUGIN_MODE__', true);
             }
             return true;
         }
     }
     return false;
 }
コード例 #6
0
 /**
  * actually is triggered before anything got executed
  *
  * @param \Composer\Plugin\CommandEvent $event
  */
 public function onCommandEvent(\Composer\Plugin\CommandEvent $event)
 {
     $command = $event->getCommandName();
 }
コード例 #7
0
 /**
  * Tell everyone we're here.
  *
  * @param CommandEvent $e
  *   The event object.
  */
 public function onCommand(CommandEvent $e)
 {
     $output = $e->getOutput();
     $output->writeln('<info>Using ' . self::PACKAGE_NAME . '</info>');
 }
コード例 #8
0
ファイル: Plugin.php プロジェクト: Jobu/core
 /**
  * Handle command events.
  *
  * @param CommandEvent $event The event being raised.
  *
  * @return void
  *
  * @throws \RuntimeException When the artifact directory could not be created.
  */
 public function handleCommand(CommandEvent $event)
 {
     switch ($event->getCommandName()) {
         case 'update':
             ConfigManipulator::run();
             break;
         default:
     }
 }
コード例 #9
0
 /**
  * @param CommandEvent $commandEvent
  *
  * @throws ComposerNoUpdaterException
  */
 public function checkUpdateCommand(CommandEvent $commandEvent)
 {
     $this->commandChecker->setInput($commandEvent->getInput())->validate();
 }
コード例 #10
0
ファイル: Composer.php プロジェクト: pokev25/xpressengine
 /**
  * 플러그인 커맨드를 통해 composer가 실행된 상태인지 조사한다.
  *
  * @param CommandEvent $event composer가 제공하는 event
  *
  * @return bool
  */
 private static function isUpdateMode(CommandEvent $event)
 {
     if ($event->getInput()->hasArgument('packages')) {
         $packages = $event->getInput()->getArgument('packages');
         $packages = array_shift($packages);
         return $packages && strpos($packages, 'xpressengine-plugin') === 0;
     } else {
         return false;
     }
 }