Ejemplo n.º 1
0
 /**
  * composer가 실행될 때 호출된다. composer.plugins.json 파일이 있는지 조사하고, 생성한다.
  *
  * @param CommandEvent $event composer가 제공하는 event
  *
  * @return void
  */
 public static function init(CommandEvent $event)
 {
     $path = static::$composerFile;
     $writer = self::getWriter($path);
     // XE가 설치돼 있지 않을 경우, base plugin require에 추가
     if (!file_exists(static::$installedFlagPath)) {
         $writer->reset();
         foreach (static::$basePlugins as $plugin => $version) {
             if ($writer->get('replace.' . $plugin) === null) {
                 $writer->install($plugin, $version, date("Y-m-d H:i:s"));
             } else {
                 $event->getOutput()->writeln("xpressengine-installer: skip installation of existing plugin: {$plugin}");
             }
         }
         if (!defined('__XE_PLUGIN_MODE__')) {
             define('__XE_PLUGIN_MODE__', true);
         }
         static::applyRequire($writer);
         $event->getOutput()->writeln("xpressengine-installer: running in update mode");
     } else {
         static::applyRequire($writer);
         if (static::isUpdateMode($event)) {
             $writer->setUpdateMode();
             $event->getOutput()->writeln("xpressengine-installer: running in update mode");
         } else {
             $writer->setFixMode();
             $event->getOutput()->writeln("xpressengine-installer: running in fix mode");
         }
     }
     $writer->write();
     $event->getOutput()->writeln("xpressengine-installer: Plugin composer file[{$path}] is written");
 }
 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('');
         }
     }
 }
Ejemplo n.º 3
0
 /**
  * composer가 실행될 때 호출된다. composer.plugins.json 파일이 있는지 조사하고, 생성한다.
  *
  * @param CommandEvent $event composer가 제공하는 event
  *
  * @return void
  */
 public static function init(CommandEvent $event)
 {
     $path = static::$composerFile;
     $writer = self::getWriter($path);
     // composer.plugins.json 파일이 존재하지 않을 경우 초기화
     $writer->resolvePlugins()->write();
     // XE가 설치돼 있지 않을 경우, base plugin require에 추가
     if (!file_exists(static::$installedFlagPath)) {
         foreach (static::$basePlugins as $plugin => $version) {
             $writer->install($plugin, $version);
         }
         static::applyRequire($writer);
         $writer->setFixMode();
         $event->getOutput()->writeln("xpressengine-installer: running in update mode");
     } else {
         static::applyRequire($writer);
         if (static::isUpdateMode($event)) {
             $writer->setUpdateMode();
             $event->getOutput()->writeln("xpressengine-installer: running in update mode");
         } else {
             $writer->setFixMode();
             $event->getOutput()->writeln("xpressengine-installer: running in fix mode");
         }
     }
     $writer->write();
     $event->getOutput()->writeln("xpressengine-installer: Plugin composer file[{$path}] is written");
 }
Ejemplo n.º 4
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>');
 }