remember prefer-stable setting in composer.lock
parent
e77435cd0c
commit
d47d9eb253
|
@ -277,7 +277,8 @@ class Installer
|
||||||
$platformDevReqs,
|
$platformDevReqs,
|
||||||
$aliases,
|
$aliases,
|
||||||
$this->package->getMinimumStability(),
|
$this->package->getMinimumStability(),
|
||||||
$this->package->getStabilityFlags()
|
$this->package->getStabilityFlags(),
|
||||||
|
$this->package->getPreferStable()
|
||||||
);
|
);
|
||||||
if ($updatedLock) {
|
if ($updatedLock) {
|
||||||
$this->io->write('<info>Writing lock file</info>');
|
$this->io->write('<info>Writing lock file</info>');
|
||||||
|
@ -647,7 +648,7 @@ class Installer
|
||||||
|
|
||||||
private function createPolicy()
|
private function createPolicy()
|
||||||
{
|
{
|
||||||
return new DefaultPolicy($this->package->getPreferStable());
|
return new DefaultPolicy((!$this->update && $this->locker->isLocked()) ? $this->locker->getPreferStable() : $this->package->getPreferStable());
|
||||||
}
|
}
|
||||||
|
|
||||||
private function createRequest(Pool $pool, RootPackageInterface $rootPackage, PlatformRepository $platformRepo)
|
private function createRequest(Pool $pool, RootPackageInterface $rootPackage, PlatformRepository $platformRepo)
|
||||||
|
|
|
@ -173,6 +173,13 @@ class Locker
|
||||||
return isset($lockData['stability-flags']) ? $lockData['stability-flags'] : array();
|
return isset($lockData['stability-flags']) ? $lockData['stability-flags'] : array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getPreferStable()
|
||||||
|
{
|
||||||
|
$lockData = $this->getLockData();
|
||||||
|
|
||||||
|
return isset($lockData['prefer-stable']) ? $lockData['prefer-stable'] : false;
|
||||||
|
}
|
||||||
|
|
||||||
public function getAliases()
|
public function getAliases()
|
||||||
{
|
{
|
||||||
$lockData = $this->getLockData();
|
$lockData = $this->getLockData();
|
||||||
|
@ -206,7 +213,7 @@ class Locker
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function setLockData(array $packages, $devPackages, array $platformReqs, $platformDevReqs, array $aliases, $minimumStability, array $stabilityFlags)
|
public function setLockData(array $packages, $devPackages, array $platformReqs, $platformDevReqs, array $aliases, $minimumStability, array $stabilityFlags, $preferStable)
|
||||||
{
|
{
|
||||||
$lock = array(
|
$lock = array(
|
||||||
'_readme' => array('This file locks the dependencies of your project to a known state',
|
'_readme' => array('This file locks the dependencies of your project to a known state',
|
||||||
|
@ -218,6 +225,7 @@ class Locker
|
||||||
'aliases' => array(),
|
'aliases' => array(),
|
||||||
'minimum-stability' => $minimumStability,
|
'minimum-stability' => $minimumStability,
|
||||||
'stability-flags' => $stabilityFlags,
|
'stability-flags' => $stabilityFlags,
|
||||||
|
'prefer-stable' => $preferStable,
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($aliases as $package => $versions) {
|
foreach ($aliases as $package => $versions) {
|
||||||
|
|
|
@ -47,6 +47,7 @@ install --prefer-dist
|
||||||
"stability-flags": {
|
"stability-flags": {
|
||||||
"a/a": 20
|
"a/a": 20
|
||||||
},
|
},
|
||||||
|
"prefer-stable": false,
|
||||||
"platform": [],
|
"platform": [],
|
||||||
"platform-dev": []
|
"platform-dev": []
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,8 @@ Requirements from the composer file are not installed if the lock file is presen
|
||||||
"packages-dev": null,
|
"packages-dev": null,
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
"minimum-stability": "stable",
|
"minimum-stability": "stable",
|
||||||
"stability-flags": []
|
"stability-flags": [],
|
||||||
|
"prefer-stable": false
|
||||||
}
|
}
|
||||||
--RUN--
|
--RUN--
|
||||||
install
|
install
|
||||||
|
|
|
@ -32,7 +32,8 @@ Installing an old alias that doesn't exist anymore from a lock is possible
|
||||||
"packages-dev": null,
|
"packages-dev": null,
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
"minimum-stability": "dev",
|
"minimum-stability": "dev",
|
||||||
"stability-flags": []
|
"stability-flags": [],
|
||||||
|
"prefer-stable": false
|
||||||
}
|
}
|
||||||
--RUN--
|
--RUN--
|
||||||
install
|
install
|
||||||
|
|
|
@ -35,6 +35,7 @@ Partial update from lock file should apply lock file and downgrade unstable pack
|
||||||
"stability-flags": {
|
"stability-flags": {
|
||||||
"b/unstable": 15
|
"b/unstable": 15
|
||||||
},
|
},
|
||||||
|
"prefer-stable": false,
|
||||||
"platform": [],
|
"platform": [],
|
||||||
"platform-dev": []
|
"platform-dev": []
|
||||||
}
|
}
|
||||||
|
@ -57,6 +58,7 @@ update c/uptodate
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
"minimum-stability": "stable",
|
"minimum-stability": "stable",
|
||||||
"stability-flags": [],
|
"stability-flags": [],
|
||||||
|
"prefer-stable": false,
|
||||||
"platform": [],
|
"platform": [],
|
||||||
"platform-dev": []
|
"platform-dev": []
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ Partial update from lock file should update everything to the state of the lock,
|
||||||
"stability-flags": {
|
"stability-flags": {
|
||||||
"b/unstable": 15
|
"b/unstable": 15
|
||||||
},
|
},
|
||||||
|
"prefer-stable": false,
|
||||||
"platform": [],
|
"platform": [],
|
||||||
"platform-dev": []
|
"platform-dev": []
|
||||||
}
|
}
|
||||||
|
@ -57,6 +58,7 @@ update b/unstable
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
"minimum-stability": "stable",
|
"minimum-stability": "stable",
|
||||||
"stability-flags": [],
|
"stability-flags": [],
|
||||||
|
"prefer-stable": false,
|
||||||
"platform": [],
|
"platform": [],
|
||||||
"platform-dev": []
|
"platform-dev": []
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@ update b/unstable
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
"minimum-stability": "stable",
|
"minimum-stability": "stable",
|
||||||
"stability-flags": [],
|
"stability-flags": [],
|
||||||
|
"prefer-stable": false,
|
||||||
"platform": [],
|
"platform": [],
|
||||||
"platform-dev": []
|
"platform-dev": []
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,8 @@ Update aliased package does not mess up the lock file
|
||||||
"packages-dev": null,
|
"packages-dev": null,
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
"minimum-stability": "dev",
|
"minimum-stability": "dev",
|
||||||
"stability-flags": []
|
"stability-flags": [],
|
||||||
|
"prefer-stable": false
|
||||||
}
|
}
|
||||||
--INSTALLED--
|
--INSTALLED--
|
||||||
[
|
[
|
||||||
|
@ -64,6 +65,7 @@ update
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
"minimum-stability": "dev",
|
"minimum-stability": "dev",
|
||||||
"stability-flags": [],
|
"stability-flags": [],
|
||||||
|
"prefer-stable": false,
|
||||||
"platform": [],
|
"platform": [],
|
||||||
"platform-dev": []
|
"platform-dev": []
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,8 @@ Limited update takes rules from lock if available, and not from the installed re
|
||||||
"packages-dev": null,
|
"packages-dev": null,
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
"minimum-stability": "stable",
|
"minimum-stability": "stable",
|
||||||
"stability-flags": []
|
"stability-flags": [],
|
||||||
|
"prefer-stable": false
|
||||||
}
|
}
|
||||||
--INSTALLED--
|
--INSTALLED--
|
||||||
[
|
[
|
||||||
|
|
|
@ -19,7 +19,8 @@ Installing locked dev packages should remove old dependencies
|
||||||
"packages-dev": null,
|
"packages-dev": null,
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
"minimum-stability": "dev",
|
"minimum-stability": "dev",
|
||||||
"stability-flags": []
|
"stability-flags": [],
|
||||||
|
"prefer-stable": false
|
||||||
}
|
}
|
||||||
--INSTALLED--
|
--INSTALLED--
|
||||||
[
|
[
|
||||||
|
|
|
@ -31,7 +31,8 @@ Updating a dev package for new reference updates the url and reference
|
||||||
"packages-dev": null,
|
"packages-dev": null,
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
"minimum-stability": "dev",
|
"minimum-stability": "dev",
|
||||||
"stability-flags": {"a/a":20}
|
"stability-flags": {"a/a":20},
|
||||||
|
"prefer-stable": false
|
||||||
}
|
}
|
||||||
--INSTALLED--
|
--INSTALLED--
|
||||||
[
|
[
|
||||||
|
@ -57,6 +58,7 @@ update
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
"minimum-stability": "dev",
|
"minimum-stability": "dev",
|
||||||
"stability-flags": {"a/a":20},
|
"stability-flags": {"a/a":20},
|
||||||
|
"prefer-stable": false,
|
||||||
"platform": [],
|
"platform": [],
|
||||||
"platform-dev": []
|
"platform-dev": []
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,9 +134,10 @@ class LockerTest extends \PHPUnit_Framework_TestCase
|
||||||
'stability-flags' => array(),
|
'stability-flags' => array(),
|
||||||
'platform' => array(),
|
'platform' => array(),
|
||||||
'platform-dev' => array(),
|
'platform-dev' => array(),
|
||||||
|
'prefer-stable' => false,
|
||||||
));
|
));
|
||||||
|
|
||||||
$locker->setLockData(array($package1, $package2), array(), array(), array(), array(), 'dev', array());
|
$locker->setLockData(array($package1, $package2), array(), array(), array(), array(), 'dev', array(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testLockBadPackages()
|
public function testLockBadPackages()
|
||||||
|
@ -155,7 +156,7 @@ class LockerTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
$this->setExpectedException('LogicException');
|
$this->setExpectedException('LogicException');
|
||||||
|
|
||||||
$locker->setLockData(array($package1), array(), array(), array(), array(), 'dev', array());
|
$locker->setLockData(array($package1), array(), array(), array(), array(), 'dev', array(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIsFresh()
|
public function testIsFresh()
|
||||||
|
|
Loading…
Reference in New Issue