Merge branch 'develop' into feature/composer-unused

This commit is contained in:
Shivam Mathur 2020-07-19 17:32:00 +05:30 committed by GitHub
commit d35633ec7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 191 additions and 134 deletions

View File

@ -446,11 +446,39 @@ describe('Tools tests', () => {
expect(script).toContain('add_log "$tick" "phpize" "Added"'); expect(script).toContain('add_log "$tick" "phpize" "Added"');
}); });
it('checking addTools on darwin', async () => { it('checking addTools on darwin', async () => {
const listOfTools = [
'blackfire',
'blackfire-player',
'composer-normalize',
'composer-prefetcher:1.2.3',
'composer-require-checker',
'composer-unused',
'cs2pr:1.2.3',
'flex',
'infection',
'phan',
'phan:2.7.2',
'phinx',
'phive:1.2.3',
'php-config',
'phpcbf',
'phpcpd',
'phpcs',
'phpize',
'phpmd',
'psalm',
'symfony',
'symfony:1.2.3',
'vapor-cli',
'wp-cli'
];
const script: string = await tools.addTools( const script: string = await tools.addTools(
'blackfire, blackfire-player, composer-normalize, composer-require-checker, composer-unused, flex, infection, phan, phpcs, phpcbf, phpcpd, phpmd, psalm, phinx, vapor-cli, phan:2.7.2, phive:1.2.3, cs2pr:1.2.3, composer-prefetcher:1.2.3, phpize, php-config, symfony, symfony:1.2.3, wp-cli', listOfTools.join(', '),
'7.4', '7.4',
'darwin' 'darwin'
); );
expect(script).toContain('add_blackfire'); expect(script).toContain('add_blackfire');
expect(script).toContain( expect(script).toContain(
'add_tool https://get.blackfire.io/blackfire-player.phar blackfire-player' 'add_tool https://get.blackfire.io/blackfire-player.phar blackfire-player'
@ -516,11 +544,30 @@ describe('Tools tests', () => {
expect(script).toContain('add_log "$tick" "php-config" "Added"'); expect(script).toContain('add_log "$tick" "php-config" "Added"');
}); });
it('checking addTools on windows', async () => { it('checking addTools on windows', async () => {
const listOfTools = [
'blackfire',
'blackfire-player:1.8.1',
'codeception',
'cs2pr',
'deployer',
'does_not_exit',
'flex',
'phinx',
'phive:0.13.2',
'php-config',
'phpize',
'phpmd',
'prestissimo',
'symfony',
'wp-cli'
];
const script: string = await tools.addTools( const script: string = await tools.addTools(
'blackfire, blackfire-player:1.8.1, codeception, cs2pr, deployer, flex, prestissimo, phpmd, phinx, phive:0.13.2, php-config, phpize, symfony, wp-cli, does_not_exit', listOfTools.join(', '),
'7.4', '7.4',
'win32' 'win32'
); );
expect(script).toContain('Add-Blackfire'); expect(script).toContain('Add-Blackfire');
expect(script).toContain( expect(script).toContain(
'Add-Tool https://get.blackfire.io/blackfire-player-v1.8.1.phar blackfire-player' 'Add-Tool https://get.blackfire.io/blackfire-player-v1.8.1.phar blackfire-player'
@ -555,11 +602,18 @@ describe('Tools tests', () => {
expect(script).toContain('Tool does_not_exit is not supported'); expect(script).toContain('Tool does_not_exit is not supported');
}); });
it('checking addTools with composer tool using user/tool as input', async () => { it('checking addTools with composer tool using user/tool as input', async () => {
const listOfTools = [
'hirak/prestissimo',
'narrowspark/automatic-composer-prefetcher',
'robmorgan/phinx'
];
const script: string = await tools.addTools( const script: string = await tools.addTools(
'hirak/prestissimo, narrowspark/automatic-composer-prefetcher, robmorgan/phinx', listOfTools.join(', '),
'7.4', '7.4',
'win32' 'win32'
); );
expect(script).toContain( expect(script).toContain(
'Add-Tool https://getcomposer.org/composer-stable.phar composer' 'Add-Tool https://getcomposer.org/composer-stable.phar composer'
); );
@ -570,11 +624,14 @@ describe('Tools tests', () => {
); );
}); });
it('checking composer setup', async () => { it('checking composer setup', async () => {
const listOfTools = ['composer', 'composer:v1'];
let script: string = await tools.addTools( let script: string = await tools.addTools(
'composer, composer:v1', listOfTools.join(', '),
'7.4', '7.4',
'linux' 'linux'
); );
expect(script).toContain( expect(script).toContain(
'add_tool https://getcomposer.org/composer-1.phar composer' 'add_tool https://getcomposer.org/composer-1.phar composer'
); );

124
dist/index.js vendored
View File

@ -2296,11 +2296,24 @@ async function addTools(tools_csv, php_version, os_version) {
url = await getPharUrl('https://get.blackfire.io', tool, 'v', version); url = await getPharUrl('https://get.blackfire.io', tool, 'v', version);
script += await addArchive(tool, version, url, os_version); script += await addArchive(tool, version, url, os_version);
break; break;
case 'codeception':
url =
'https://codeception.com/' +
(await getCodeceptionUri(version, php_version));
script += await addArchive(tool, version, url, os_version);
break;
case 'composer':
url = await getComposerUrl(version);
script += await addArchive('composer', version, url, os_version);
break;
case 'composer-normalize': case 'composer-normalize':
uri = await getUri(tool, '.phar', version, 'releases', '', 'download'); uri = await getUri(tool, '.phar', version, 'releases', '', 'download');
url = github + 'ergebnis/composer-normalize/' + uri; url = github + 'ergebnis/composer-normalize/' + uri;
script += await addArchive(tool, version, url, os_version); script += await addArchive(tool, version, url, os_version);
break; break;
case 'composer-prefetcher':
script += await addPackage(tool, release, 'narrowspark/automatic-', os_version);
break;
case 'composer-require-checker': case 'composer-require-checker':
uri = await getUri(tool, '.phar', version, 'releases', '', 'download'); uri = await getUri(tool, '.phar', version, 'releases', '', 'download');
url = github + 'maglnet/ComposerRequireChecker/' + uri; url = github + 'maglnet/ComposerRequireChecker/' + uri;
@ -2316,54 +2329,6 @@ 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':
uri = await getUri(tool, '.phar', version, 'releases', 'v', 'download');
url = github + 'FriendsOfPHP/PHP-CS-Fixer/' + uri;
script += await addArchive(tool, version, url, os_version);
break;
case 'phpcs':
case 'phpcbf':
url = github + 'squizlabs/PHP_CodeSniffer/' + uri;
script += await addArchive(tool, version, url, os_version);
break;
case 'phan':
url = github + 'phan/phan/' + uri;
script += await addArchive(tool, version, url, os_version);
break;
case 'phive':
script += await addPhive(version, os_version);
break;
case 'phpstan':
url = github + 'phpstan/phpstan/' + uri;
script += await addArchive(tool, version, url, os_version);
break;
case 'phpmd':
url = github + 'phpmd/phpmd/' + uri;
script += await addArchive(tool, version, url, os_version);
break;
case 'psalm':
url = github + 'vimeo/psalm/' + uri;
script += await addArchive(tool, version, url, os_version);
break;
case 'composer':
url = await getComposerUrl(version);
script += await addArchive('composer', version, url, os_version);
break;
case 'codeception':
url =
'https://codeception.com/' +
(await getCodeceptionUri(version, php_version));
script += await addArchive(tool, version, 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);
break;
case 'deployer': case 'deployer':
url = await getDeployerUrl(version); url = await getDeployerUrl(version);
script += await addArchive(tool, version, url, os_version); script += await addArchive(tool, version, url, os_version);
@ -2371,34 +2336,69 @@ async function addTools(tools_csv, php_version, os_version) {
case 'flex': case 'flex':
script += await addPackage(tool, release, 'symfony/', os_version); script += await addPackage(tool, release, 'symfony/', os_version);
break; break;
case 'phinx': case 'infection':
script += await addPackage(tool, release, 'robmorgan/', os_version); url = github + 'infection/infection/' + uri;
break; script += await addArchive(tool, version, url, os_version);
case 'phplint':
script += await addPackage(tool, release, 'overtrue/', os_version);
break;
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; break;
case 'pecl': case 'pecl':
script += await getCommand(os_version, 'pecl'); script += await getCommand(os_version, 'pecl');
break; break;
case 'phan':
url = github + 'phan/phan/' + uri;
script += await addArchive(tool, version, url, os_version);
break;
case 'phinx':
script += await addPackage(tool, release, 'robmorgan/', os_version);
break;
case 'phive':
script += await addPhive(version, os_version);
break;
case 'php-config': case 'php-config':
case 'phpize': case 'phpize':
script += await addDevTools(tool, os_version); script += await addDevTools(tool, os_version);
break; break;
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);
break;
case 'phpcbf':
case 'phpcs':
url = github + 'squizlabs/PHP_CodeSniffer/' + uri;
script += await addArchive(tool, version, 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);
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);
break;
case 'phpstan':
url = github + 'phpstan/phpstan/' + uri;
script += await addArchive(tool, version, 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);
break;
case 'symfony': case 'symfony':
case 'symfony-cli': case 'symfony-cli':
uri = await getSymfonyUri(version, os_version); uri = await getSymfonyUri(version, os_version);
url = github + 'symfony/cli/' + uri; url = github + 'symfony/cli/' + uri;
script += await addArchive('symfony', version, url, os_version); script += await addArchive('symfony', version, url, os_version);
break; break;
case 'vapor-cli':
script += await addPackage(tool, release, 'laravel/', os_version);
break;
case 'wp-cli': case 'wp-cli':
url = github + (await getWpCliUrl(version)); url = github + (await getWpCliUrl(version));
script += await addArchive(tool, version, url, os_version); script += await addArchive(tool, version, url, os_version);

View File

@ -477,11 +477,29 @@ export async function addTools(
url = await getPharUrl('https://get.blackfire.io', tool, 'v', version); url = await getPharUrl('https://get.blackfire.io', tool, 'v', version);
script += await addArchive(tool, version, url, os_version); script += await addArchive(tool, version, url, os_version);
break; break;
case 'codeception':
url =
'https://codeception.com/' +
(await getCodeceptionUri(version, php_version));
script += await addArchive(tool, version, url, os_version);
break;
case 'composer':
url = await getComposerUrl(version);
script += await addArchive('composer', version, url, os_version);
break;
case 'composer-normalize': case 'composer-normalize':
uri = await getUri(tool, '.phar', version, 'releases', '', 'download'); uri = await getUri(tool, '.phar', version, 'releases', '', 'download');
url = github + 'ergebnis/composer-normalize/' + uri; url = github + 'ergebnis/composer-normalize/' + uri;
script += await addArchive(tool, version, url, os_version); script += await addArchive(tool, version, url, os_version);
break; break;
case 'composer-prefetcher':
script += await addPackage(
tool,
release,
'narrowspark/automatic-',
os_version
);
break;
case 'composer-require-checker': case 'composer-require-checker':
uri = await getUri(tool, '.phar', version, 'releases', '', 'download'); uri = await getUri(tool, '.phar', version, 'releases', '', 'download');
url = github + 'maglnet/ComposerRequireChecker/' + uri; url = github + 'maglnet/ComposerRequireChecker/' + uri;
@ -497,54 +515,6 @@ 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':
uri = await getUri(tool, '.phar', version, 'releases', 'v', 'download');
url = github + 'FriendsOfPHP/PHP-CS-Fixer/' + uri;
script += await addArchive(tool, version, url, os_version);
break;
case 'phpcs':
case 'phpcbf':
url = github + 'squizlabs/PHP_CodeSniffer/' + uri;
script += await addArchive(tool, version, url, os_version);
break;
case 'phan':
url = github + 'phan/phan/' + uri;
script += await addArchive(tool, version, url, os_version);
break;
case 'phive':
script += await addPhive(version, os_version);
break;
case 'phpstan':
url = github + 'phpstan/phpstan/' + uri;
script += await addArchive(tool, version, url, os_version);
break;
case 'phpmd':
url = github + 'phpmd/phpmd/' + uri;
script += await addArchive(tool, version, url, os_version);
break;
case 'psalm':
url = github + 'vimeo/psalm/' + uri;
script += await addArchive(tool, version, url, os_version);
break;
case 'composer':
url = await getComposerUrl(version);
script += await addArchive('composer', version, url, os_version);
break;
case 'codeception':
url =
'https://codeception.com/' +
(await getCodeceptionUri(version, php_version));
script += await addArchive(tool, version, 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);
break;
case 'deployer': case 'deployer':
url = await getDeployerUrl(version); url = await getDeployerUrl(version);
script += await addArchive(tool, version, url, os_version); script += await addArchive(tool, version, url, os_version);
@ -552,39 +522,69 @@ export async function addTools(
case 'flex': case 'flex':
script += await addPackage(tool, release, 'symfony/', os_version); script += await addPackage(tool, release, 'symfony/', os_version);
break; break;
case 'phinx': case 'infection':
script += await addPackage(tool, release, 'robmorgan/', os_version); url = github + 'infection/infection/' + uri;
break; script += await addArchive(tool, version, url, os_version);
case 'phplint':
script += await addPackage(tool, release, 'overtrue/', os_version);
break;
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; break;
case 'pecl': case 'pecl':
script += await getCommand(os_version, 'pecl'); script += await getCommand(os_version, 'pecl');
break; break;
case 'phan':
url = github + 'phan/phan/' + uri;
script += await addArchive(tool, version, url, os_version);
break;
case 'phinx':
script += await addPackage(tool, release, 'robmorgan/', os_version);
break;
case 'phive':
script += await addPhive(version, os_version);
break;
case 'php-config': case 'php-config':
case 'phpize': case 'phpize':
script += await addDevTools(tool, os_version); script += await addDevTools(tool, os_version);
break; break;
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);
break;
case 'phpcbf':
case 'phpcs':
url = github + 'squizlabs/PHP_CodeSniffer/' + uri;
script += await addArchive(tool, version, 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);
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);
break;
case 'phpstan':
url = github + 'phpstan/phpstan/' + uri;
script += await addArchive(tool, version, 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);
break;
case 'symfony': case 'symfony':
case 'symfony-cli': case 'symfony-cli':
uri = await getSymfonyUri(version, os_version); uri = await getSymfonyUri(version, os_version);
url = github + 'symfony/cli/' + uri; url = github + 'symfony/cli/' + uri;
script += await addArchive('symfony', version, url, os_version); script += await addArchive('symfony', version, url, os_version);
break; break;
case 'vapor-cli':
script += await addPackage(tool, release, 'laravel/', os_version);
break;
case 'wp-cli': case 'wp-cli':
url = github + (await getWpCliUrl(version)); url = github + (await getWpCliUrl(version));
script += await addArchive(tool, version, url, os_version); script += await addArchive(tool, version, url, os_version);