當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Composer::getInstallationManager方法代碼示例

本文整理匯總了PHP中Composer\Composer::getInstallationManager方法的典型用法代碼示例。如果您正苦於以下問題:PHP Composer::getInstallationManager方法的具體用法?PHP Composer::getInstallationManager怎麽用?PHP Composer::getInstallationManager使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Composer\Composer的用法示例。


在下文中一共展示了Composer::getInstallationManager方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 /**
  * {@inheritdoc}
  */
 public function __construct(Composer $composer = null, IOInterface $io = null)
 {
     $this->composer = isset($composer) ? $composer : new Composer();
     $this->io = isset($io) ? $io : new NullIO();
     $this->fs = new Filesystem();
     $this->installationManager = $this->composer->getInstallationManager();
 }
開發者ID:SylvainSimon,項目名稱:Metinify,代碼行數:10,代碼來源:Process.php

示例2: __invoke

 /**
  * @param PackageEvent $event
  */
 public function __invoke(PackageEvent $event)
 {
     $publicPath = sprintf('%s/public', $this->projectPath);
     if (!is_dir($publicPath)) {
         // No public path in the project; nothing to remove
         return;
     }
     $gitignoreFile = sprintf('%s/.gitignore', $publicPath);
     if (!file_exists($gitignoreFile)) {
         // No .gitignore rules; nothing to remove
         return;
     }
     $package = $event->getOperation()->getPackage();
     $installer = $this->composer->getInstallationManager();
     $packagePath = $installer->getInstallPath($package);
     $packageConfigPath = sprintf('%s/config/module.config.php', $packagePath);
     if (!file_exists($packageConfigPath)) {
         // No module configuration defined; nothing to remove
         return;
     }
     $packageConfig = (include $packageConfigPath);
     if (!is_array($packageConfig) || !isset($packageConfig['asset_manager']['resolver_configs']['paths']) || !is_array($packageConfig['asset_manager']['resolver_configs']['paths'])) {
         // No assets defined; nothing to remove
         return;
     }
     $this->gitignore = $this->fetchIgnoreRules($gitignoreFile);
     $paths = $packageConfig['asset_manager']['resolver_configs']['paths'];
     foreach ($paths as $path) {
         $this->removeAssets($path, $publicPath);
     }
     file_put_contents($gitignoreFile, implode("\n", $this->gitignore));
 }
開發者ID:zfcampus,項目名稱:zf-asset-manager,代碼行數:35,代碼來源:AssetUninstaller.php

示例3: activate

 public function activate(Composer $composer, IOInterface $io)
 {
     // Add the Innomatic legacy platform installer
     $composer->getInstallationManager()->addInstaller(new LegacyPlatformInstaller($io, $composer));
     // Add the Innomatic legacy application installer
     $composer->getInstallationManager()->addInstaller(new LegacyApplicationInstaller($io, $composer));
 }
開發者ID:innomatic,項目名稱:innomatic-legacy-installer,代碼行數:7,代碼來源:InstallerPlugin.php

示例4: checkPatches

 /**
  * Before running composer install,
  * @param Event $event
  */
 public function checkPatches(Event $event)
 {
     try {
         $repositoryManager = $this->composer->getRepositoryManager();
         $localRepository = $repositoryManager->getLocalRepository();
         $installationManager = $this->composer->getInstallationManager();
         $packages = $localRepository->getPackages();
         $tmp_patches = $this->grabPatches();
         if ($tmp_patches == FALSE) {
             $this->io->write('<info>No patches supplied.</info>');
             return;
         }
         foreach ($packages as $package) {
             $extra = $package->getExtra();
             $patches = isset($extra['patches']) ? $extra['patches'] : array();
             $tmp_patches = array_merge_recursive($tmp_patches, $patches);
         }
         // Remove packages for which the patch set has changed.
         foreach ($packages as $package) {
             if (!$package instanceof AliasPackage) {
                 $package_name = $package->getName();
                 $extra = $package->getExtra();
                 $has_patches = isset($tmp_patches[$package_name]);
                 $has_applied_patches = isset($extra['patches_applied']);
                 if ($has_patches && !$has_applied_patches || !$has_patches && $has_applied_patches || $has_patches && $has_applied_patches && $tmp_patches[$package_name] !== $extra['patches_applied']) {
                     $uninstallOperation = new UninstallOperation($package, 'Removing package so it can be re-installed and re-patched.');
                     $this->io->write('<info>Removing package ' . $package_name . ' so that it can be re-installed and re-patched.</info>');
                     $installationManager->uninstall($localRepository, $uninstallOperation);
                 }
             }
         }
     } catch (\LogicException $e) {
         return;
     }
 }
開發者ID:EurostarDigital,項目名稱:composer-patches,代碼行數:39,代碼來源:Patches.php

示例5: testActivateAddsInstallerSuccessfully

 public function testActivateAddsInstallerSuccessfully()
 {
     $plugin = new Plugin();
     $plugin->activate($this->composer, $this->io);
     $installer = $this->composer->getInstallationManager()->getInstaller('git-hook');
     // Ensure the installer was added.
     $this->assertInstanceOf('BernardoSilva\\GitHooksInstallerPlugin\\Composer\\Installer', $installer);
 }
開發者ID:bernardosilva,項目名稱:git-hooks-installer-plugin,代碼行數:8,代碼來源:PluginTest.php

示例6: activate

 /**
  * Apply plugin modifications to composer
  *
  * @param \Composer\Composer $composer
  * @param \Composer\IO\IOInterface $io
  */
 public function activate(\Composer\Composer $composer, \Composer\IO\IOInterface $io)
 {
     $core_installer_v7 = new FrameworkInstaller($io, $composer);
     $composer->getInstallationManager()->addInstaller($core_installer_v7);
     $core_installer_v8 = new FrameworkInstallerV8($io, $composer);
     $composer->getInstallationManager()->addInstaller($core_installer_v8);
     $module_installer = new ModuleInstallerV7($io, $composer);
     $composer->getInstallationManager()->addInstaller($module_installer);
 }
開發者ID:claromentis,項目名稱:installer-composer-plugin,代碼行數:15,代碼來源:Plugin.php

示例7: __construct

 /**
  * {@inheritdoc}
  */
 public function __construct(Composer $composer = null, IOInterface $io = null)
 {
     $this->composer = isset($composer) ? $composer : new Composer();
     $this->io = isset($io) ? $io : new NullIO();
     $this->fs = new Filesystem();
     $this->installationManager = $this->composer->getInstallationManager();
     // TODO: Break compatibility and expect in interface
     $args = func_get_args();
     $this->options = count($args) > 2 && is_array($args[2]) ? $args[2] : array();
 }
開發者ID:robloach,項目名稱:component-installer,代碼行數:13,代碼來源:Process.php

示例8: registerLoader

 private function registerLoader()
 {
     $package = $this->composer->getPackage();
     $generator = $this->composer->getAutoloadGenerator();
     $packages = $this->composer->getRepositoryManager()->getLocalRepository()->getCanonicalPackages();
     $packageMap = $generator->buildPackageMap($this->composer->getInstallationManager(), $package, $packages);
     $map = $generator->parseAutoloads($packageMap, $package);
     $this->loader = $generator->createLoader($map);
     $this->loader->register();
 }
開發者ID:helhum,項目名稱:typo3-console-plugin,代碼行數:10,代碼來源:ScriptDispatcher.php

示例9: getInstallPathsFromPackages

 /**
  * Retrieve install paths from package installers.
  *
  * @param \Composer\Package\PackageInterface[] $packages
  *
  * @return string[]
  */
 protected function getInstallPathsFromPackages(array $packages)
 {
     /** @var \Composer\Installer\InstallationManager $installationManager */
     $installationManager = $this->composer->getInstallationManager();
     $paths = array();
     foreach ($packages as $package) {
         $paths[] = $installationManager->getInstallPath($package);
     }
     return $this->absolutePaths($paths);
 }
開發者ID:ruuds,項目名稱:composer-remove-paths,代碼行數:17,代碼來源:PluginWrapper.php

示例10: setUp

 public function setUp()
 {
     $this->projectRoot = vfsStream::setup('project');
     $this->installer = new ComponentInstaller(vfsStream::url('project'));
     $this->composer = $this->prophesize(Composer::class);
     $this->io = $this->prophesize(IOInterface::class);
     $this->installer->activate($this->composer->reveal(), $this->io->reveal());
     $this->installationManager = $this->prophesize(InstallationManager::class);
     $this->composer->getInstallationManager()->willReturn($this->installationManager->reveal());
 }
開發者ID:zendframework,項目名稱:zend-component-installer,代碼行數:10,代碼來源:ComponentInstallerTest.php

示例11: activate

 /**
  * {@inheritDoc}
  */
 public function activate(Composer $composer, IOInterface $io)
 {
     $filesystem = new Filesystem();
     $composer->getInstallationManager()->addInstaller(new CoreInstaller($composer, $filesystem, new CoreInstaller\GetTypo3OrgService($io)));
     $composer->getInstallationManager()->addInstaller(new ExtensionInstaller($composer, $filesystem));
     $cache = null;
     if ($composer->getConfig()->get('cache-files-ttl') > 0) {
         $cache = new Cache($io, $composer->getConfig()->get('cache-files-dir'), 'a-z0-9_./');
     }
     $composer->getDownloadManager()->setDownloader('t3x', new Downloader\T3xDownloader($io, $composer->getConfig(), null, $cache));
 }
開發者ID:graurus,項目名稱:testgit_t37,代碼行數:14,代碼來源:Plugin.php

示例12: findBundleFiles

 /**
  * This method tries the find the BundleFile in the root of
  * the given package. At this moment we don't support bundles
  * that don't have the Bundle file in the package root.
  */
 protected function findBundleFiles(PackageInterface $package)
 {
     $installPath = $this->composer->getInstallationManager()->getInstallPath($package);
     $autoload = $package->getAutoload();
     if (isset($autoload['psr-0'])) {
         $installPath .= '/' . current($autoload['psr-0']);
     }
     if (isset($autoload['psr-4'])) {
         $installPath .= '/' . current($autoload['psr-4']);
     }
     return glob(rtrim($installPath, '/') . '/*Bundle.php');
 }
開發者ID:frogriotcom,項目名稱:CheckBundles,代碼行數:17,代碼來源:ComposerHelper.php

示例13: dumpAutoloads

 /**
  * @param bool $optimize
  * @param bool $reload
  */
 protected function dumpAutoloads($optimize = true, $reload = false)
 {
     if ($reload) {
         $this->composer = Factory::create($this->io, null, $this->disablePluginsByDefault);
     }
     $config = $this->composer->getConfig();
     $generator = $this->composer->getAutoloadGenerator();
     $installationManager = $this->composer->getInstallationManager();
     $localRepository = $this->composer->getRepositoryManager()->getLocalRepository();
     $package = $this->composer->getPackage();
     $generator->dump($config, $localRepository, $package, $installationManager, 'composer', $optimize);
     $this->info('Composer DumpAutoloads Completed!');
 }
開發者ID:notadd,項目名稱:framework,代碼行數:17,代碼來源:Command.php

示例14: __construct

 /**
  * @param string $baseDir Root directory of composer package.
  */
 public function __construct($baseDir)
 {
     $this->baseDir = $baseDir;
     $io = new NullIO();
     $this->composer = (new Factory())->createComposer($io, $baseDir . '/composer.json', true, $baseDir, false);
     $generator = new AutoloadGenerator($this->composer->getEventDispatcher(), $io);
     $generator->setDevMode(true);
     $packages = $this->composer->getRepositoryManager()->getLocalRepository()->getPackages();
     $packageMap = $generator->buildPackageMap($this->composer->getInstallationManager(), $this->composer->getPackage(), $packages);
     $packageMap[0][1] = $baseDir;
     // To make root package paths absolute too.
     $autoloads = $generator->parseAutoloads($packageMap, $this->composer->getPackage());
     $this->classLoader = $generator->createLoader($autoloads);
 }
開發者ID:tsufeki,項目名稱:phpcmplr,代碼行數:17,代碼來源:ComposerPackage.php

示例15: checkPatches

 /**
  * Before running composer install,
  * @param Event $event
  */
 public function checkPatches(Event $event)
 {
     try {
         $repositoryManager = $this->composer->getRepositoryManager();
         $localRepository = $repositoryManager->getLocalRepository();
         $installationManager = $this->composer->getInstallationManager();
         $packages = $localRepository->getPackages();
         $tmp_patches = array();
         // First, try to get the patches from the root composer.json.
         $extra = $this->composer->getPackage()->getExtra();
         if (isset($extra['patches'])) {
             $this->io->write('<info>Gathering patches for root package.</info>');
             $tmp_patches = $extra['patches'];
         } else {
             if (isset($extra['patches-file'])) {
                 $this->io->write('<info>Gathering patches from patch file.</info>');
                 $patches = file_get_contents($extra['patches-file']);
                 $patches = json_decode($patches, TRUE);
                 if (isset($patches['patches'])) {
                     $tmp_patches = $patches['patches'];
                 }
             } else {
                 // @todo: should we throw an exception here?
                 return;
             }
         }
         foreach ($packages as $package) {
             $extra = $package->getExtra();
             $patches = isset($extra['patches']) ? $extra['patches'] : array();
             $tmp_patches = array_merge_recursive($tmp_patches, $patches);
         }
         // Remove packages for which the patch set has changed.
         foreach ($packages as $package) {
             if (!$package instanceof AliasPackage) {
                 $package_name = $package->getName();
                 $extra = $package->getExtra();
                 $has_patches = isset($tmp_patches[$package_name]);
                 $has_applied_patches = isset($extra['patches_applied']);
                 if ($has_patches && !$has_applied_patches || !$has_patches && $has_applied_patches || $has_patches && $has_applied_patches && $tmp_patches[$package_name] !== $extra['patches_applied']) {
                     $uninstallOperation = new UninstallOperation($package, 'Removing package so it can be re-installed and re-patched.');
                     $this->io->write('<info>Removing package ' . $package_name . ' so that it can be re-installed and re-patched.</info>');
                     $installationManager->uninstall($localRepository, $uninstallOperation);
                 }
             }
         }
     } catch (\LogicException $e) {
         return;
     }
 }
開發者ID:nrackleff,項目名稱:capstone,代碼行數:53,代碼來源:Patches.php


注:本文中的Composer\Composer::getInstallationManager方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。