本文整理汇总了PHP中Composer\Composer类的典型用法代码示例。如果您正苦于以下问题:PHP Composer类的具体用法?PHP Composer怎么用?PHP Composer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Composer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: activate
/**
* {@inheritdoc}
*/
public function activate(Composer $composer, IOInterface $io)
{
foreach (static::$types as $type) {
$installer = new WordpressInstaller($io, $composer, $type);
$composer->getInstallationManager()->addInstaller($installer);
}
}
开发者ID:rjelierse,项目名称:composer-plugin-wordpress,代码行数:10,代码来源:WordpressInstallerPlugin.php
示例2: activate
public function activate(Composer $composer, IOInterface $io)
{
$this->io = $io;
$vendor = $composer->getConfig()->get('vendor-dir', '/');
$this->vendor = $vendor;
$this->root = dirname($vendor);
}
开发者ID:HRMsimon,项目名称:hhvm-autoload,代码行数:7,代码来源:ComposerPlugin.php
示例3: setUp
public function setUp()
{
$this->config = $this->getMock('Composer\Config');
$this->config->expects($this->any())
->method('get')
->will($this->returnCallback(function ($key) {
switch ($key) {
case 'cache-repo-dir':
return sys_get_temp_dir() . '/composer-test-repo-cache';
case 'vendor-dir':
return sys_get_temp_dir() . '/composer-test/vendor';
}
return null;
}));
$this->rootPackage = $this->getMock('Composer\Package\RootPackageInterface');
$this->package = $this->getMock('Composer\Package\PackageInterface');
$this->package->expects($this->any())
->method('getName')
->will($this->returnValue('foo-asset/foo'));
$this->composer = $this->getMock('Composer\Composer');
$this->composer->expects($this->any())
->method('getPackage')
->will($this->returnValue($this->rootPackage));
$this->composer->expects($this->any())
->method('getConfig')
->will($this->returnValue($this->config));
}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:30,代码来源:IgnoreFactoryTest.php
示例4: testSetGetInstallationManager
public function testSetGetInstallationManager()
{
$composer = new Composer();
$manager = $this->getMock('Composer\\Installer\\InstallationManager');
$composer->setInstallationManager($manager);
$this->assertSame($manager, $composer->getInstallationManager());
}
开发者ID:alancleaver,项目名称:composer,代码行数:7,代码来源:ComposerTest.php
示例5: activate
/**
* @param Composer $composer
* @param IOInterface $io
*/
public function activate(Composer $composer, IOInterface $io)
{
$repositoryManager = $composer->getRepositoryManager();
$extra = $composer->getPackage()->getExtra();
if (!isset($extra['connect-packages'])) {
return;
}
$versionParser = new VersionParser();
$links = [];
foreach ($extra['connect-packages'] as $connectPackage => $version) {
try {
$releases = $this->getVersionsForPackage($connectPackage);
} catch (InvalidArgumentException $e) {
$message = '<error>Could not find release manifest for module with extension key: "%s". ';
$message .= 'Did you get the casing right? Error: "%s"</error>';
$io->writeError(sprintf($message, $connectPackage, $e->getMessage()), true);
continue;
} catch (UnexpectedValueException $e) {
$message = '<error>Non valid XML return from connect for module with extension key: "%s".</error>';
$message .= $e->getMessage();
$io->writeError(sprintf($message, $connectPackage), true);
continue;
}
$repository = $this->addPackages($releases, $connectPackage);
$repositoryManager->addRepository($repository);
$constraint = $versionParser->parseConstraints($version);
$links[] = new Link($composer->getPackage()->getName(), $connectPackage, $constraint);
}
if (!empty($links)) {
$requires = $composer->getPackage()->getRequires();
$requires = array_merge($requires, $links);
$composer->getPackage()->setRequires($requires);
}
}
开发者ID:adam-paterson,项目名称:magento-connect-composer-plugin,代码行数:38,代码来源:Plugin.php
示例6: activate
/**
* {@inheritDoc}
*/
public function activate(Composer $composer, IOInterface $io)
{
$pluginInstaller = new PluginInstaller($io, $composer);
$composer->getInstallationManager()->addInstaller($pluginInstaller);
//$themeInstaller = new ThemeInstaller($io, $composer);
//$composer->getInstallationManager()->addInstaller($themeInstaller);
}
开发者ID:mage2,项目名称:plugin-installer,代码行数:10,代码来源:Mage2Plugin.php
示例7: testGetLocations
/**
* Test getLocations returning appropriate values based on CakePHP version
*
*/
public function testGetLocations()
{
$package = new RootPackage('CamelCased', '1.0', '1.0');
$composer = new Composer();
$rm = new RepositoryManager($this->getMock('Composer\\IO\\IOInterface'), $this->getMock('Composer\\Config'));
$composer->setRepositoryManager($rm);
$installer = new CakePHPInstaller($package, $composer);
// 2.0 < cakephp < 3.0
$this->setCakephpVersion($rm, '2.0.0');
$result = $installer->getLocations();
$this->assertContains('Plugin/', $result['plugin']);
$this->setCakephpVersion($rm, '2.5.9');
$result = $installer->getLocations();
$this->assertContains('Plugin/', $result['plugin']);
$this->setCakephpVersion($rm, '~2.5');
$result = $installer->getLocations();
$this->assertContains('Plugin/', $result['plugin']);
// special handling for 2.x versions when 3.x is still in development
$this->setCakephpVersion($rm, 'dev-master');
$result = $installer->getLocations();
$this->assertContains('Plugin/', $result['plugin']);
$this->setCakephpVersion($rm, '>=2.5');
$result = $installer->getLocations();
$this->assertContains('Plugin/', $result['plugin']);
// cakephp >= 3.0
$this->setCakephpVersion($rm, '3.0.*-dev');
$result = $installer->getLocations();
$this->assertContains('plugins/', $result['plugin']);
$this->setCakephpVersion($rm, '~8.8');
$result = $installer->getLocations();
$this->assertContains('plugins/', $result['plugin']);
}
开发者ID:nooshin-mirzadeh,项目名称:web_2.0_benchmark,代码行数:36,代码来源:CakePHPInstallerTest.php
示例8: 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
示例9: __construct
/**
* @param \Composer\Composer $composer
* @param \Composer\Util\Filesystem $filesystem
*/
public function __construct(\Composer\Composer $composer, \Composer\Util\Filesystem $filesystem = NULL)
{
$this->composer = $composer;
$this->downloadManager = $composer->getDownloadManager();
$this->filesystem = $filesystem ?: new \Composer\Util\Filesystem();
$this->extensionDir = self::TYPO3_CONF_DIR . DIRECTORY_SEPARATOR . self::TYPO3_EXT_DIR;
}
开发者ID:AOEpeople,项目名称:CmsComposerInstallers,代码行数:11,代码来源:ExtensionInstaller.php
示例10: createComposerInstance
private function createComposerInstance()
{
$composer = new Composer();
$config = new Config();
$composer->setConfig($config);
return $composer;
}
开发者ID:detain,项目名称:composer,代码行数:7,代码来源:RunScriptCommandTest.php
示例11: getPackageInstallPath
public static function getPackageInstallPath(PackageInterface $package, Composer $composer)
{
$prettyName = $package->getPrettyName();
if (strpos($prettyName, '/') !== false) {
list($vendor, $name) = explode('/', $prettyName);
} else {
$vendor = '';
$name = $prettyName;
}
$availableVars = compact('name', 'vendor');
$extra = $package->getExtra();
if (!empty($extra['installer-name'])) {
$availableVars['name'] = $extra['installer-name'];
}
if ($composer->getPackage()) {
$extra = $composer->getPackage()->getExtra();
if (!empty($extra['installer-paths'])) {
$customPath = self::mapCustomInstallPaths($extra['installer-paths'], $prettyName);
if (false !== $customPath) {
return self::templatePath($customPath, $availableVars);
}
}
}
return NULL;
}
开发者ID:mnsami,项目名称:composer-custom-directory-installer,代码行数:25,代码来源:PackageUtils.php
示例12: callRecursive
/**
* Call extra recursive
* @param Composer $composer
* @param IExtra $extra
*/
private function callRecursive(Composer $composer, IExtra $extra)
{
$extra->run($composer->getPackage(), true);
foreach ($composer->getRepositoryManager()->getLocalRepository()->getPackages() as $package) {
$extra->run($package, false);
}
}
开发者ID:pipaslot,项目名称:modules,代码行数:12,代码来源:Extra.php
示例13: activate
public function activate(Composer $composer, IO\IOInterface $io)
{
$this->composer = $composer;
$this->config = $composer->getConfig();
$this->io = $io;
$this->pluginConfig = $this->setPluginConfig();
}
开发者ID:harimau99,项目名称:prestissimo,代码行数:7,代码来源:Plugin.php
示例14: getConsoleCommands
public static function getConsoleCommands(Composer $composer)
{
$commands = array(array('yiic', 'migrate'));
if ($composer->getPackage()) {
$extra = $composer->getPackage()->getExtra();
if (!empty($extra['yiicomposer-console-commands'])) {
$tmp = $extra['yiicomposer-console-commands'];
}
if (!empty($tmp)) {
$commands = array();
foreach ($tmp as $c) {
$command = array();
$command[] = 'yiic';
$command[] = $c['controller'];
if (!empty($c['action'])) {
$command[] = $c['action'];
}
if (!empty($c['params'])) {
$command = array_merge($command, $c['params']);
}
if (!empty($c['params'])) {
foreach ($c['params'] as $k => $v) {
$command[] = '--' . $k . '=' . $v;
}
}
$commands[] = $command;
}
}
}
return $commands;
}
开发者ID:mihaildev,项目名称:yiicomposer,代码行数:31,代码来源:Console.php
示例15: __construct
public function __construct(PackageInterface $package = null, Composer $composer = null, IOInterface $io = null)
{
if (null === $package) {
$package = $composer->getPackage();
}
$extraOxidRoot = $extraModuleVendor = false;
if (null !== $package) {
$extra = $package->getExtra();
if (isset($extra['oxid-root'])) {
foreach ($this->locations as $name => $location) {
$this->locations[$name] = "{$extra['oxid-root']}/{$location}";
}
$extraOxidRoot = true;
}
if (isset($extra['module-vendor'])) {
$this->locations['module'] = str_replace('modules/', "modules/{$extra['module-vendor']}/", $this->locations['module']);
$extraModuleVendor = true;
}
}
$composerPackage = $composer->getPackage();
if (null !== $composerPackage) {
$extra = $composerPackage->getExtra();
if (isset($extra['oxid-root']) && !$extraOxidRoot) {
foreach ($this->locations as $name => $location) {
$this->locations[$name] = "{$extra['oxid-root']}/{$location}";
}
}
if (isset($extra['module-vendor']) && !$extraModuleVendor) {
$this->locations['module'] = str_replace('modules/', "modules/{$extra['module-vendor']}/", $this->locations['module']);
}
}
parent::__construct($package, $composer, $io);
}
开发者ID:kyoya-de,项目名称:installers,代码行数:33,代码来源:OxidInstaller.php
示例16: activate
/**
* Apply plugin modifications to composer
* TODO: If we get updated by composer there will be 2 instances afterwards.
* The old as Xinc\Composer\Plugin and the new one as Xinc\Composer\Plugin_composer_tmp0
* So we activate 2 Installer.
*
* @param Composer $composer
* @param IOInterface $io
* @return void
*/
public function activate(Composer $composer, IOInterface $io)
{
// Register our own installer
$composer->getInstallationManager()->addInstaller(new Installer($io, $composer));
$this->composer = $composer;
$this->io = $io;
}
开发者ID:Xinc-org,项目名称:Xinc.Composer,代码行数:17,代码来源:Plugin.php
示例17: dumpFiles
/**
* @param \Composer\Composer
* @param string
* @param string
*/
public function dumpFiles(Composer $composer, $paths, $targetDir = 'composer')
{
$installationManager = $composer->getInstallationManager();
$localRepo = $composer->getRepositoryManager()->getLocalRepository();
$mainPackage = $composer->getPackage();
$config = $composer->getConfig();
$filesystem = new Filesystem();
$basePath = $filesystem->normalizePath(realpath(getcwd()));
$vendorPath = $filesystem->normalizePath(realpath($config->get('vendor-dir')));
$targetDir = $vendorPath . '/' . $targetDir;
$vendorPathCode = $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true);
$vendorPathCode52 = str_replace('__DIR__', 'dirname(__FILE__)', $vendorPathCode);
$appBaseDirCode = $filesystem->findShortestPathCode($vendorPath, $basePath, true);
$appBaseDirCode = str_replace('__DIR__', '$vendorDir', $appBaseDirCode);
$packageMap = $this->buildPackageMap($installationManager, $mainPackage, $localRepo->getCanonicalPackages());
$autoloads = $this->parseAutoloads($packageMap, $mainPackage);
$paths = $this->parseAutoloadsTypeFiles($paths, $mainPackage);
$autoloads['files'] = array_merge($paths, $autoloads['files']);
$includeFilesFilePath = $targetDir . '/autoload_files.php';
if ($includeFilesFileContents = $this->getIncludeFilesFile($autoloads['files'], $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
file_put_contents($includeFilesFilePath, $includeFilesFileContents);
} elseif (file_exists($includeFilesFilePath)) {
unlink($includeFilesFilePath);
}
}
开发者ID:funkjedi,项目名称:composer-include-files,代码行数:30,代码来源:AutoloadGenerator.php
示例18: getVersion
/**
* Returns the PhantomJS version number.
*
* Firstly, we search for a version number in the local repository,
* secondly, in the root package.
* A version specification of "dev-master#<commit-reference>" is disallowed.
*
* @param Composer $composer
* @return string $version Version
*/
public static function getVersion($composer)
{
$packages = $composer->getRepositoryManager()->getLocalRepository()->getCanonicalPackages();
$os = self::getOS();
foreach ($packages as $package) {
if ($package->getName() === 'triplekdev/phantomjs-installer') {
$version = $package->getPrettyVersion();
}
}
// version was not found in the local repository, let's take a look at the root package
if ($version == null) {
$version = self::getRequiredVersion($composer->getPackage(), 'triplekdev/phantomjs-installer');
}
// fallback to a hardcoded version number, if "dev-master" was set
if ($version === 'dev-master') {
return $os === 'macosx' ? '2.0.1' : '1.9.8';
}
// grab version from commit-reference, e.g. "dev-master#<commit-ref> as version"
if (preg_match('/dev-master#(?:.*)(\\d.\\d.\\d)/i', $version, $matches)) {
return $matches[1];
}
// grab version from a git version tag with a patch level, like "1.9.8-2"
if (preg_match('/(\\d.\\d.\\d)(?:(?:-\\d)?)/i', $version, $matches)) {
return $matches[1];
}
// grab version from a Composer patch version tag with a patch level, like "1.9.8-p02"
if (preg_match('/(\\d.\\d.\\d)(?:(?:-p\\d{2})?)/i', $version, $matches)) {
return $matches[1];
}
return $version;
}
开发者ID:kevmt,项目名称:phantomjs-installer,代码行数:41,代码来源:Installer.php
示例19: activate
/**
* Activate Wordpress plugin
*
* @param Composer $composer Composer
* @param IOInterface $io IO
*
* @return void
*/
public function activate(Composer $composer, IOInterface $io)
{
$this->package = $composer->getPackage();
$this->io = $io;
// TODO: get the project root - must be a better way to do this
$this->projectRoot = realpath(dirname($composer->getConfig()->get('vendor-dir')));
}
开发者ID:markwilson,项目名称:wp-composer-plugin,代码行数:15,代码来源:WordpressPlugin.php
示例20: activate
/**
* @inheritdoc
*/
public function activate(Composer $composer, IOInterface $io)
{
$this->io = $io;
//Extend download manager
$dm = $composer->getDownloadManager();
$executor = new ProcessExecutor($io);
$fs = new Filesystem($executor);
$config = $composer->getConfig();
$dm->setDownloader('svn-export', new Downloader($io, $config, $executor, $fs));
//Extend RepositoryManager Classes
$rm = $composer->getRepositoryManager();
$rm->setRepositoryClass('svn-export', 'LinearSoft\\Composer\\SvnExport\\Repository\\VcsRepository');
$rm->setRepositoryClass('svn-export-composer', 'LinearSoft\\Composer\\SvnExport\\Repository\\ComposerRepository');
//Load Extra Data
$extra = $composer->getPackage()->getExtra();
if (isset($extra['svn-export-repositories']) && is_array($extra['svn-export-repositories'])) {
foreach ($extra['svn-export-repositories'] as $index => $repoConfig) {
$this->validateRepositories($index, $repoConfig);
if (isset($repoConfig['name'])) {
$name = $repoConfig['name'];
} else {
$name = is_int($index) ? preg_replace('{^https?://}i', '', $repoConfig['url']) : $index;
}
if ($repoConfig['type'] === 'svn') {
$repoConfig['type'] = 'svn-export';
} else {
$repoConfig['type'] = 'svn-export-composer';
}
$repo = $rm->createRepository($repoConfig['type'], $repoConfig);
$rm->addRepository($repo);
$this->io->write("Added SvnExport repo: {$name}");
}
}
}
开发者ID:linearsoft,项目名称:composer-svn-export,代码行数:37,代码来源:Plugin.php
注:本文中的Composer\Composer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论