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


PHP Installer\InstallationManager类代码示例

本文整理汇总了PHP中Composer\Installer\InstallationManager的典型用法代码示例。如果您正苦于以下问题:PHP InstallationManager类的具体用法?PHP InstallationManager怎么用?PHP InstallationManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: mapContrib

 public function mapContrib(InstallationManager $im, RepositoryManager $rm)
 {
     $typePathMap = $this->getTypePathMap();
     $typeInstallMap = [];
     $packages = $rm->getLocalRepository()->getCanonicalPackages();
     foreach ($packages as $package) {
         if ($drupalType = $this->getDrupalType($package)) {
             if (!isset($typePathMap[$drupalType])) {
                 continue;
             }
             $installPath = self::changeSlashes($im->getInstaller($package->getType())->getInstallPath($package));
             if (strpos($installPath, $root = $this->getRoot()) !== false) {
                 $installPath = self::changeSlashes($this->getFS()->makePathRelative($installPath, $root));
             }
             $name = explode('/', $package->getPrettyName())[1];
             $mapRef =& $typeInstallMap[$drupalType][rtrim($installPath, DIRECTORY_SEPARATOR)];
             if (in_array($drupalType, ['module', 'theme'])) {
                 $mapRef = sprintf($typePathMap[$drupalType] . DIRECTORY_SEPARATOR . '%s', 'contrib', $name);
             } else {
                 $mapRef = sprintf($typePathMap[$drupalType], $name);
             }
         }
     }
     return array_intersect_key($typeInstallMap, $typePathMap);
 }
开发者ID:mbolli,项目名称:drupal-tangler,代码行数:25,代码来源:Mapper.php

示例2: setUp

 protected function setUp()
 {
     $this->fs = new Filesystem();
     $that = $this;
     $this->workingDir = realpath(sys_get_temp_dir()) . DIRECTORY_SEPARATOR . 'cmptest-' . md5(uniqid('', true));
     $this->fs->ensureDirectoryExists($this->workingDir);
     $this->vendorDir = $this->workingDir . DIRECTORY_SEPARATOR . 'composer-test-autoload';
     $this->ensureDirectoryExistsAndClear($this->vendorDir);
     $this->config = $this->getMock('Composer\\Config');
     $this->config->expects($this->at(0))->method('get')->with($this->equalTo('vendor-dir'))->will($this->returnCallback(function () use($that) {
         return $that->vendorDir;
     }));
     $this->config->expects($this->at(1))->method('get')->with($this->equalTo('vendor-dir'))->will($this->returnCallback(function () use($that) {
         return $that->vendorDir;
     }));
     $this->origDir = getcwd();
     chdir($this->workingDir);
     $this->im = $this->getMockBuilder('Composer\\Installer\\InstallationManager')->disableOriginalConstructor()->getMock();
     $this->im->expects($this->any())->method('getInstallPath')->will($this->returnCallback(function ($package) use($that) {
         $targetDir = $package->getTargetDir();
         return $that->vendorDir . '/' . $package->getName() . ($targetDir ? '/' . $targetDir : '');
     }));
     $this->repository = $this->getMock('Composer\\Repository\\InstalledRepositoryInterface');
     $this->eventDispatcher = $this->getMockBuilder('Composer\\EventDispatcher\\EventDispatcher')->disableOriginalConstructor()->getMock();
     $this->generator = new AutoloadGenerator($this->eventDispatcher);
 }
开发者ID:aminembarki,项目名称:composer,代码行数:26,代码来源:AutoloadGeneratorTest.php

示例3: build

 public function build($rootDirectory, $optimize = false, $noDevMode = false)
 {
     $packages = $this->loadPackages($rootDirectory);
     $evm = new EventDispatcher(new Composer(), $this->io);
     $generator = new AutoloadGenerator($evm, $this->io);
     $generator->setDevMode(!$noDevMode);
     $installationManager = new InstallationManager();
     $installationManager->addInstaller(new FiddlerInstaller());
     $this->io->write('Building fiddler.json projects.');
     foreach ($packages as $packageName => $config) {
         if (strpos($packageName, 'vendor') === 0) {
             continue;
         }
         $this->io->write(' [Build] <info>' . $packageName . '</info>');
         $mainPackage = new Package($packageName, "@stable", "@stable");
         $mainPackage->setType('fiddler');
         $mainPackage->setAutoload($config['autoload']);
         $mainPackage->setDevAutoload($config['autoload-dev']);
         $localRepo = new FiddlerInstalledRepository();
         $this->resolvePackageDependencies($localRepo, $packages, $packageName);
         $composerConfig = new Config(true, $rootDirectory);
         $composerConfig->merge(array('config' => array('vendor-dir' => $config['path'] . '/vendor')));
         $generator->dump($composerConfig, $localRepo, $mainPackage, $installationManager, 'composer', $optimize);
     }
 }
开发者ID:sidisinsane,项目名称:fiddler,代码行数:25,代码来源:Build.php

示例4: setUp

 protected function setUp()
 {
     $this->package = $this->getMockBuilder('Composer\\Package\\RootPackageInterface')->getMock();
     $this->assetType = $this->getMockBuilder('Fxp\\Composer\\AssetPlugin\\Type\\AssetTypeInterface')->getMock();
     $versionConverter = $this->getMockBuilder('Fxp\\Composer\\AssetPlugin\\Converter\\VersionConverterInterface')->getMock();
     $versionConverter->expects($this->any())->method('convertVersion')->will($this->returnCallback(function ($value) {
         return $value;
     }));
     $this->assetType->expects($this->any())->method('getVersionConverter')->will($this->returnValue($versionConverter));
     $this->installationManager = $this->getMockBuilder('Composer\\Installer\\InstallationManager')->disableOriginalConstructor()->getMock();
     $this->installationManager->expects($this->any())->method('isPackageInstalled')->will($this->returnValue(true));
 }
开发者ID:stefangr,项目名称:composer-asset-plugin,代码行数:12,代码来源:VcsPackageFilterTest.php

示例5: activate

 /**
  * Apply plugin modifications to composer
  *
  * @param  \Composer\Composer $composer
  * @param  \Composer\IO\IOInterface $io
  * @return void
  */
 public function activate(Composer $composer, IOInterface $io)
 {
     $this->io = $io;
     $this->composer = $composer;
     $this->factory = $this->getFactory();
     $this->manager = $this->getInstallationManager($composer);
     // The connection factory is used to create the actual connection instances on
     // the database. We will inject the factory into the manager so that it may
     // make the connections while they are actually needed and not of before.
     $installers = $this->factory->getInstallers();
     foreach ($installers as $name) {
         $this->manager->addInstaller($this->factory->make($name, $composer, $io));
     }
 }
开发者ID:lappuse,项目名称:composer-installer,代码行数:21,代码来源:Plugin.php

示例6: setUp

 protected function setUp()
 {
     $this->tempDir = TestUtil::makeTempDir('puli-composer-plugin', __CLASS__);
     $filesystem = new Filesystem();
     $filesystem->mirror(__DIR__ . '/Fixtures/root', $this->tempDir);
     $this->io = $this->getMock('Composer\\IO\\IOInterface');
     $this->config = new Config(false, $this->tempDir);
     $this->config->merge(array('config' => array('vendor-dir' => 'the-vendor')));
     $this->installationManager = $this->getMockBuilder('Composer\\Installer\\InstallationManager')->disableOriginalConstructor()->getMock();
     $this->installationManager->expects($this->any())->method('getInstallPath')->will($this->returnCallback(array($this, 'getInstallPath')));
     $this->rootPackage = new RootPackage('vendor/root', '1.0', '1.0');
     $this->rootPackage->setRequires(array('vendor/package1' => new Link('vendor/root', 'vendor/package1'), 'vendor/package2' => new Link('vendor/root', 'vendor/package2')));
     $this->localRepository = new TestLocalRepository(array(new Package('vendor/package1', '1.0', '1.0'), new Package('vendor/package2', '1.0', '1.0')));
     $this->repositoryManager = new RepositoryManager($this->io, $this->config);
     $this->repositoryManager->setLocalRepository($this->localRepository);
     $this->installPaths = array();
     $this->composer = new Composer();
     $this->composer->setRepositoryManager($this->repositoryManager);
     $this->composer->setInstallationManager($this->installationManager);
     $this->composer->setConfig($this->config);
     $this->composer->setPackage($this->rootPackage);
     $this->puliRunner = $this->getMockBuilder('Puli\\ComposerPlugin\\PuliRunner')->disableOriginalConstructor()->getMock();
     $this->previousWd = getcwd();
     chdir($this->tempDir);
     $this->plugin = new PuliPlugin($this->puliRunner);
 }
开发者ID:kormik,项目名称:composer-plugin,代码行数:26,代码来源:PuliPluginTest.php

示例7: setUp

 protected function setUp()
 {
     while (false === mkdir($this->tempDir = sys_get_temp_dir() . '/puli-plugin/PuliPluginTest_root' . rand(10000, 99999), 0777, true)) {
     }
     $filesystem = new Filesystem();
     $filesystem->mirror(__DIR__ . '/Fixtures/root', $this->tempDir);
     $this->io = $this->getMock('Composer\\IO\\IOInterface');
     $this->config = new Config(false, $this->tempDir);
     $this->config->merge(array('config' => array('vendor-dir' => 'the-vendor')));
     $this->installationManager = $this->getMockBuilder('Composer\\Installer\\InstallationManager')->disableOriginalConstructor()->getMock();
     $this->installationManager->expects($this->any())->method('getInstallPath')->will($this->returnCallback(array($this, 'getInstallPath')));
     $this->rootPackage = new RootPackage('vendor/root', '1.0', '1.0');
     $this->localRepository = new TestLocalRepository(array(new Package('vendor/package1', '1.0', '1.0'), new Package('vendor/package2', '1.0', '1.0')));
     $this->repositoryManager = new RepositoryManager($this->io, $this->config);
     $this->repositoryManager->setLocalRepository($this->localRepository);
     $this->installPaths = array();
     $this->composer = new Composer();
     $this->composer->setRepositoryManager($this->repositoryManager);
     $this->composer->setInstallationManager($this->installationManager);
     $this->composer->setConfig($this->config);
     $this->composer->setPackage($this->rootPackage);
     $this->puliRunner = $this->getMockBuilder('Puli\\ComposerPlugin\\PuliRunner')->disableOriginalConstructor()->getMock();
     $this->previousWd = getcwd();
     chdir($this->tempDir);
     $this->plugin = new PuliPlugin($this->puliRunner);
 }
开发者ID:niklongstone,项目名称:composer-plugin,代码行数:26,代码来源:PuliPluginTest.php

示例8: setUp

 protected function setUp()
 {
     $this->fs = new Filesystem();
     $that = $this;
     $this->workingDir = $this->getUniqueTmpDirectory();
     $this->vendorDir = $this->workingDir . DIRECTORY_SEPARATOR . 'composer-test-autoload';
     $this->ensureDirectoryExistsAndClear($this->vendorDir);
     $this->config = $this->getMock('Composer\\Config');
     $this->configValueMap = array('vendor-dir' => function () use($that) {
         return $that->vendorDir;
     });
     $this->config->expects($this->atLeastOnce())->method('get')->will($this->returnCallback(function ($arg) use($that) {
         $ret = null;
         if (isset($that->configValueMap[$arg])) {
             $ret = $that->configValueMap[$arg];
             if (is_callable($ret)) {
                 $ret = $ret();
             }
         }
         return $ret;
     }));
     $this->origDir = getcwd();
     chdir($this->workingDir);
     $this->im = $this->getMockBuilder('Composer\\Installer\\InstallationManager')->disableOriginalConstructor()->getMock();
     $this->im->expects($this->any())->method('getInstallPath')->will($this->returnCallback(function ($package) use($that) {
         $targetDir = $package->getTargetDir();
         return $that->vendorDir . '/' . $package->getName() . ($targetDir ? '/' . $targetDir : '');
     }));
     $this->repository = $this->getMock('Composer\\Repository\\InstalledRepositoryInterface');
     $this->eventDispatcher = $this->getMockBuilder('Composer\\EventDispatcher\\EventDispatcher')->disableOriginalConstructor()->getMock();
     $this->generator = new AutoloadGenerator($this->eventDispatcher);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:32,代码来源:AutoloadGeneratorTest.php

示例9: mapContrib

 public function mapContrib(InstallationManager $im, RepositoryManager $rm)
 {
     $typePathMap = $this->getTypePathMap();
     $typeInstallMap = [];
     $packages = $rm->getLocalRepository()->getCanonicalPackages();
     foreach ($packages as $package) {
         if ($drupalType = $this->getDrupalType($package)) {
             $installPath = $im->getInstaller($package->getType())->getInstallPath($package);
             if (strpos($installPath, $root = $this->getRoot()) !== false) {
                 $installPath = $this->getFS()->makePathRelative($installPath, $root);
             }
             $name = explode('/', $package->getPrettyName())[1];
             $typeInstallMap[$drupalType][rtrim($installPath, '/')] = sprintf($typePathMap[$drupalType] . '/%s', 'contrib', $name);
         }
     }
     return array_intersect_key($typeInstallMap, $typePathMap);
 }
开发者ID:davidbarratt,项目名称:drupal-tangler,代码行数:17,代码来源:Mapper.php

示例10: updateFull

 /**
  * @test
  *
  * @depends testInstallerCreationShouldNotCreateVendorDirectory
  * @depends testInstallerCreationShouldNotCreateBinDirectory
  */
 public function updateFull()
 {
     /** @var InstallationManager|\PHPUnit_Framework_MockObject_MockObject $im */
     $this->im->expects($this->once())->method('uninstall');
     $this->im->expects($this->once())->method('install');
     $installer = $this->createInstaller();
     $initial = $this->createPackageMock('letudiant/bar-foo');
     $target = $this->createPackageMock();
     $installer->update($this->repository, $initial, $target);
 }
开发者ID:letudiant,项目名称:composer-shared-package-plugin,代码行数:16,代码来源:SharedPackageInstallerTest.php

示例11: build

 public function build($rootDirectory, $optimize = false, $noDevMode = false)
 {
     $this->io->write(sprintf('<info>Generating autoload files for monorepo sub-packages %s dev-dependencies.</info>', $noDevMode ? 'without' : 'with'));
     $start = microtime(true);
     $packages = $this->loadPackages($rootDirectory);
     $evm = new EventDispatcher(new Composer(), $this->io);
     $generator = new AutoloadGenerator($evm, $this->io);
     $generator->setDevMode(!$noDevMode);
     $installationManager = new InstallationManager();
     $installationManager->addInstaller(new MonorepoInstaller());
     foreach ($packages as $packageName => $config) {
         if (strpos($packageName, 'vendor') === 0) {
             continue;
         }
         $this->io->write(sprintf(' [Subpackage] <comment>%s</comment>', $packageName));
         $mainPackage = new Package($packageName, "@stable", "@stable");
         $mainPackage->setType('monorepo');
         $mainPackage->setAutoload($config['autoload']);
         $mainPackage->setDevAutoload($config['autoload-dev']);
         $localRepo = new MonorepoInstalledRepository();
         $this->resolvePackageDependencies($localRepo, $packages, $packageName);
         $composerConfig = new Config(true, $rootDirectory);
         $composerConfig->merge(array('config' => array('vendor-dir' => $config['path'] . '/vendor')));
         $generator->dump($composerConfig, $localRepo, $mainPackage, $installationManager, 'composer', $optimize);
         $binDir = $config['path'] . '/vendor/bin';
         // remove old symlinks
         array_map('unlink', glob($binDir . '/*'));
         foreach ($localRepo->getPackages() as $package) {
             foreach ($package->getBinaries() as $binary) {
                 if (!is_dir($binDir)) {
                     mkdir($binDir, 0755, true);
                 }
                 $binFile = $binDir . '/' . basename($binary);
                 symlink($rootDirectory . '/' . $binary, $binFile);
             }
         }
     }
     $duration = microtime(true) - $start;
     $this->io->write(sprintf('Monorepo subpackage autoloads generated in <comment>%0.2f</comment> seconds.', $duration));
 }
开发者ID:beberlei,项目名称:composer-monorepo-plugin,代码行数:40,代码来源:Build.php

示例12: setUp

 public function setUp()
 {
     $this->filesystem = new Filesystem();
     $this->composer = new Composer();
     $this->config = new Config();
     $this->io = new NullIO();
     $this->componentDir = realpath(sys_get_temp_dir()) . DIRECTORY_SEPARATOR . 'component-installer-componentDir';
     $this->vendorDir = realpath(sys_get_temp_dir()) . DIRECTORY_SEPARATOR . 'component-installer-vendorDir';
     $this->binDir = realpath(sys_get_temp_dir()) . DIRECTORY_SEPARATOR . 'component-installer-binDir';
     foreach (array($this->componentDir, $this->vendorDir, $this->binDir) as $dir) {
         if (is_dir($dir)) {
             $this->filesystem->removeDirectory($dir);
         }
         $this->filesystem->ensureDirectoryExists($dir);
     }
     $this->config->merge(array('config' => array('vendor-dir' => $this->vendorDir, 'component-dir' => $this->componentDir, 'bin-dir' => $this->binDir)));
     $this->composer->setConfig($this->config);
     // Set up the Installation Manager.
     $this->installationManager = new InstallationManager();
     $this->installationManager->addInstaller(new LibraryInstaller($this->io, $this->composer));
     $this->installationManager->addInstaller(new Installer($this->io, $this->composer));
     $this->composer->setInstallationManager($this->installationManager);
 }
开发者ID:SylvainSimon,项目名称:Metinify,代码行数:23,代码来源:ProcessTest.php

示例13: build

 public function build($rootDirectory, $optimize = false, $noDevMode = false)
 {
     $packages = $this->loadPackages($rootDirectory);
     $evm = new EventDispatcher(new Composer(), $this->io);
     $generator = new AutoloadGenerator($evm, $this->io);
     $generator->setDevMode(!$noDevMode);
     $installationManager = new InstallationManager();
     $installationManager->addInstaller(new FiddlerInstaller());
     $this->io->write('Building fiddler.json projects.');
     foreach ($packages as $packageName => $config) {
         if (strpos($packageName, 'vendor') === 0) {
             continue;
         }
         $this->io->write(' [Build] <info>' . $packageName . '</info>');
         $mainPackage = new Package($packageName, "@stable", "@stable");
         $mainPackage->setType('fiddler');
         $mainPackage->setAutoload($config['autoload']);
         $mainPackage->setDevAutoload($config['autoload-dev']);
         $localRepo = new FiddlerInstalledRepository();
         $this->resolvePackageDependencies($localRepo, $packages, $packageName);
         $composerConfig = new Config(true, $rootDirectory);
         $composerConfig->merge(array('config' => array('vendor-dir' => $config['path'] . '/vendor')));
         $generator->dump($composerConfig, $localRepo, $mainPackage, $installationManager, 'composer', $optimize);
         $binDir = $config['path'] . '/vendor/bin';
         // remove old symlinks
         array_map('unlink', glob($binDir . '/*'));
         foreach ($localRepo->getPackages() as $package) {
             foreach ($package->getBinaries() as $binary) {
                 if (!is_dir($binDir)) {
                     mkdir($binDir, 0755, true);
                 }
                 $binFile = $binDir . '/' . basename($binary);
                 symlink($rootDirectory . '/' . $binary, $binFile);
             }
         }
     }
 }
开发者ID:JasLin,项目名称:fiddler,代码行数:37,代码来源:Build.php

示例14: mirrorDirectory

 /**
  * @param string $packageName
  * @param string $sourceDirectory
  * @param string $targetDirectory
  */
 protected static function mirrorDirectory($packageName, $sourceDirectory, $targetDirectory)
 {
     $packages = static::$localRepository->findPackages($packageName, null);
     foreach ($packages as $package) {
         if (static::$installationManager->getInstaller($package->getType())->isInstalled(static::$localRepository, $package)) {
             static::getFileSystem()->mirror(static::$installationManager->getInstallPath($package) . '/' . ltrim($sourceDirectory, '/'), $targetDirectory, null, ['copy_on_windows']);
             return;
         }
     }
 }
开发者ID:ichhabrecht,项目名称:git-checker,代码行数:15,代码来源:Installer.php

示例15: getInstaller

 function getInstaller($packageType)
 {
     // if we don't support this type at all, move along to the rest of the installers
     if (!$this->wpInstaller->supports($packageType)) {
         $this->io->write("Composer-WP installer does not support {$packageType}", true, IOInterface::DEBUG);
         return parent::getInstaller($packageType);
     }
     // if we explicitly support this type, return the WP installer
     if ($this->wpInstaller->prioritySupports($packageType)) {
         $this->io->write("Composer-WP installer explicitly supports {$packageType}", true, IOInterface::DEBUG);
         return $this->wpInstaller;
     }
     // otherwise, check to see if there is another installer that supports this type before we claim it
     try {
         // this may throw an InvalidArgumentException if no installer is found, but
         // LibraryInstaller is a floozie and will take any package it can get its hands on
         $installer = parent::getInstaller($packageType);
         $class = get_class($installer);
         // is the selected installer just the default one?
         if ($class === 'Composer\\Installer\\LibraryInstaller') {
             throw new \InvalidArgumentException();
         }
         $this->io->write("Composer-WP installer supports {$packageType} but gives priority to {$class}", true, IOInterface::DEBUG);
         // set the path to false so we do not try again
         $this->wpInstaller->setPath($packageType, false);
         return $installer;
     } catch (\InvalidArgumentException $e) {
         $this->io->write("Composer-WP installer claims support for {$packageType}", true, IOInterface::DEBUG);
         // no custom installer, let's take charge!
         $this->wpInstaller->setPath($packageType);
         return $this->wpInstaller;
     }
 }
开发者ID:balbuf,项目名称:composer-wp,代码行数:33,代码来源:InstallationManager.php


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