Example #1
0
 /**
  * Post composer install or update tasks
  *
  * @param \Composer\Script\CommandEvent $event
  */
 public static function postUpdateAndInstall(CommandEvent $event)
 {
     $options = array();
     if ($event->isDevMode()) {
         $options['options'] = 'setup/default/demo:1';
     }
     \TYPO3\Flow\Core\Booting\Scripts::executeCommand('aimeos.shop:aimeos:setup', array(), true, $options);
     \TYPO3\Flow\Core\Booting\Scripts::executeCommand('aimeos.shop:aimeos:cache', array());
 }
 /**
  * Creates the doctrine schema.
  *
  * @param CommandEvent $event
  */
 public static function createDoctrineSchema(CommandEvent $event)
 {
     if (PreInstallHandler::$firstInstall) {
         $envs = $event->isDevMode() ? ['dev', 'test'] : ['prod'];
         self::dropDoctrineSchema($event, $envs);
         foreach ($envs as $env) {
             static::executeCommand($event, static::getConsoleDir($event, 'create doctrine schema'), sprintf('doctrine:schema:create --env=%s', $env));
         }
     }
 }
 /**
  * Sets up the shop database.
  *
  * @param CommandEvent $event CommandEvent instance
  * @throws \RuntimeException If an error occured
  */
 public static function setupDatabase(CommandEvent $event)
 {
     $options = $env = array();
     if ($event->isDevMode()) {
         $options[] = '--option=setup/default/demo:1';
     } else {
         $env[] = '--env=prod';
     }
     self::executeCommand($event, 'aimeos:setup', $options + $env);
     self::executeCommand($event, 'aimeos:cache', $env);
 }
Example #4
0
 /**
  * Updates the Puli repository after Composer installations/updates.
  *
  * @param CommandEvent $event The Composer event.
  */
 public function postInstall(CommandEvent $event)
 {
     // Plugin has been uninstalled
     if (!file_exists(__FILE__)) {
         return;
     }
     if (!$this->initialized) {
         $this->initialize($event->getComposer(), $event->getIO());
     }
     // This method is called twice. Run it only once.
     if (!$this->runPostInstall) {
         return;
     }
     $this->runPostInstall = false;
     $io = $event->getIO();
     $io->write('<info>Looking for updated Puli packages</info>');
     $rootPackage = $event->getComposer()->getPackage();
     $composerPackages = $this->loadComposerPackages($event->getComposer());
     $prodPackageNames = $this->filterProdPackageNames($composerPackages, $rootPackage);
     $env = $event->isDevMode() ? PuliPackage::ENV_DEV : PuliPackage::ENV_PROD;
     try {
         $puliPackages = $this->loadPuliPackages();
     } catch (PuliRunnerException $e) {
         $this->printWarning($io, 'Could not load Puli packages', $e);
         return;
     }
     // Don't remove non-existing packages in production environment
     // Removed packages could be dev dependencies (i.e. "require-dev"
     // of the root package or "require" of another dev dependency), and
     // we can't find out whether they are since Composer doesn't load them
     if (PuliPackage::ENV_PROD !== $env) {
         $this->removeRemovedPackages($composerPackages, $puliPackages, $io);
     }
     $this->installNewPackages($composerPackages, $prodPackageNames, $puliPackages, $io, $event->getComposer());
     // Don't print warnings for non-existing packages in production
     if (PuliPackage::ENV_PROD !== $env) {
         $this->checkForNotFoundErrors($puliPackages, $io);
     }
     $this->checkForNotLoadableErrors($puliPackages, $io);
     $this->adoptComposerName($puliPackages, $io, $event->getComposer());
     $this->buildPuli($io);
 }
Example #5
0
 /**
  * Handle an event callback for an install or update command by checking
  * for "merge-patterns" in the "extra" data and merging package contents
  * if found.
  *
  * @param CommandEvent $event
  */
 public function onInstallOrUpdate(CommandEvent $event)
 {
     $config = $this->readConfig($this->composer->getPackage());
     if (isset($config['recurse'])) {
         $this->recurse = (bool) $config['recurse'];
     }
     if ($config['include']) {
         $this->loader = new ArrayLoader();
         $this->duplicateLinks = array('require' => array(), 'require-dev' => array());
         $this->devMode = $event->isDevMode();
         $this->mergePackages($config);
     }
 }