mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +07:00
Remove unnecessary parameter version from addArchive
This commit is contained in:
parent
ffded4a3e8
commit
a31f8b1a2b
@ -300,21 +300,18 @@ describe('Tools tests', () => {
|
||||
it('checking addArchive', async () => {
|
||||
let script: string = await tools.addArchive(
|
||||
'tool',
|
||||
'1.2.3',
|
||||
'https://tool.com/tool.phar',
|
||||
'linux'
|
||||
);
|
||||
expect(script).toContain('add_tool https://tool.com/tool.phar tool');
|
||||
script = await tools.addArchive(
|
||||
'tool',
|
||||
'1.2.3',
|
||||
'https://tool.com/tool.phar',
|
||||
'darwin'
|
||||
);
|
||||
expect(script).toContain('add_tool https://tool.com/tool.phar tool');
|
||||
script = await tools.addArchive(
|
||||
'tool',
|
||||
'1.2.3',
|
||||
'https://tool.com/tool.phar',
|
||||
'win32'
|
||||
);
|
||||
@ -322,7 +319,6 @@ describe('Tools tests', () => {
|
||||
|
||||
script = await tools.addArchive(
|
||||
'tool',
|
||||
'1.2.3',
|
||||
'https://tool.com/tool.phar',
|
||||
'fedora'
|
||||
);
|
||||
|
39
dist/index.js
vendored
39
dist/index.js
vendored
@ -1986,11 +1986,10 @@ exports.getCleanedToolsList = getCleanedToolsList;
|
||||
* Helper function to get script to setup a tool using a phar url
|
||||
*
|
||||
* @param tool
|
||||
* @param version
|
||||
* @param url
|
||||
* @param os_version
|
||||
*/
|
||||
async function addArchive(tool, version, url, os_version) {
|
||||
async function addArchive(tool, url, os_version) {
|
||||
return (await utils.getCommand(os_version, 'tool')) + url + ' ' + tool;
|
||||
}
|
||||
exports.addArchive = addArchive;
|
||||
@ -2054,22 +2053,22 @@ async function addTools(tools_csv, php_version, os_version) {
|
||||
break;
|
||||
case 'blackfire-player':
|
||||
url = await getPharUrl('https://get.blackfire.io', tool, 'v', version);
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'codeception':
|
||||
url =
|
||||
'https://codeception.com/' +
|
||||
(await getCodeceptionUri(version, php_version));
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'composer':
|
||||
url = await getComposerUrl(version);
|
||||
script += await addArchive('composer', version, url, os_version);
|
||||
script += await addArchive('composer', url, os_version);
|
||||
break;
|
||||
case 'composer-normalize':
|
||||
uri = await getUri(tool, '.phar', version, 'releases', '', 'download');
|
||||
url = github + 'ergebnis/composer-normalize/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'composer-prefetcher':
|
||||
script += await addPackage(tool, release, 'narrowspark/automatic-', os_version);
|
||||
@ -2077,35 +2076,35 @@ async function addTools(tools_csv, php_version, os_version) {
|
||||
case 'composer-require-checker':
|
||||
uri = await getUri(tool, '.phar', version, 'releases', '', 'download');
|
||||
url = github + 'maglnet/ComposerRequireChecker/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'composer-unused':
|
||||
uri = await getUri(tool, '.phar', version, 'releases', '', 'download');
|
||||
url = github + 'composer-unused/composer-unused/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'cs2pr':
|
||||
uri = await getUri(tool, '', version, 'releases', '', 'download');
|
||||
url = github + 'staabm/annotate-pull-request-from-checkstyle/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'deployer':
|
||||
url = await getDeployerUrl(version);
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'flex':
|
||||
script += await addPackage(tool, release, 'symfony/', os_version);
|
||||
break;
|
||||
case 'infection':
|
||||
url = github + 'infection/infection/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'pecl':
|
||||
script += await utils.getCommand(os_version, 'pecl');
|
||||
break;
|
||||
case 'phan':
|
||||
url = github + 'phan/phan/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'phinx':
|
||||
script += await addPackage(tool, release, 'robmorgan/', os_version);
|
||||
@ -2120,48 +2119,48 @@ async function addTools(tools_csv, php_version, os_version) {
|
||||
case 'php-cs-fixer':
|
||||
uri = await getUri(tool, '.phar', version, 'releases', 'v', 'download');
|
||||
url = github + 'FriendsOfPHP/PHP-CS-Fixer/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'phpcbf':
|
||||
case 'phpcs':
|
||||
url = github + 'squizlabs/PHP_CodeSniffer/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'phpcpd':
|
||||
case 'phpunit':
|
||||
url = await getPharUrl('https://phar.phpunit.de', tool, '', version);
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'phplint':
|
||||
script += await addPackage(tool, release, 'overtrue/', os_version);
|
||||
break;
|
||||
case 'phpmd':
|
||||
url = github + 'phpmd/phpmd/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'phpstan':
|
||||
url = github + 'phpstan/phpstan/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'prestissimo':
|
||||
script += await addPackage(tool, release, 'hirak/', os_version);
|
||||
break;
|
||||
case 'psalm':
|
||||
url = github + 'vimeo/psalm/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'symfony':
|
||||
case 'symfony-cli':
|
||||
uri = await getSymfonyUri(version, os_version);
|
||||
url = github + 'symfony/cli/' + uri;
|
||||
script += await addArchive('symfony', version, url, os_version);
|
||||
script += await addArchive('symfony', url, os_version);
|
||||
break;
|
||||
case 'vapor-cli':
|
||||
script += await addPackage(tool, release, 'laravel/', os_version);
|
||||
break;
|
||||
case 'wp-cli':
|
||||
url = github + (await getWpCliUrl(version));
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
default:
|
||||
script += await utils.addLog('$cross', tool, 'Tool ' + tool + ' is not supported', os_version);
|
||||
|
38
src/tools.ts
38
src/tools.ts
@ -346,13 +346,11 @@ export async function getCleanedToolsList(
|
||||
* Helper function to get script to setup a tool using a phar url
|
||||
*
|
||||
* @param tool
|
||||
* @param version
|
||||
* @param url
|
||||
* @param os_version
|
||||
*/
|
||||
export async function addArchive(
|
||||
tool: string,
|
||||
version: string,
|
||||
url: string,
|
||||
os_version: string
|
||||
): Promise<string> {
|
||||
@ -449,22 +447,22 @@ export async function addTools(
|
||||
break;
|
||||
case 'blackfire-player':
|
||||
url = await getPharUrl('https://get.blackfire.io', tool, 'v', version);
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'codeception':
|
||||
url =
|
||||
'https://codeception.com/' +
|
||||
(await getCodeceptionUri(version, php_version));
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'composer':
|
||||
url = await getComposerUrl(version);
|
||||
script += await addArchive('composer', version, url, os_version);
|
||||
script += await addArchive('composer', url, os_version);
|
||||
break;
|
||||
case 'composer-normalize':
|
||||
uri = await getUri(tool, '.phar', version, 'releases', '', 'download');
|
||||
url = github + 'ergebnis/composer-normalize/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'composer-prefetcher':
|
||||
script += await addPackage(
|
||||
@ -477,35 +475,35 @@ export async function addTools(
|
||||
case 'composer-require-checker':
|
||||
uri = await getUri(tool, '.phar', version, 'releases', '', 'download');
|
||||
url = github + 'maglnet/ComposerRequireChecker/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'composer-unused':
|
||||
uri = await getUri(tool, '.phar', version, 'releases', '', 'download');
|
||||
url = github + 'composer-unused/composer-unused/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'cs2pr':
|
||||
uri = await getUri(tool, '', version, 'releases', '', 'download');
|
||||
url = github + 'staabm/annotate-pull-request-from-checkstyle/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'deployer':
|
||||
url = await getDeployerUrl(version);
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'flex':
|
||||
script += await addPackage(tool, release, 'symfony/', os_version);
|
||||
break;
|
||||
case 'infection':
|
||||
url = github + 'infection/infection/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'pecl':
|
||||
script += await utils.getCommand(os_version, 'pecl');
|
||||
break;
|
||||
case 'phan':
|
||||
url = github + 'phan/phan/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'phinx':
|
||||
script += await addPackage(tool, release, 'robmorgan/', os_version);
|
||||
@ -520,48 +518,48 @@ export async function addTools(
|
||||
case 'php-cs-fixer':
|
||||
uri = await getUri(tool, '.phar', version, 'releases', 'v', 'download');
|
||||
url = github + 'FriendsOfPHP/PHP-CS-Fixer/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'phpcbf':
|
||||
case 'phpcs':
|
||||
url = github + 'squizlabs/PHP_CodeSniffer/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'phpcpd':
|
||||
case 'phpunit':
|
||||
url = await getPharUrl('https://phar.phpunit.de', tool, '', version);
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'phplint':
|
||||
script += await addPackage(tool, release, 'overtrue/', os_version);
|
||||
break;
|
||||
case 'phpmd':
|
||||
url = github + 'phpmd/phpmd/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'phpstan':
|
||||
url = github + 'phpstan/phpstan/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'prestissimo':
|
||||
script += await addPackage(tool, release, 'hirak/', os_version);
|
||||
break;
|
||||
case 'psalm':
|
||||
url = github + 'vimeo/psalm/' + uri;
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
case 'symfony':
|
||||
case 'symfony-cli':
|
||||
uri = await getSymfonyUri(version, os_version);
|
||||
url = github + 'symfony/cli/' + uri;
|
||||
script += await addArchive('symfony', version, url, os_version);
|
||||
script += await addArchive('symfony', url, os_version);
|
||||
break;
|
||||
case 'vapor-cli':
|
||||
script += await addPackage(tool, release, 'laravel/', os_version);
|
||||
break;
|
||||
case 'wp-cli':
|
||||
url = github + (await getWpCliUrl(version));
|
||||
script += await addArchive(tool, version, url, os_version);
|
||||
script += await addArchive(tool, url, os_version);
|
||||
break;
|
||||
default:
|
||||
script += await utils.addLog(
|
||||
|
Loading…
Reference in New Issue
Block a user