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


PHP Package::setExtra方法代码示例

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


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

示例1: testAppendCmdOutput

 public function testAppendCmdOutput()
 {
     $io = new NullIO();
     $pkg = new Package('test/test', 1, 1);
     $extra = ['bash-profile-dir' => dirname(self::$file)];
     $pkg->setExtra($extra);
     # Is appendable?
     $this->assertFileExists(self::$file);
     # Pretty much the same as the internal behavior.
     # This test as well tests if the tmp file setup worked out in the setup method.
     $source = file_get_contents(__DIR__ . '/../ci/.wpcli_profile');
     $result = file_put_contents(self::$file, $source, FILE_APPEND);
     $this->assertInternalType('integer', $result);
     $this->assertTrue(false !== strpos($source, file_get_contents(self::$file)));
     # Make and add file, check against existing data, …
     $this->assertTrue(Setup::appendCmd($io, $pkg));
     # …repetitive calls do not duplicate the appended auto-complete script.
     $this->assertFalse(Setup::appendCmd($io, $pkg));
 }
开发者ID:wecodemore,项目名称:wp-cli-composer,代码行数:19,代码来源:Test.php

示例2: build

 public function build(Addon $addon)
 {
     $composer = $this->packagist->getComposer();
     $downloader = $composer->getDownloadManager();
     $packageVersions = $this->packagist->getPackageVersions($addon->Name);
     $time = time();
     if (!$packageVersions) {
         throw new Exception('Could not find corresponding Packagist versions');
     }
     // Get the latest local and packagist version pair.
     $version = $addon->Versions()->filter('Development', true)->first();
     foreach ($packageVersions as $packageVersion) {
         if ($packageVersion->getVersionNormalized() != $version->Version) {
             continue;
         }
         $path = implode('/', array(TEMP_FOLDER, self::ADDONS_DIR, $addon->Name));
         // Convert PackagistAPI result into class compatible with Composer logic
         $package = new Package($addon->Name, $packageVersion->getVersionNormalized(), $packageVersion->getVersion());
         $package->setExtra($packageVersion->getExtra());
         if ($source = $packageVersion->getSource()) {
             $package->setSourceUrl($source->getUrl());
             $package->setSourceType($source->getType());
             $package->setSourceReference($source->getReference());
         }
         if ($dist = $packageVersion->getDist()) {
             $package->setDistUrl($dist->getUrl());
             $package->setDistType($dist->getType());
             $package->setDistReference($dist->getReference());
         }
         $this->download($package, $path);
         $this->buildReadme($addon, $path);
         $this->buildScreenshots($addon, $package, $path);
     }
     $addon->LastBuilt = $time;
     $addon->write();
 }
开发者ID:newleeland,项目名称:addons.silverstripe.org,代码行数:36,代码来源:AddonBuilder.php

示例3: testCustomInstallerName

 /**
  * testCustomInstallerName
  */
 public function testCustomInstallerName()
 {
     $installer = new Installer($this->io, $this->composer);
     $package = new Package('shama/cakephp-ftp-plugin', '1.0.0', '1.0.0');
     $package->setType('cakephp-plugin');
     $package->setExtra(array('installer-name' => 'FTP'));
     $result = $installer->getInstallPath($package);
     $this->assertEquals('Plugin/FTP/', $result);
 }
开发者ID:eacquah,项目名称:lolgh,代码行数:12,代码来源:InstallerTest.php

示例4: getPackageCopy

 /**
  * Get a simple copy of the package.
  *
  * @return Package
  */
 public function getPackageCopy()
 {
     $copy = new Package($this->package->getName(), $this->package->getVersion(), $this->package->getPrettyVersion());
     $copy->setType($this->package->getType());
     $copy->setExtra($this->package->getExtra());
     return $copy;
 }
开发者ID:anime-db,项目名称:anime-db,代码行数:12,代码来源:Job.php

示例5: addPackages

 /**
  * @param array $releases
  * @param string $connectPackage
  * @return RepositoryInterface
  */
 private function addPackages(array $releases, $connectPackage)
 {
     return new ArrayRepository(array_map(function ($release) use($connectPackage) {
         $distUrl = sprintf($this->distUrlFormat, $connectPackage, $release, $connectPackage, $release);
         $package = new Package(strtolower($connectPackage), $release, $release);
         $package->setDistUrl($distUrl);
         $package->setDistType('tar');
         $package->setType('magento-module');
         $package->setExtra(['package-xml' => "package.xml"]);
         return $package;
     }, $releases));
 }
开发者ID:adam-paterson,项目名称:magento-connect-composer-plugin,代码行数:17,代码来源:Plugin.php

示例6: addPackages

 /**
  * @param array $releases
  * @param string $connectPackage
  * @param VersionParser $versionParser
  * @return RepositoryInterface
  */
 private function addPackages(array $releases, $connectPackage, VersionParser $versionParser)
 {
     $releases = array_filter($releases, function ($release) use($versionParser) {
         try {
             $versionParser->normalize($release);
         } catch (UnexpectedValueException $e) {
             $this->writeVerbose(sprintf('Version "%s" is not valid. Skipping this version.', $release));
             return false;
         }
         return true;
     });
     return new ArrayRepository(array_map(function ($release) use($connectPackage, $versionParser) {
         $distUrl = sprintf($this->distUrlFormat, $connectPackage, $release, $connectPackage, $release);
         $release = $versionParser->normalize($release);
         $package = new Package(strtolower($connectPackage), $release, $release);
         $package->setDistUrl($distUrl);
         $package->setDistType('tar');
         $package->setType('magento-module');
         $package->setExtra(['package-xml' => "package.xml"]);
         return $package;
     }, $releases));
 }
开发者ID:AydinHassan,项目名称:magento-connect-composer-plugin,代码行数:28,代码来源:Plugin.php

示例7: testWordPressThemeCustom

 public function testWordPressThemeCustom()
 {
     $themeName = 'theme-name';
     $packageName = "wpackagist/{$themeName}";
     $installer = new Installer($this->io, $this->composer);
     $package = new Package($packageName, '1.0.0', '1.0.0');
     $package->setType('wordpress-theme');
     $base = 'base';
     $package->setExtra(['wordpress-base' => $base]);
     $path = $installer->getInstallPath($package);
     $expected = "{$base}/wp-content/themes/{$themeName}";
     $this->assertEquals($expected, $path);
 }
开发者ID:redefining,项目名称:wordpress-installer,代码行数:13,代码来源:InstallerTest.php

示例8: testUninstall

 public function testUninstall()
 {
     $this->fs->ensureDirectoryExists($this->pluginDir);
     $installer = new GingerInstaller($this->io, $this->composer);
     $repository = new ComposerRepositoryMock();
     $package = new Package('gingerwfms/wf-configurator-backend', '1.0.0', '1.0.0');
     $package->setType('ginger-backend-plugin');
     $package->setExtra(array('plugin-namespace' => 'WfConfiguratorBackend'));
     $repository->addPackage($package);
     $gate = new Gate();
     $mockBus = new CqrsBusMock();
     $pluginNamespace = '';
     $pluginName = '';
     $pluginType = '';
     $pluginVersion = '';
     $mockBus->mapCommand('GingerPluginInstaller\\Cqrs\\UninstallPluginCommand', function (UninstallPluginCommand $command) use(&$pluginNamespace, &$pluginName, &$pluginType, &$pluginVersion) {
         $pluginNamespace = $command->getPluginNamespace();
         $pluginName = $command->getPluginName();
         $pluginType = $command->getPluginType();
         $pluginVersion = $command->getPluginVersion();
     });
     $gate->attach($mockBus);
     $gate->setDefaultBusName($mockBus->getName());
     Bootstrap::getServiceManager()->setAllowOverride(true);
     Bootstrap::getServiceManager()->setService('malocher.cqrs.gate', $gate);
     $installer->uninstall($repository, $package);
     $this->assertSame('WfConfiguratorBackend', $pluginNamespace);
     $this->assertSame('gingerwfms/wf-configurator-backend', $pluginName);
     $this->assertSame('ginger-backend-plugin', $pluginType);
     $this->assertSame('1.0.0', $pluginVersion);
 }
开发者ID:gingerwfms,项目名称:ginger-plugin-installer,代码行数:31,代码来源:GingerInstallerTest.php

示例9: createStaticPackage

 /**
  * @param string $name
  * @param string $theme
  * @param array  $extra
  * @param bool   $createAssets
  * @param bool   $addGlob
  * @param bool   $addFiles
  * @return Package
  */
 public function createStaticPackage($name = 'some/static', $theme = 'package/theme', $extra = array(), $createAssets = true, $addGlob = false, $addFiles = false)
 {
     $package = new Package($name, "1.0.0", $name);
     $package->setExtra($extra);
     $package->setType('static');
     $rootPackageExtra = array_merge_recursive($this->composer->getPackage()->getExtra(), array('static-map' => array($name => array($theme => array(array('src' => 'assets', 'dest' => 'assets'))))));
     $this->composer->getPackage()->setExtra($rootPackageExtra);
     if ($createAssets) {
         $this->createStaticPackageAssets($package);
     }
     if ($addGlob) {
         $this->addGlobFiles($package);
     }
     if ($addFiles) {
         $this->addStandardFiles($package);
     }
     return $package;
 }
开发者ID:wearejh,项目名称:statics-merger,代码行数:27,代码来源:StaticsMergerPluginTest.php

示例10: testPackageExtraOptions

 /**
  * testPackageExtraOptions
  *
  * @dataProvider dataForTestPackageExtraOptions
  */
 public function testPackageExtraOptions($type, $path, $name, array $extra)
 {
     $installer = new BundleInstaller($this->io, $this->composer);
     $package = new Package($name, '1.0.0', '1.0.0');
     $package->setType($type);
     $package->setExtra($extra);
     $result = $installer->getInstallPath($package);
     $this->assertEquals($path, $result);
 }
开发者ID:davidsosavaldes,项目名称:Codeigniter-Bundle-Installer,代码行数:14,代码来源:BundleInstallerTest.php


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