protected function deployLibraries() { $packages = $this->composer->getRepositoryManager()->getLocalRepository()->getPackages(); $autoloadDirectories = array(); $libraryPath = $this->config->getLibraryPath(); if ($libraryPath === null) { if ($this->io->isDebug()) { $this->io->write('jump over deployLibraries as no Magento libraryPath is set'); } return; } $vendorDir = rtrim($this->composer->getConfig()->get('vendor-dir'), '/'); $filesystem = $this->filesystem; $filesystem->removeDirectory($libraryPath); $filesystem->ensureDirectoryExists($libraryPath); foreach ($packages as $package) { /** @var PackageInterface $package */ $packageConfig = $this->config->getLibraryConfigByPackagename($package->getName()); if ($packageConfig === null) { continue; } if (!isset($packageConfig['autoload'])) { $packageConfig['autoload'] = array('/'); } foreach ($packageConfig['autoload'] as $path) { $autoloadDirectories[] = $libraryPath . '/' . $package->getName() . "/" . $path; } if ($this->io->isDebug()) { $this->io->write('Magento deployLibraries executed for ' . $package->getName()); } $libraryTargetPath = $libraryPath . '/' . $package->getName(); $filesystem->removeDirectory($libraryTargetPath); $filesystem->ensureDirectoryExists($libraryTargetPath); $this->copyRecursive($vendorDir . '/' . $package->getPrettyName(), $libraryTargetPath); } $autoloadGenerator = new AutoloadGenerator(new EventDispatcher($this->composer, $this->io)); $classmap = ClassMapGenerator::createMap($libraryPath); $executable = $this->composer->getConfig()->get('bin-dir') . '/phpab'; if (!file_exists($executable)) { $executable = $this->composer->getConfig()->get('vendor-dir') . '/theseer/autoload/composer/bin/phpab'; } if (file_exists($executable)) { if ($this->io->isDebug()) { $this->io->write('Magento deployLibraries executes autoload generator'); } $process = new Process($executable . " -o {$libraryPath}/autoload.php " . implode(' ', $autoloadDirectories)); $process->run(); } else { if ($this->io->isDebug()) { $this->io->write('Magento deployLibraries autoload generator not availabel, you should require "theseer/autoload"'); var_dump($executable, getcwd()); } } }
/** * deploy Libraries */ protected function deployLibraries() { $packages = $this->composer->getRepositoryManager()->getLocalRepository()->getPackages(); $autoloadDirectories = array(); $libraryPath = $this->config->getLibraryPath(); if ($libraryPath === null) { $this->writeDebug('jump over deployLibraries as no Magento libraryPath is set'); return; } $vendorDir = rtrim($this->composer->getConfig()->get(self::VENDOR_DIR_KEY), '/'); $this->filesystem->removeDirectory($libraryPath); $this->filesystem->ensureDirectoryExists($libraryPath); foreach ($packages as $package) { /** @var PackageInterface $package */ $packageConfig = $this->config->getLibraryConfigByPackagename($package->getName()); if ($packageConfig === null) { continue; } if (!isset($packageConfig['autoload'])) { $packageConfig['autoload'] = array('/'); } foreach ($packageConfig['autoload'] as $path) { $autoloadDirectories[] = $libraryPath . '/' . $package->getName() . "/" . $path; } $this->writeDebug(sprintf('Magento deployLibraries executed for %s', $package->getName())); $libraryTargetPath = $libraryPath . '/' . $package->getName(); $this->filesystem->removeDirectory($libraryTargetPath); $this->filesystem->ensureDirectoryExists($libraryTargetPath); $this->copyRecursive($vendorDir . '/' . $package->getPrettyName(), $libraryTargetPath); } if (false !== ($executable = $this->getTheseerAutoloadExecutable())) { $this->writeDebug('Magento deployLibraries executes autoload generator'); $params = $this->getTheseerAutoloadParams($libraryPath, $autoloadDirectories); $process = new Process($executable . $params); $process->run(); } }