Support version operators for plugin directory: >= and >
This commit is contained in:
parent
75a9e01a98
commit
ffd58d06fa
|
|
@ -24,6 +24,7 @@ Improvements:
|
|||
* Add "reference" hooks
|
||||
* Show project name in task forms
|
||||
* Convert vanilla CSS to SASS
|
||||
* Support version operators for plugin directory: >= and >
|
||||
|
||||
Other changes:
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,13 @@ class Directory extends BaseCore
|
|||
return true;
|
||||
}
|
||||
|
||||
foreach (array('>=', '>') as $operator) {
|
||||
if (strpos($plugin['compatible_version'], $operator) === 0) {
|
||||
$pluginVersion = substr($plugin['compatible_version'], strlen($operator));
|
||||
return version_compare($appVersion, $pluginVersion, $operator);
|
||||
}
|
||||
}
|
||||
|
||||
return $plugin['compatible_version'] === $appVersion;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,11 @@ class DirectoryTest extends Base
|
|||
$this->assertFalse($pluginDirectory->isCompatible(array('compatible_version' => '1.0.29'), '1.0.28'));
|
||||
$this->assertTrue($pluginDirectory->isCompatible(array('compatible_version' => '1.0.28'), '1.0.28'));
|
||||
$this->assertTrue($pluginDirectory->isCompatible(array('compatible_version' => '1.0.28'), 'master.1234'));
|
||||
$this->assertTrue($pluginDirectory->isCompatible(array('compatible_version' => '>=1.0.32'), 'master'));
|
||||
$this->assertTrue($pluginDirectory->isCompatible(array('compatible_version' => '>=1.0.32'), '1.0.32'));
|
||||
$this->assertTrue($pluginDirectory->isCompatible(array('compatible_version' => '>=1.0.32'), '1.0.33'));
|
||||
$this->assertTrue($pluginDirectory->isCompatible(array('compatible_version' => '>1.0.32'), '1.0.33'));
|
||||
$this->assertFalse($pluginDirectory->isCompatible(array('compatible_version' => '>1.0.32'), '1.0.32'));
|
||||
}
|
||||
|
||||
public function testGetAvailablePlugins()
|
||||
|
|
|
|||
Loading…
Reference in New Issue