mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-23 04:11:06 +07:00
Allow installing a specific Composer version
This commit is contained in:
parent
bc40a61480
commit
48f537d6d0
@ -285,6 +285,15 @@ describe('Tools tests', () => {
|
|||||||
expect(await tools.getComposerUrl('2')).toContain(
|
expect(await tools.getComposerUrl('2')).toContain(
|
||||||
'https://getcomposer.org/composer-2.phar'
|
'https://getcomposer.org/composer-2.phar'
|
||||||
);
|
);
|
||||||
|
expect(await tools.getComposerUrl('1.7.2')).toContain(
|
||||||
|
'https://github.com/composer/composer/releases/download/1.7.2/composer.phar'
|
||||||
|
);
|
||||||
|
expect(await tools.getComposerUrl('2.0.0-RC2')).toContain(
|
||||||
|
'https://github.com/composer/composer/releases/download/2.0.0-RC2/composer.phar'
|
||||||
|
);
|
||||||
|
expect(await tools.getComposerUrl('wrong')).toContain(
|
||||||
|
'https://getcomposer.org/composer-stable.phar'
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking getSymfonyUri', async () => {
|
it('checking getSymfonyUri', async () => {
|
||||||
|
4
dist/index.js
vendored
4
dist/index.js
vendored
@ -1930,6 +1930,10 @@ async function getComposerUrl(version) {
|
|||||||
case '2':
|
case '2':
|
||||||
return (cache_url + 'https://getcomposer.org/composer-' + version + '.phar');
|
return (cache_url + 'https://getcomposer.org/composer-' + version + '.phar');
|
||||||
default:
|
default:
|
||||||
|
if (/^\d+\.\d+\.\d+[\w-]*$/.test(version)) {
|
||||||
|
return (cache_url +
|
||||||
|
`https://github.com/composer/composer/releases/download/${version}/composer.phar`);
|
||||||
|
}
|
||||||
return cache_url + 'https://getcomposer.org/composer-stable.phar';
|
return cache_url + 'https://getcomposer.org/composer-stable.phar';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -321,6 +321,12 @@ export async function getComposerUrl(version: string): Promise<string> {
|
|||||||
cache_url + 'https://getcomposer.org/composer-' + version + '.phar'
|
cache_url + 'https://getcomposer.org/composer-' + version + '.phar'
|
||||||
);
|
);
|
||||||
default:
|
default:
|
||||||
|
if (/^\d+\.\d+\.\d+[\w-]*$/.test(version)) {
|
||||||
|
return (
|
||||||
|
cache_url +
|
||||||
|
`https://github.com/composer/composer/releases/download/${version}/composer.phar`
|
||||||
|
);
|
||||||
|
}
|
||||||
return cache_url + 'https://getcomposer.org/composer-stable.phar';
|
return cache_url + 'https://getcomposer.org/composer-stable.phar';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user