commit
cce4d3af11
|
@ -23,7 +23,7 @@ $composer->setRepository('Platform', new Repository\PlatformRepository());
|
||||||
$composer->setRepository('Packagist', new Repository\ComposerRepository('http://packagist.org'));
|
$composer->setRepository('Packagist', new Repository\ComposerRepository('http://packagist.org'));
|
||||||
|
|
||||||
// initialize package
|
// initialize package
|
||||||
$loader = new Package\Loader\Json();
|
$loader = new Package\Loader\JsonLoader();
|
||||||
$package = $loader->load('composer.json');
|
$package = $loader->load('composer.json');
|
||||||
|
|
||||||
// initialize lock
|
// initialize lock
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
"required": true
|
"required": true
|
||||||
},
|
},
|
||||||
"type": {
|
"type": {
|
||||||
"description": "Package type, either 'Library', or the parent project it applies to if it's a plugin for a framework or application (e.g. 'Symfony2', 'Typo3', 'Drupal', ..).",
|
"description": "Package type, either 'Library', or the parent project it applies to if it's a plugin for a framework or application (e.g. 'Symfony2', 'Typo3', 'Drupal', ..), note that this has to be defined and communicated by any project implementing a custom composer installer, those are just unreliable examples.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
namespace Composer\Command;
|
namespace Composer\Command;
|
||||||
|
|
||||||
use Composer\DependencyResolver;
|
use Composer\DependencyResolver;
|
||||||
|
use Composer\DependencyResolver\Pool;
|
||||||
|
use Composer\DependencyResolver\Request;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
|
@ -43,7 +45,7 @@ EOT
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
if ($this->getLock()->isLocked()) {
|
if ($this->getLock()->isLocked()) {
|
||||||
$this->writeln('<info>Found lockfile. Reading</info>');
|
$output->writeln('<info>Found lockfile. Reading</info>');
|
||||||
|
|
||||||
foreach ($this->getLock()->getLockedPackages() as $package) {
|
foreach ($this->getLock()->getLockedPackages() as $package) {
|
||||||
$installer = $this->getComposer()->getInstaller($package->getType());
|
$installer = $this->getComposer()->getInstaller($package->getType());
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
namespace Composer;
|
namespace Composer;
|
||||||
|
|
||||||
use Composer\Installer\InstallerInterface;
|
use Composer\Installer\InstallerInterface;
|
||||||
|
use Composer\Repository\RepositoryInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||||
|
|
|
@ -36,7 +36,7 @@ class ArrayLoader
|
||||||
$version = $versionParser->parse($config['version']);
|
$version = $versionParser->parse($config['version']);
|
||||||
$package = new Package\MemoryPackage($config['name'], $version['version'], $version['type']);
|
$package = new Package\MemoryPackage($config['name'], $version['version'], $version['type']);
|
||||||
|
|
||||||
$package->setType($config['type']);
|
$package->setType(isset($config['type']) ? $config['type'] : 'library');
|
||||||
|
|
||||||
if (isset($config['extra'])) {
|
if (isset($config['extra'])) {
|
||||||
$package->setExtra($config['extra']);
|
$package->setExtra($config['extra']);
|
||||||
|
@ -99,7 +99,7 @@ class ArrayLoader
|
||||||
$links[] = new Package\Link($srcPackageName, $packageName, $constraint, $description);
|
$links[] = new Package\Link($srcPackageName, $packageName, $constraint, $description);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $requirements;
|
return $links;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function validateConfig(array $config)
|
private function validateConfig(array $config)
|
||||||
|
@ -107,9 +107,6 @@ class ArrayLoader
|
||||||
if (!isset($config['name'])) {
|
if (!isset($config['name'])) {
|
||||||
throw new \UnexpectedValueException('name is required for package');
|
throw new \UnexpectedValueException('name is required for package');
|
||||||
}
|
}
|
||||||
if (!isset($config['type'])) {
|
|
||||||
throw new \UnexpectedValueException('type is required for package');
|
|
||||||
}
|
|
||||||
if (!isset($config['version'])) {
|
if (!isset($config['version'])) {
|
||||||
throw new \UnexpectedValueException('version is required for package');
|
throw new \UnexpectedValueException('version is required for package');
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ namespace Composer\Repository;
|
||||||
|
|
||||||
use Composer\Package\MemoryPackage;
|
use Composer\Package\MemoryPackage;
|
||||||
use Composer\Package\BasePackage;
|
use Composer\Package\BasePackage;
|
||||||
|
use Composer\Package\Version\VersionParser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||||
|
@ -24,10 +25,12 @@ class PlatformRepository extends ArrayRepository
|
||||||
{
|
{
|
||||||
parent::initialize();
|
parent::initialize();
|
||||||
|
|
||||||
|
$versionParser = new VersionParser();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$version = BasePackage::parseVersion(PHP_VERSION);
|
$version = $versionParser->parse(PHP_VERSION);
|
||||||
} catch (\UnexpectedValueException $e) {
|
} catch (\UnexpectedValueException $e) {
|
||||||
$version = BasePackage::parseVersion(preg_replace('#^(.+?)(-.+)?$#', '$1', PHP_VERSION));
|
$version = $versionParser->parse(preg_replace('#^(.+?)(-.+)?$#', '$1', PHP_VERSION));
|
||||||
}
|
}
|
||||||
|
|
||||||
$php = new MemoryPackage('php', $version['version'], $version['type']);
|
$php = new MemoryPackage('php', $version['version'], $version['type']);
|
||||||
|
@ -40,7 +43,7 @@ class PlatformRepository extends ArrayRepository
|
||||||
|
|
||||||
$reflExt = new \ReflectionExtension($ext);
|
$reflExt = new \ReflectionExtension($ext);
|
||||||
try {
|
try {
|
||||||
$version = BasePackage::parseVersion($reflExt->getVersion());
|
$version = $versionParser->parse($reflExt->getVersion());
|
||||||
} catch (\UnexpectedValueException $e) {
|
} catch (\UnexpectedValueException $e) {
|
||||||
$version = array('version' => '0', 'type' => 'stable');
|
$version = array('version' => '0', 'type' => 'stable');
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,5 @@ namespace Composer\Repository;
|
||||||
*/
|
*/
|
||||||
interface RepositoryInterface extends \Countable
|
interface RepositoryInterface extends \Countable
|
||||||
{
|
{
|
||||||
static function supports($type, $name = '', $url = '');
|
|
||||||
static function create($type, $name = '', $url = '');
|
|
||||||
|
|
||||||
function getPackages();
|
function getPackages();
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,28 +213,6 @@ class SolverTest extends \PHPUnit_Framework_TestCase
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @TODO: fix packagist.org bug
|
|
||||||
*/
|
|
||||||
public function BROKEN_testSolverWithComposerRepo()
|
|
||||||
{
|
|
||||||
$this->repoInstalled = new PlatformRepository;
|
|
||||||
|
|
||||||
// overwrite solver with custom installed repo
|
|
||||||
$this->solver = new Solver($this->policy, $this->pool, $this->repoInstalled);
|
|
||||||
|
|
||||||
$this->repo = new ComposerRepository('http://packagist.org');
|
|
||||||
list($monolog) = $this->repo->getPackages();
|
|
||||||
|
|
||||||
$this->reposComplete();
|
|
||||||
|
|
||||||
$this->request->install('Monolog');
|
|
||||||
|
|
||||||
$this->checkSolverResult(array(
|
|
||||||
array('job' => 'install', 'package' => $monolog),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function reposComplete()
|
protected function reposComplete()
|
||||||
{
|
{
|
||||||
$this->pool->addRepository($this->repoInstalled);
|
$this->pool->addRepository($this->repoInstalled);
|
||||||
|
|
Loading…
Reference in New Issue