/**
  * @param PackageInterface $package
  * @param string $packageSourcePath
  * @return DeploystrategyAbstract
  */
 public function make(PackageInterface $package, $packageSourcePath)
 {
     $strategyName = $this->config->getModuleSpecificDeployStrategy($package->getName());
     $ns = '\\MagentoHackathon\\Composer\\Magento\\Deploystrategy\\';
     $className = $ns . ucfirst($strategyName);
     if (!class_exists($className)) {
         $className = $ns . 'Symlink';
     }
     $strategy = new $className($packageSourcePath, realpath($this->config->getMagentoRootDir()));
     $strategy->setIgnoredMappings($this->config->getModuleSpecificDeployIgnores($package->getName()));
     $strategy->setIsForced($this->config->getMagentoForceByPackageName($package->getName()));
     $mappingParser = $this->parserFactory->make($package, $packageSourcePath);
     $strategy->setMappings($mappingParser->getMappings());
     return $strategy;
 }
 /**
  * init the DeployManagers
  *
  * @param Composer    $composer
  * @param IOInterface $io
  */
 protected function initDeployManager(Composer $composer, IOInterface $io, EventManager $eventManager)
 {
     $this->deployManagers['core'] = new DeployManager($eventManager);
     $this->deployManagers['module'] = new DeployManager($eventManager);
     $this->deployManagers['module']->setSortPriority($this->getSortPriority($composer));
     if ($this->config->hasAutoAppendGitignore()) {
         $gitIgnoreLocation = sprintf('%s/.gitignore', $this->config->getMagentoRootDir());
         $eventManager->listen('post-package-deploy', new GitIgnoreListener(new GitIgnore($gitIgnoreLocation)));
     }
     if ($this->io->isDebug()) {
         $eventManager->listen('pre-package-deploy', function (PackageDeployEvent $event) use($io) {
             $io->write('Start magento deploy for ' . $event->getDeployEntry()->getPackageName());
         });
     }
 }
Пример #3
0
 /**
  * @return ModuleManager
  */
 protected function getModuleManager()
 {
     if (null === $this->moduleManager) {
         $this->moduleManager = new ModuleManager(new InstalledPackageFileSystemRepository(rtrim($this->composer->getConfig()->get(self::VENDOR_DIR_KEY), '/') . '/installed.json', new InstalledPackageDumper()), $this->getEventManager(), $this->config, new UnInstallStrategy($this->filesystem, $this->config->getMagentoRootDir()), new InstallStrategyFactory($this->config, new ParserFactory($this->config)));
     }
     return $this->moduleManager;
 }
 /**
  * @param PackageInterface $package
  * @param string $packageSourcePath
  * @return DeploystrategyAbstract
  */
 public function make(PackageInterface $package, $packageSourcePath)
 {
     $strategyName = $this->config->getDeployStrategy();
     if ($this->config->hasDeployStrategyOverwrite()) {
         $moduleSpecificDeployStrategies = $this->config->getDeployStrategyOverwrite();
         if (isset($moduleSpecificDeployStrategies[$package->getName()])) {
             $strategyName = $moduleSpecificDeployStrategies[$package->getName()];
         }
     }
     if (!isset(static::$strategies[$strategyName])) {
         $className = static::$strategies['symlink'];
     } else {
         $className = static::$strategies[$strategyName];
     }
     $strategy = new $className($packageSourcePath, realpath($this->config->getMagentoRootDir()));
     $strategy->setIgnoredMappings($this->config->getModuleSpecificDeployIgnores($package->getName()));
     $strategy->setIsForced($this->config->getMagentoForceByPackageName($package->getName()));
     return $strategy;
 }
Пример #5
0
 public static function initMagentoRootDir(ProjectConfig $projectConfig, \Composer\IO\IOInterface $io, \Composer\Util\Filesystem $filesystem, $vendorDir)
 {
     if (false === $projectConfig->hasMagentoRootDir()) {
         $projectConfig->setMagentoRootDir($io->ask(sprintf('please define your magento root dir [%s]', ProjectConfig::DEFAULT_MAGENTO_ROOT_DIR), ProjectConfig::DEFAULT_MAGENTO_ROOT_DIR));
     }
     $magentoRootDirPath = $projectConfig->getMagentoRootDir();
     $magentoRootDir = new \SplFileInfo($magentoRootDirPath);
     if (!is_dir($magentoRootDirPath) && $io->askConfirmation('magento root dir "' . $magentoRootDirPath . '" missing! create now? [Y,n] ')) {
         $filesystem->ensureDirectoryExists($magentoRootDir);
         $io->write('magento root dir "' . $magentoRootDirPath . '" created');
     }
     if (!is_dir($magentoRootDirPath)) {
         $dir = self::joinFilePath($vendorDir, $magentoRootDirPath);
     }
 }
Пример #6
0
 /**
  * @param ProjectConfig $config
  * @return $this
  */
 public static function fromConfig(ProjectConfig $config)
 {
     return new self($config->getMagentoRootDir() . '/app/Mage.php', $config);
 }