Skip to content

Commit

Permalink
Replace deprecated VersionConstraint with Composer\Semver package (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomascube committed Oct 29, 2017
1 parent a2f7664 commit 782420a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"src/bin/rcubeinitdb.sh"
],
"require": {
"php": ">=5.3.0"
"php": ">=5.3.0",
"composer/semver": "^1.4.2"

This comment has been minimized.

Copy link
@nuxwin

nuxwin Oct 29, 2017

From my point of view, that require is not needed ;) You should instead require composer version that introduce this change.

See also https://github.com/i-MSCP/plugin-installer/blob/master/CHANGELOG.md for changes that could be merged into your package.

},
"require-dev": {
"composer/composer": "*"
Expand Down
4 changes: 2 additions & 2 deletions src/Roundcube/Composer/PluginInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Composer\Installer\LibraryInstaller;
use Composer\Package\Version\VersionParser;
use Composer\Package\LinkConstraint\VersionConstraint;
use Composer\Semver\Constraint\Constraint;
use Composer\Package\PackageInterface;
use Composer\Repository\InstalledRepositoryInterface;
use Composer\Util\ProcessExecutor;
Expand Down Expand Up @@ -177,7 +177,7 @@ private function rcubeVersionCheck($package)
foreach (array('min-version' => '>=', 'max-version' => '<=') as $key => $operator) {
if (!empty($extra['roundcube'][$key])) {
$version = $parser->normalize(str_replace('-git', '.999', $extra['roundcube'][$key]));
$constraint = new VersionConstraint($operator, $version);
$constraint = new Constraint($operator, $version);
if (!$constraint->versionCompare($rcubeVersion, $version, $operator)) {
throw new \Exception("Version check failed! " . $package->getName() . " requires Roundcube version $operator $version, $rcubeVersion was detected.");
}
Expand Down

0 comments on commit 782420a

Please # to comment.