Ejemplo n.º 1
0
 /**
  * Updates specific package
  *
  * @param InstalledRepositoryInterface $repo    repository in which to check
  * @param PackageInterface             $initial already installed package version
  * @param PackageInterface             $target  updated version
  *
  * @throws InvalidArgumentException if $from package is not installed
  */
 public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
 {
     if ($target->getType() === 'magento-core' && !$this->preUpdateMagentoCore()) {
         return;
     }
     // cleanup marshaled files if extra->map exist
     if ($this->hasExtraMap($initial)) {
         $initialStrategy = $this->getDeployStrategy($initial);
         $initialStrategy->setMappings($this->getParser($initial)->getMappings());
         try {
             $initialStrategy->clean();
         } catch (\ErrorException $e) {
             if ($this->io->isDebug()) {
                 $this->io->write($e->getMessage());
             }
         }
     }
     parent::update($repo, $initial, $target);
     // marshal files for new package version if extra->map exist
     if ($this->hasExtraMap($target)) {
         $targetStrategy = $this->getDeployStrategy($target);
         $targetStrategy->setMappings($this->getParser($target)->getMappings());
         $deployManagerEntry = new Entry();
         $deployManagerEntry->setPackageName($target->getName());
         $deployManagerEntry->setDeployStrategy($targetStrategy);
         $this->deployManager->addPackage($deployManagerEntry);
     }
     if ($this->appendGitIgnore) {
         $this->appendGitIgnore($target, $this->getGitIgnoreFileLocation());
     }
     if ($target->getType() === 'magento-core') {
         $this->postUpdateMagentoCore();
     }
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     // init repos
     $composer = $this->getComposer();
     $installedRepo = $composer->getRepositoryManager()->getLocalRepository();
     $dm = $composer->getDownloadManager();
     $im = $composer->getInstallationManager();
     /**
      * @var $moduleInstaller \MagentoHackathon\Composer\Magento\Installer
      */
     $moduleInstaller = $im->getInstaller("magento-module");
     $eventManager = new EventManager();
     $deployManager = new DeployManager($eventManager);
     $io = $this->getIo();
     if ($io->isDebug()) {
         $eventManager->listen('pre-package-deploy', function (PackageDeployEvent $event) use($io) {
             $io->write('Start magento deploy for ' . $event->getDeployEntry()->getPackageName());
         });
     }
     $extra = $composer->getPackage()->getExtra();
     $sortPriority = isset($extra['magento-deploy-sort-priority']) ? $extra['magento-deploy-sort-priority'] : array();
     $deployManager->setSortPriority($sortPriority);
     $moduleInstaller->setDeployManager($deployManager);
     foreach ($installedRepo->getPackages() as $package) {
         if ($input->getOption('verbose')) {
             $output->writeln($package->getName());
             $output->writeln($package->getType());
         }
         if ($package->getType() != "magento-module") {
             continue;
         }
         if ($input->getOption('verbose')) {
             $output->writeln("package {$package->getName()} recognized");
         }
         $strategy = $moduleInstaller->getDeployStrategy($package);
         if ($input->getOption('verbose')) {
             $output->writeln("used " . get_class($strategy) . " as deploy strategy");
         }
         $strategy->setMappings($moduleInstaller->getParser($package)->getMappings());
         $deployManagerEntry = new Entry();
         $deployManagerEntry->setPackageName($package->getName());
         $deployManagerEntry->setDeployStrategy($strategy);
         $deployManager->addPackage($deployManagerEntry);
     }
     $deployManager->doDeploy();
     return;
 }
Ejemplo n.º 3
0
 /**
  * event listener is named this way, as it listens for events leading to changed code files
  *
  * @param \Composer\Script\CommandEvent $event
  */
 public function onNewCodeEvent(\Composer\Script\CommandEvent $event)
 {
     if ($this->io->isDebug()) {
         $this->io->write('start magento deploy via deployManager');
     }
     $this->deployManager->doDeploy();
     $this->deployLibraries();
     $this->saveVendorDirPath($event->getComposer());
 }
Ejemplo n.º 4
0
 /**
  * event listener is named this way, as it listens for events leading to changed code files
  * 
  * @param \Composer\Script\CommandEvent $event
  */
 public function onNewCodeEvent(\Composer\Script\CommandEvent $event)
 {
     if ($this->io->isDebug()) {
         $this->io->write('start magento deploy via deployManager');
     }
     $command = $event->getName();
     $this->deployManager->doDeploy();
     $this->deployLibraries();
 }
Ejemplo n.º 5
0
 /**
  * event listener is named this way, as it listens for events leading to changed code files
  *
  * @param \Composer\Script\Event $event
  */
 public function onNewCodeEvent(\Composer\Script\Event $event)
 {
     if ($this->io->isDebug()) {
         $this->io->write('start magento deploy via deployManager');
     }
     $this->deployManager->doDeploy();
     $this->deployLibraries();
     $this->saveVendorDirPath($event->getComposer());
     $this->requestRegeneration();
     $this->setFilePermissions();
 }
Ejemplo n.º 6
0
 /**
  * event listener is named this way, as it listens for events leading to changed code files
  *
  * @param \Composer\Script\Event $event
  */
 public function onNewCodeEvent(\Composer\Script\Event $event)
 {
     if ($this->io->isDebug()) {
         $this->io->write('start magento deploy via deployManager');
     }
     $this->deployManager->doDeploy();
     $this->deployLibraries();
     $this->saveVendorDirPath($event->getComposer());
     $filename = $this->installer->getTargetDir() . $this->regenerate;
     touch($filename);
 }
Ejemplo n.º 7
0
 /**
  * Updates specific package
  *
  * @param InstalledRepositoryInterface $repo    repository in which to check
  * @param PackageInterface             $initial already installed package version
  * @param PackageInterface             $target  updated version
  *
  * @throws InvalidArgumentException if $from package is not installed
  */
 public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
 {
     if ($target->getType() === 'magento-core' && !$this->preUpdateMagentoCore()) {
         return;
     }
     $initialStrategy = $this->getDeployStrategy($initial);
     $initialStrategy->setMappings($this->getParser($initial)->getMappings());
     $initialStrategy->clean();
     parent::update($repo, $initial, $target);
     $targetStrategy = $this->getDeployStrategy($target);
     $targetStrategy->setMappings($this->getParser($target)->getMappings());
     $deployManagerEntry = new Entry();
     $deployManagerEntry->setPackageName($target->getName());
     $deployManagerEntry->setDeployStrategy($targetStrategy);
     $this->deployManager->addPackage($deployManagerEntry);
     if ($this->appendGitIgnore) {
         $this->appendGitIgnore($target, $this->getGitIgnoreFileLocation());
     }
     if ($target->getType() === 'magento-core') {
         $this->postUpdateMagentoCore();
     }
 }
 /**
  * Updates specific package
  *
  * @param InstalledRepositoryInterface $repo    repository in which to check
  * @param PackageInterface             $initial already installed package version
  * @param PackageInterface             $target  updated version
  *
  * @throws InvalidArgumentException if $from package is not installed
  */
 public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
 {
     $initialStrategy = $this->getDeployStrategy($initial);
     $initialStrategy->setMappings($this->getParser($initial)->getMappings());
     $initialStrategy->clean();
     parent::update($repo, $initial, $target);
     $targetStrategy = $this->getDeployStrategy($target);
     $targetStrategy->setMappings($this->getParser($target)->getMappings());
     $deployManagerEntry = new Entry();
     $deployManagerEntry->setPackageName($target->getName());
     $deployManagerEntry->setDeployStrategy($targetStrategy);
     $this->deployManager->addPackage($deployManagerEntry);
 }
Ejemplo n.º 9
0
 /**
  * init the DeployManager
  *
  * @param Composer    $composer
  * @param IOInterface $io
  */
 protected function initDeployManager(Composer $composer, IOInterface $io, EventManager $eventManager)
 {
     $this->deployManager = new DeployManager($eventManager);
     $this->deployManager->setSortPriority($this->getSortPriority($composer));
     $this->applyEvents($eventManager);
 }