当前位置: 首页>>代码示例>>PHP>>正文


PHP RepositoryManager::getLocalDevRepository方法代码示例

本文整理汇总了PHP中Composer\Repository\RepositoryManager::getLocalDevRepository方法的典型用法代码示例。如果您正苦于以下问题:PHP RepositoryManager::getLocalDevRepository方法的具体用法?PHP RepositoryManager::getLocalDevRepository怎么用?PHP RepositoryManager::getLocalDevRepository使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Composer\Repository\RepositoryManager的用法示例。


在下文中一共展示了RepositoryManager::getLocalDevRepository方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 /**
  * Run installation (or update)
  */
 public function run()
 {
     if ($this->dryRun) {
         $this->verbose = true;
         $this->runScripts = false;
         $this->installationManager->addInstaller(new NoopInstaller());
     }
     if ($this->preferSource) {
         $this->downloadManager->setPreferSource(true);
     }
     // create installed repo, this contains all local packages + platform packages (php & extensions)
     $installedRootPackage = clone $this->package;
     $installedRootPackage->setRequires(array());
     $installedRootPackage->setDevRequires(array());
     $repos = array_merge($this->repositoryManager->getLocalRepositories(), array(new InstalledArrayRepository(array($installedRootPackage)), new PlatformRepository()));
     $installedRepo = new CompositeRepository($repos);
     if ($this->additionalInstalledRepository) {
         $installedRepo->addRepository($this->additionalInstalledRepository);
     }
     $aliases = $this->aliasPackages();
     if ($this->runScripts) {
         // dispatch pre event
         $eventName = $this->update ? ScriptEvents::PRE_UPDATE_CMD : ScriptEvents::PRE_INSTALL_CMD;
         $this->eventDispatcher->dispatchCommandEvent($eventName);
     }
     $this->suggestedPackages = array();
     if (!$this->doInstall($this->repositoryManager->getLocalRepository(), $installedRepo, $aliases)) {
         return false;
     }
     if ($this->devMode) {
         if (!$this->doInstall($this->repositoryManager->getLocalDevRepository(), $installedRepo, $aliases, true)) {
             return false;
         }
     }
     // output suggestions
     foreach ($this->suggestedPackages as $suggestion) {
         if (!$installedRepo->findPackages($suggestion['target'])) {
             $this->io->write($suggestion['source'] . ' suggests installing ' . $suggestion['target'] . ' (' . $suggestion['reason'] . ')');
         }
     }
     if (!$this->dryRun) {
         // write lock
         if ($this->update || !$this->locker->isLocked()) {
             $updatedLock = $this->locker->setLockData($this->repositoryManager->getLocalRepository()->getPackages(), $this->devMode ? $this->repositoryManager->getLocalDevRepository()->getPackages() : null, $aliases, $this->package->getMinimumStability(), $this->package->getStabilityFlags());
             if ($updatedLock) {
                 $this->io->write('<info>Writing lock file</info>');
             }
         }
         // write autoloader
         $this->io->write('<info>Generating autoload files</info>');
         $localRepos = new CompositeRepository($this->repositoryManager->getLocalRepositories());
         $this->autoloadGenerator->dump($localRepos, $this->package, $this->installationManager, $this->installationManager->getVendorPath() . '/composer', true);
         if ($this->runScripts) {
             // dispatch post event
             $eventName = $this->update ? ScriptEvents::POST_UPDATE_CMD : ScriptEvents::POST_INSTALL_CMD;
             $this->eventDispatcher->dispatchCommandEvent($eventName);
         }
     }
     return true;
 }
开发者ID:nicodmf,项目名称:composer,代码行数:63,代码来源:Installer.php

示例2: mockLocalRepositories

 /**
  * Replace local repositories with InstalledArrayRepository instances
  *
  * This is to prevent any accidental modification of the existing repos on disk
  *
  * @param RepositoryManager $rm
  */
 private function mockLocalRepositories(RepositoryManager $rm)
 {
     $packages = array_map(function ($p) {
         return clone $p;
     }, $rm->getLocalRepository()->getPackages());
     foreach ($packages as $key => $package) {
         if ($package instanceof AliasPackage) {
             unset($packages[$key]);
         }
     }
     $rm->setLocalRepository(new InstalledArrayRepository($packages));
     $packages = array_map(function ($p) {
         return clone $p;
     }, $rm->getLocalDevRepository()->getPackages());
     foreach ($packages as $key => $package) {
         if ($package instanceof AliasPackage) {
             unset($packages[$key]);
         }
     }
     $rm->setLocalDevRepository(new InstalledArrayRepository($packages));
 }
开发者ID:rkallensee,项目名称:composer,代码行数:28,代码来源:Installer.php


注:本文中的Composer\Repository\RepositoryManager::getLocalDevRepository方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。