mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 06:56:24 +00:00
fix(ruby): isValid for complex ranges
This commit is contained in:
parent
c02323ca5a
commit
ac63a5097c
2 changed files with 14 additions and 6 deletions
|
@ -32,13 +32,17 @@ const isSingleVersion = range => {
|
||||||
const isStable = version =>
|
const isStable = version =>
|
||||||
parseVersion(version).prerelease ? false : isVersion(version);
|
parseVersion(version).prerelease ? false : isVersion(version);
|
||||||
|
|
||||||
const isValid = range => {
|
const isValid = input =>
|
||||||
const { version, operator } = parseRange(range);
|
input
|
||||||
|
.split(',')
|
||||||
|
.map(piece => piece.trim())
|
||||||
|
.every(range => {
|
||||||
|
const { version, operator } = parseRange(range);
|
||||||
|
|
||||||
return operator
|
return operator
|
||||||
? isVersion(version) && isValidOperator(operator)
|
? isVersion(version) && isValidOperator(operator)
|
||||||
: isVersion(version);
|
: isVersion(version);
|
||||||
};
|
});
|
||||||
|
|
||||||
const matches = (version, range) => satisfies(version, range);
|
const matches = (version, range) => satisfies(version, range);
|
||||||
const maxSatisfyingVersion = (versions, range) =>
|
const maxSatisfyingVersion = (versions, range) =>
|
||||||
|
|
|
@ -297,6 +297,10 @@ describe('semverRuby', () => {
|
||||||
expect(semverRuby.isValid('~> 1.2.0-alpha.1')).toBeTruthy();
|
expect(semverRuby.isValid('~> 1.2.0-alpha.1')).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('returns true when range is valid', () => {
|
||||||
|
expect(semverRuby.isValid('>= 3.0.5, < 3.2')).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
it('returns false when version is invalid', () => {
|
it('returns false when version is invalid', () => {
|
||||||
expect(semverRuby.isVersion()).toBeFalsy();
|
expect(semverRuby.isVersion()).toBeFalsy();
|
||||||
expect(semverRuby.isVersion('')).toBeFalsy();
|
expect(semverRuby.isVersion('')).toBeFalsy();
|
||||||
|
|
Loading…
Reference in a new issue