private function getMediaWikiVersionConstraint()
 {
     $mvVersion = $this->versionFetcher->fetchVersion();
     $mvVersion = $this->versionNormalizer->normalizeSuffix($mvVersion);
     $version = new Constraint('==', $this->versionNormalizer->normalizeLevelCount($mvVersion));
     $version->setPrettyString($mvVersion);
     return $version;
 }
Ejemplo n.º 2
0
 /**
  * @return \Composer\Semver\Constraint\ConstraintInterface
  */
 public function getCurrentVersion()
 {
     if ($this->completePackage->getPrettyVersion() === 'N/A') {
         $constraint = new Constraint('=', '0.0.0.1');
         $constraint->setPrettyString('N/A');
         return $constraint;
     }
     return $this->versionParser->parseConstraints($this->completePackage->getPrettyVersion());
 }
Ejemplo n.º 3
0
 /**
  * @param  RootPackageInterface $rootPackage
  * @param  PlatformRepository   $platformRepo
  * @return Request
  */
 private function createRequest(RootPackageInterface $rootPackage, PlatformRepository $platformRepo)
 {
     $request = new Request();
     $constraint = new Constraint('=', $rootPackage->getVersion());
     $constraint->setPrettyString($rootPackage->getPrettyVersion());
     $request->install($rootPackage->getName(), $constraint);
     $fixedPackages = $platformRepo->getPackages();
     if ($this->additionalInstalledRepository) {
         $additionalFixedPackages = $this->additionalInstalledRepository->getPackages();
         $fixedPackages = array_merge($fixedPackages, $additionalFixedPackages);
     }
     // fix the version of all platform packages + additionally installed packages
     // to prevent the solver trying to remove or update those
     $provided = $rootPackage->getProvides();
     foreach ($fixedPackages as $package) {
         $constraint = new Constraint('=', $package->getVersion());
         $constraint->setPrettyString($package->getPrettyVersion());
         // skip platform packages that are provided by the root package
         if ($package->getRepository() !== $platformRepo || !isset($provided[$package->getName()]) || !$provided[$package->getName()]->getConstraint()->matches($constraint)) {
             $request->fix($package->getName(), $constraint);
         }
     }
     return $request;
 }
Ejemplo n.º 4
0
 protected function getVersionConstraint($operator, $version)
 {
     $constraint = new Constraint($operator, self::getVersionParser()->normalize($version));
     $constraint->setPrettyString($operator . ' ' . $version);
     return $constraint;
 }
Ejemplo n.º 5
0
 private function createConstraint($operator, $version)
 {
     $constraint = new Constraint($operator, $version);
     $constraint->setPrettyString($operator . ' ' . $version);
     return $constraint;
 }
 public function resolveFeatureBranch(Event $event)
 {
     if (empty($this->featureBranchRepositories)) {
         $this->io->write('No feature branches configured, continuing!');
         return;
     }
     $package = $this->composer->getPackage();
     if ($package->isDev()) {
         $featureBranchConstraint = new Constraint('=', $this->versionParser->normalize($package->getVersion()));
         $featureBranchConstraint->setPrettyString($package->getVersion());
         $requires = $package->getRequires();
         $this->io->write(sprintf("<info>Checking for feature branch '%s'</info>", $featureBranchConstraint->getPrettyString()));
         foreach ($requires as $key => $require) {
             if ($this->hasFeatureBranch($require, $featureBranchConstraint)) {
                 $requires[$key] = new Link($require->getSource(), $require->getTarget(), $featureBranchConstraint, 'requires', $featureBranchConstraint->getPrettyString());
             } else {
                 $fallbackBranch = $this->getFallbackBranch($require);
                 if ($fallbackBranch !== false) {
                     $fallbackConstraint = new Constraint('=', $this->versionParser->normalize($fallbackBranch));
                     $fallbackConstraint->setPrettyString($fallbackBranch);
                     $requires[$key] = new Link($require->getSource(), $require->getTarget(), $fallbackConstraint, 'requires', $fallbackConstraint->getPrettyString());
                 }
             }
             $this->io->write('');
         }
         $package->setRequires($requires);
     }
 }