commit
cce4d3af11
|
@ -23,7 +23,7 @@ $composer->setRepository('Platform', new Repository\PlatformRepository());
|
|||
$composer->setRepository('Packagist', new Repository\ComposerRepository('http://packagist.org'));
|
||||
|
||||
// initialize package
|
||||
$loader = new Package\Loader\Json();
|
||||
$loader = new Package\Loader\JsonLoader();
|
||||
$package = $loader->load('composer.json');
|
||||
|
||||
// initialize lock
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
"required": true
|
||||
},
|
||||
"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",
|
||||
"optional": true
|
||||
},
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
namespace Composer\Command;
|
||||
|
||||
use Composer\DependencyResolver;
|
||||
use Composer\DependencyResolver\Pool;
|
||||
use Composer\DependencyResolver\Request;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
|
@ -43,7 +45,7 @@ EOT
|
|||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
if ($this->getLock()->isLocked()) {
|
||||
$this->writeln('<info>Found lockfile. Reading</info>');
|
||||
$output->writeln('<info>Found lockfile. Reading</info>');
|
||||
|
||||
foreach ($this->getLock()->getLockedPackages() as $package) {
|
||||
$installer = $this->getComposer()->getInstaller($package->getType());
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
namespace Composer;
|
||||
|
||||
use Composer\Installer\InstallerInterface;
|
||||
use Composer\Repository\RepositoryInterface;
|
||||
|
||||
/**
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
|
|
|
@ -36,7 +36,7 @@ class ArrayLoader
|
|||
$version = $versionParser->parse($config['version']);
|
||||
$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'])) {
|
||||
$package->setExtra($config['extra']);
|
||||
|
@ -99,7 +99,7 @@ class ArrayLoader
|
|||
$links[] = new Package\Link($srcPackageName, $packageName, $constraint, $description);
|
||||
}
|
||||
|
||||
return $requirements;
|
||||
return $links;
|
||||
}
|
||||
|
||||
private function validateConfig(array $config)
|
||||
|
@ -107,9 +107,6 @@ class ArrayLoader
|
|||
if (!isset($config['name'])) {
|
||||
throw new \UnexpectedValueException('name is required for package');
|
||||
}
|
||||
if (!isset($config['type'])) {
|
||||
throw new \UnexpectedValueException('type is required for package');
|
||||
}
|
||||
if (!isset($config['version'])) {
|
||||
throw new \UnexpectedValueException('version is required for package');
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ namespace Composer\Repository;
|
|||
|
||||
use Composer\Package\MemoryPackage;
|
||||
use Composer\Package\BasePackage;
|
||||
use Composer\Package\Version\VersionParser;
|
||||
|
||||
/**
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
|
@ -24,10 +25,12 @@ class PlatformRepository extends ArrayRepository
|
|||
{
|
||||
parent::initialize();
|
||||
|
||||
$versionParser = new VersionParser();
|
||||
|
||||
try {
|
||||
$version = BasePackage::parseVersion(PHP_VERSION);
|
||||
$version = $versionParser->parse(PHP_VERSION);
|
||||
} 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']);
|
||||
|
@ -40,7 +43,7 @@ class PlatformRepository extends ArrayRepository
|
|||
|
||||
$reflExt = new \ReflectionExtension($ext);
|
||||
try {
|
||||
$version = BasePackage::parseVersion($reflExt->getVersion());
|
||||
$version = $versionParser->parse($reflExt->getVersion());
|
||||
} catch (\UnexpectedValueException $e) {
|
||||
$version = array('version' => '0', 'type' => 'stable');
|
||||
}
|
||||
|
|
|
@ -17,8 +17,5 @@ namespace Composer\Repository;
|
|||
*/
|
||||
interface RepositoryInterface extends \Countable
|
||||
{
|
||||
static function supports($type, $name = '', $url = '');
|
||||
static function create($type, $name = '', $url = '');
|
||||
|
||||
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()
|
||||
{
|
||||
$this->pool->addRepository($this->repoInstalled);
|
||||
|
|
Loading…
Reference in New Issue