From f5863fd356f22e9fece9652a10311a673b532829 Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Thu, 7 May 2020 02:53:42 +0530 Subject: [PATCH] Add support for vapor-cli and infection tools --- __tests__/tools.test.ts | 6 +++++- dist/index.js | 9 ++++++++- src/scripts/win32.ps1 | 2 -- src/tools.ts | 12 +++++++++++- 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/__tests__/tools.test.ts b/__tests__/tools.test.ts index 8a1a8343..1de2efe3 100644 --- a/__tests__/tools.test.ts +++ b/__tests__/tools.test.ts @@ -391,7 +391,7 @@ describe('Tools tests', () => { }); it('checking addTools on darwin', async () => { const script: string = await tools.addTools( - 'blackfire, blackfire-player, flex, phpcs, phpcbf, phpcpd, phpmd, psalm, phinx, phive:1.2.3, cs2pr:1.2.3, composer-prefetcher:1.2.3, phpize, php-config, symfony, symfony:1.2.3, wp-cli', + 'blackfire, blackfire-player, flex, infection, phpcs, phpcbf, phpcpd, phpmd, psalm, phinx, vapor-cli, phive:1.2.3, cs2pr:1.2.3, composer-prefetcher:1.2.3, phpize, php-config, symfony, symfony:1.2.3, wp-cli', '7.4', 'darwin' ); @@ -405,6 +405,9 @@ describe('Tools tests', () => { expect(script).toContain( 'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/download/1.2.3/cs2pr cs2pr' ); + expect(script).toContain( + 'add_tool https://github.com/infection/infection/releases/latest/download/infection.phar infection' + ); expect(script).toContain( 'add_tool https://github.com/squizlabs/PHP_CodeSniffer/releases/latest/download/phpcs.phar phpcs' ); @@ -420,6 +423,7 @@ describe('Tools tests', () => { expect(script).toContain( 'https://github.com/vimeo/psalm/releases/latest/download/psalm.phar psalm' ); + expect(script).toContain('add_composertool vapor-cli vapor-cli laravel/'); expect(script).toContain('add_composertool flex flex symfony/'); expect(script).toContain('add_composertool phinx phinx robmorgan/'); expect(script).toContain( diff --git a/dist/index.js b/dist/index.js index 7ce31cb5..2103b103 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1827,7 +1827,7 @@ async function getCleanedToolsList(tools_csv) { .map(function (extension) { return extension .trim() - .replace(/symfony\/|robmorgan\/|hirak\/|narrowspark\/automatic-/, ''); + .replace(/symfony\/|laravel\/|robmorgan\/|hirak\/|narrowspark\/automatic-/, ''); }) .filter(Boolean); return [...new Set(tools_list)]; @@ -1911,6 +1911,10 @@ async function addTools(tools_csv, php_version, os_version) { url = github + 'staabm/annotate-pull-request-from-checkstyle/' + uri; script += await addArchive(tool, version, url, os_version); break; + case 'infection': + url = github + 'infection/infection/' + uri; + script += await addArchive(tool, version, url, os_version); + break; case 'php-cs-fixer': uri = await getUri(tool, '.phar', version, 'releases', 'v', 'download'); url = github + 'FriendsOfPHP/PHP-CS-Fixer/' + uri; @@ -1967,6 +1971,9 @@ async function addTools(tools_csv, php_version, os_version) { case 'prestissimo': script += await addPackage(tool, release, 'hirak/', os_version); break; + case 'vapor-cli': + script += await addPackage(tool, release, 'laravel/', os_version); + break; case 'composer-prefetcher': script += await addPackage(tool, release, 'narrowspark/automatic-', os_version); break; diff --git a/src/scripts/win32.ps1 b/src/scripts/win32.ps1 index 2394b7f7..56aab370 100644 --- a/src/scripts/win32.ps1 +++ b/src/scripts/win32.ps1 @@ -159,8 +159,6 @@ Function Add-Tool() { } catch { } } if($tool -eq "phive") { - Add-Extension curl >$null 2>&1 - Add-Extension mbstring >$null 2>&1 Add-Extension xml >$null 2>&1 } elseif($tool -eq "cs2pr") { (Get-Content $php_dir/cs2pr).replace('exit(9)', 'exit(0)') | Set-Content $php_dir/cs2pr diff --git a/src/tools.ts b/src/tools.ts index 9765065c..05bdd22c 100644 --- a/src/tools.ts +++ b/src/tools.ts @@ -327,7 +327,10 @@ export async function getCleanedToolsList( .map(function(extension: string) { return extension .trim() - .replace(/symfony\/|robmorgan\/|hirak\/|narrowspark\/automatic-/, ''); + .replace( + /symfony\/|laravel\/|robmorgan\/|hirak\/|narrowspark\/automatic-/, + '' + ); }) .filter(Boolean); return [...new Set(tools_list)]; @@ -449,6 +452,10 @@ export async function addTools( url = github + 'staabm/annotate-pull-request-from-checkstyle/' + uri; script += await addArchive(tool, version, url, os_version); break; + case 'infection': + url = github + 'infection/infection/' + uri; + script += await addArchive(tool, version, url, os_version); + break; case 'php-cs-fixer': uri = await getUri(tool, '.phar', version, 'releases', 'v', 'download'); url = github + 'FriendsOfPHP/PHP-CS-Fixer/' + uri; @@ -505,6 +512,9 @@ export async function addTools( case 'prestissimo': script += await addPackage(tool, release, 'hirak/', os_version); break; + case 'vapor-cli': + script += await addPackage(tool, release, 'laravel/', os_version); + break; case 'composer-prefetcher': script += await addPackage( tool,