Add support for vapor-cli and infection tools

This commit is contained in:
Shivam Mathur 2020-05-07 02:53:42 +05:30
parent cf0fdf35f2
commit f5863fd356
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
4 changed files with 24 additions and 5 deletions

View File

@ -391,7 +391,7 @@ describe('Tools tests', () => {
}); });
it('checking addTools on darwin', async () => { it('checking addTools on darwin', async () => {
const script: string = await tools.addTools( 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', '7.4',
'darwin' 'darwin'
); );
@ -405,6 +405,9 @@ describe('Tools tests', () => {
expect(script).toContain( expect(script).toContain(
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/download/1.2.3/cs2pr cs2pr' '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( expect(script).toContain(
'add_tool https://github.com/squizlabs/PHP_CodeSniffer/releases/latest/download/phpcs.phar phpcs' 'add_tool https://github.com/squizlabs/PHP_CodeSniffer/releases/latest/download/phpcs.phar phpcs'
); );
@ -420,6 +423,7 @@ describe('Tools tests', () => {
expect(script).toContain( expect(script).toContain(
'https://github.com/vimeo/psalm/releases/latest/download/psalm.phar psalm' '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 flex flex symfony/');
expect(script).toContain('add_composertool phinx phinx robmorgan/'); expect(script).toContain('add_composertool phinx phinx robmorgan/');
expect(script).toContain( expect(script).toContain(

9
dist/index.js vendored
View File

@ -1827,7 +1827,7 @@ async function getCleanedToolsList(tools_csv) {
.map(function (extension) { .map(function (extension) {
return extension return extension
.trim() .trim()
.replace(/symfony\/|robmorgan\/|hirak\/|narrowspark\/automatic-/, ''); .replace(/symfony\/|laravel\/|robmorgan\/|hirak\/|narrowspark\/automatic-/, '');
}) })
.filter(Boolean); .filter(Boolean);
return [...new Set(tools_list)]; 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; url = github + 'staabm/annotate-pull-request-from-checkstyle/' + uri;
script += await addArchive(tool, version, url, os_version); script += await addArchive(tool, version, url, os_version);
break; break;
case 'infection':
url = github + 'infection/infection/' + uri;
script += await addArchive(tool, version, url, os_version);
break;
case 'php-cs-fixer': case 'php-cs-fixer':
uri = await getUri(tool, '.phar', version, 'releases', 'v', 'download'); uri = await getUri(tool, '.phar', version, 'releases', 'v', 'download');
url = github + 'FriendsOfPHP/PHP-CS-Fixer/' + uri; url = github + 'FriendsOfPHP/PHP-CS-Fixer/' + uri;
@ -1967,6 +1971,9 @@ async function addTools(tools_csv, php_version, os_version) {
case 'prestissimo': case 'prestissimo':
script += await addPackage(tool, release, 'hirak/', os_version); script += await addPackage(tool, release, 'hirak/', os_version);
break; break;
case 'vapor-cli':
script += await addPackage(tool, release, 'laravel/', os_version);
break;
case 'composer-prefetcher': case 'composer-prefetcher':
script += await addPackage(tool, release, 'narrowspark/automatic-', os_version); script += await addPackage(tool, release, 'narrowspark/automatic-', os_version);
break; break;

View File

@ -159,8 +159,6 @@ Function Add-Tool() {
} catch { } } catch { }
} }
if($tool -eq "phive") { if($tool -eq "phive") {
Add-Extension curl >$null 2>&1
Add-Extension mbstring >$null 2>&1
Add-Extension xml >$null 2>&1 Add-Extension xml >$null 2>&1
} elseif($tool -eq "cs2pr") { } elseif($tool -eq "cs2pr") {
(Get-Content $php_dir/cs2pr).replace('exit(9)', 'exit(0)') | Set-Content $php_dir/cs2pr (Get-Content $php_dir/cs2pr).replace('exit(9)', 'exit(0)') | Set-Content $php_dir/cs2pr

View File

@ -327,7 +327,10 @@ export async function getCleanedToolsList(
.map(function(extension: string) { .map(function(extension: string) {
return extension return extension
.trim() .trim()
.replace(/symfony\/|robmorgan\/|hirak\/|narrowspark\/automatic-/, ''); .replace(
/symfony\/|laravel\/|robmorgan\/|hirak\/|narrowspark\/automatic-/,
''
);
}) })
.filter(Boolean); .filter(Boolean);
return [...new Set(tools_list)]; return [...new Set(tools_list)];
@ -449,6 +452,10 @@ export async function addTools(
url = github + 'staabm/annotate-pull-request-from-checkstyle/' + uri; url = github + 'staabm/annotate-pull-request-from-checkstyle/' + uri;
script += await addArchive(tool, version, url, os_version); script += await addArchive(tool, version, url, os_version);
break; break;
case 'infection':
url = github + 'infection/infection/' + uri;
script += await addArchive(tool, version, url, os_version);
break;
case 'php-cs-fixer': case 'php-cs-fixer':
uri = await getUri(tool, '.phar', version, 'releases', 'v', 'download'); uri = await getUri(tool, '.phar', version, 'releases', 'v', 'download');
url = github + 'FriendsOfPHP/PHP-CS-Fixer/' + uri; url = github + 'FriendsOfPHP/PHP-CS-Fixer/' + uri;
@ -505,6 +512,9 @@ export async function addTools(
case 'prestissimo': case 'prestissimo':
script += await addPackage(tool, release, 'hirak/', os_version); script += await addPackage(tool, release, 'hirak/', os_version);
break; break;
case 'vapor-cli':
script += await addPackage(tool, release, 'laravel/', os_version);
break;
case 'composer-prefetcher': case 'composer-prefetcher':
script += await addPackage( script += await addPackage(
tool, tool,