Log versions in tools setup

This commit is contained in:
Shivam Mathur 2020-09-28 10:58:02 +05:30
parent 7dcb43c768
commit c4606c9269
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
12 changed files with 216 additions and 138 deletions

View File

@ -301,44 +301,46 @@ describe('Tools tests', () => {
let script: string = await tools.addArchive( let script: string = await tools.addArchive(
'tool', 'tool',
'https://tool.com/tool.phar', 'https://tool.com/tool.phar',
'linux' 'linux',
'-v'
); );
expect(script).toContain('add_tool https://tool.com/tool.phar tool'); expect(script).toContain('add_tool https://tool.com/tool.phar tool');
script = await tools.addArchive( script = await tools.addArchive(
'tool', 'tool',
'https://tool.com/tool.phar', 'https://tool.com/tool.phar',
'darwin' 'darwin',
'-v'
); );
expect(script).toContain('add_tool https://tool.com/tool.phar tool'); expect(script).toContain('add_tool https://tool.com/tool.phar tool');
script = await tools.addArchive( script = await tools.addArchive(
'tool', 'tool',
'https://tool.com/tool.phar', 'https://tool.com/tool.phar',
'win32' 'win32',
'-v'
); );
expect(script).toContain('Add-Tool https://tool.com/tool.phar tool'); expect(script).toContain('Add-Tool https://tool.com/tool.phar tool');
script = await tools.addArchive( script = await tools.addArchive(
'tool', 'tool',
'https://tool.com/tool.phar', 'https://tool.com/tool.phar',
'openbsd' 'openbsd',
'-v'
); );
expect(script).toContain('Platform openbsd is not supported'); expect(script).toContain('Platform openbsd is not supported');
}); });
it('checking addDevTools', async () => { it('checking addDevTools', async () => {
let script: string = await tools.addDevTools('phpize', 'linux'); let script: string = await tools.addDevTools('phpize', 'linux');
expect(script).toContain('add_devtools'); expect(script).toContain('add_devtools phpize');
expect(script).toContain('add_log "$tick" "phpize" "Added"');
script = await tools.addDevTools('php-config', 'linux'); script = await tools.addDevTools('php-config', 'linux');
expect(script).toContain('add_devtools'); expect(script).toContain('add_devtools php-config');
expect(script).toContain('add_log "$tick" "php-config" "Added"');
script = await tools.addDevTools('phpize', 'darwin'); script = await tools.addDevTools('phpize', 'darwin');
expect(script).toContain('add_log "$tick" "phpize" "Added"'); expect(script).toContain('add_devtools phpize');
script = await tools.addDevTools('php-config', 'darwin'); script = await tools.addDevTools('php-config', 'darwin');
expect(script).toContain('add_log "$tick" "php-config" "Added"'); expect(script).toContain('add_devtools php-config');
script = await tools.addDevTools('phpize', 'win32'); script = await tools.addDevTools('phpize', 'win32');
expect(script).toContain( expect(script).toContain(
@ -381,34 +383,34 @@ describe('Tools tests', () => {
); );
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 "-V"'
); );
expect(script).toContain( expect(script).toContain(
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar,https://getcomposer.org/composer-stable.phar composer' 'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar,https://getcomposer.org/composer-stable.phar composer'
); );
expect(script).toContain( expect(script).toContain(
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr' 'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr "-V"'
); );
expect(script).toContain( expect(script).toContain(
'add_tool https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/latest/download/php-cs-fixer.phar php-cs-fixer' 'add_tool https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/latest/download/php-cs-fixer.phar php-cs-fixer "-V"'
); );
expect(script).toContain( expect(script).toContain(
'add_tool https://github.com/phpstan/phpstan/releases/latest/download/phpstan.phar phpstan' 'add_tool https://github.com/phpstan/phpstan/releases/latest/download/phpstan.phar phpstan "-V"'
); );
expect(script).toContain( expect(script).toContain(
'add_tool https://www.phing.info/get/phing-latest.phar phing' 'add_tool https://www.phing.info/get/phing-latest.phar phing "-v"'
); );
expect(script).toContain( expect(script).toContain(
'add_tool https://phar.io/releases/phive.phar phive' 'add_tool https://phar.io/releases/phive.phar phive status'
); );
expect(script).toContain( expect(script).toContain(
'add_tool https://phar.phpunit.de/phpunit.phar phpunit' 'add_tool https://phar.phpunit.de/phpunit.phar phpunit "--version"'
); );
expect(script).toContain( expect(script).toContain(
'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_linux_amd64 symfony' 'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_linux_amd64 symfony version'
); );
expect(script).toContain( expect(script).toContain(
'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli' 'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"'
); );
expect(script).toContain('add_protoc latest'); expect(script).toContain('add_protoc latest');
expect(script).toContain('add_grpc_php_plugin latest'); expect(script).toContain('add_grpc_php_plugin latest');
@ -417,9 +419,8 @@ describe('Tools tests', () => {
expect(script).toContain('add_composertool phinx phinx robmorgan/'); expect(script).toContain('add_composertool phinx phinx robmorgan/');
expect(script).toContain('add_composertool phplint phplint overtrue/'); expect(script).toContain('add_composertool phplint phplint overtrue/');
expect(script).toContain('add_composertool phinx phinx:1.2.3 robmorgan/'); expect(script).toContain('add_composertool phinx phinx:1.2.3 robmorgan/');
expect(script).toContain('add_devtools'); expect(script).toContain('add_devtools php-config');
expect(script).toContain('add_log "$tick" "php-config" "Added"'); expect(script).toContain('add_devtools phpize');
expect(script).toContain('add_log "$tick" "phpize" "Added"');
}); });
it('checking addTools on darwin', async () => { it('checking addTools on darwin', async () => {
const listOfTools = [ const listOfTools = [
@ -460,46 +461,43 @@ describe('Tools tests', () => {
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 "-V"'
); );
expect(script).toContain( expect(script).toContain(
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar,https://getcomposer.org/composer-stable.phar composer' 'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar,https://getcomposer.org/composer-stable.phar composer'
); );
expect(script).toContain( expect(script).toContain(
'add_tool https://github.com/ergebnis/composer-normalize/releases/latest/download/composer-normalize.phar composer-normalize' 'add_tool https://github.com/ergebnis/composer-normalize/releases/latest/download/composer-normalize.phar composer-normalize "-V"'
); );
expect(script).toContain( expect(script).toContain(
'add_tool https://github.com/maglnet/ComposerRequireChecker/releases/latest/download/composer-require-checker.phar composer-require-checker' 'add_tool https://github.com/maglnet/ComposerRequireChecker/releases/latest/download/composer-require-checker.phar composer-require-checker "-V"'
); );
expect(script).toContain( expect(script).toContain(
'add_tool https://github.com/composer-unused/composer-unused/releases/latest/download/composer-unused.phar composer-unused' 'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/download/1.2.3/cs2pr cs2pr "-V"'
); );
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/infection/infection/releases/latest/download/infection.phar infection "-V"'
); );
expect(script).toContain( expect(script).toContain(
'add_tool https://github.com/infection/infection/releases/latest/download/infection.phar infection' 'add_tool https://github.com/phan/phan/releases/latest/download/phan.phar phan "-v"'
); );
expect(script).toContain( expect(script).toContain(
'add_tool https://github.com/phan/phan/releases/latest/download/phan.phar phan' 'add_tool https://www.phing.info/get/phing-1.2.3.phar phing "-v"'
); );
expect(script).toContain( expect(script).toContain(
'add_tool https://www.phing.info/get/phing-1.2.3.phar phing' 'add_tool https://github.com/squizlabs/PHP_CodeSniffer/releases/latest/download/phpcs.phar phpcs "--version"'
); );
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/phpcbf.phar phpcbf "--version"'
); );
expect(script).toContain( expect(script).toContain(
'add_tool https://github.com/squizlabs/PHP_CodeSniffer/releases/latest/download/phpcbf.phar phpcbf' 'add_tool https://phar.phpunit.de/phpcpd.phar phpcpd "--version"'
); );
expect(script).toContain( expect(script).toContain(
'add_tool https://phar.phpunit.de/phpcpd.phar phpcpd' 'add_tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd "--version"'
); );
expect(script).toContain( expect(script).toContain(
'add_tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd' 'https://github.com/vimeo/psalm/releases/latest/download/psalm.phar psalm "-v"'
);
expect(script).toContain(
'https://github.com/vimeo/psalm/releases/latest/download/psalm.phar psalm'
); );
expect(script).toContain('add_grpc_php_plugin 1.2.3'); expect(script).toContain('add_grpc_php_plugin 1.2.3');
expect(script).toContain('add_protoc 1.2.3'); expect(script).toContain('add_protoc 1.2.3');
@ -507,25 +505,28 @@ describe('Tools tests', () => {
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(
'add_tool https://github.com/phan/phan/releases/download/2.7.2/phan.phar phan' 'add_tool https://github.com/phan/phan/releases/download/2.7.2/phan.phar phan "-v"'
); );
expect(script).toContain( expect(script).toContain(
'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive' 'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive'
); );
expect(script).toContain(
'add_composertool composer-unused composer-unused icanhazstring/'
);
expect(script).toContain( expect(script).toContain(
'add_composertool composer-prefetcher composer-prefetcher:1.2.3 narrowspark/automatic-' 'add_composertool composer-prefetcher composer-prefetcher:1.2.3 narrowspark/automatic-'
); );
expect(script).toContain( expect(script).toContain(
'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_darwin_amd64 symfony' 'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_darwin_amd64 symfony version'
); );
expect(script).toContain( expect(script).toContain(
'add_tool https://github.com/symfony/cli/releases/download/v1.2.3/symfony_darwin_amd64 symfony' 'add_tool https://github.com/symfony/cli/releases/download/v1.2.3/symfony_darwin_amd64 symfony version'
); );
expect(script).toContain( expect(script).toContain(
'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli' 'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"'
); );
expect(script).toContain('add_log "$tick" "phpize" "Added"'); expect(script).toContain('add_devtools phpize');
expect(script).toContain('add_log "$tick" "php-config" "Added"'); expect(script).toContain('add_devtools php-config');
}); });
it('checking addTools on windows', async () => { it('checking addTools on windows', async () => {
const listOfTools = [ const listOfTools = [
@ -554,31 +555,31 @@ describe('Tools tests', () => {
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 "-V"'
); );
expect(script).toContain( expect(script).toContain(
'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar,https://getcomposer.org/composer-stable.phar composer' 'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar,https://getcomposer.org/composer-stable.phar composer'
); );
expect(script).toContain( expect(script).toContain(
'Add-Tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr' 'Add-Tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr "-V"'
); );
expect(script).toContain('Add-Composertool flex flex symfony/'); expect(script).toContain('Add-Composertool flex flex symfony/');
expect(script).toContain( expect(script).toContain(
'Add-Tool https://deployer.org/deployer.phar deployer' 'Add-Tool https://deployer.org/deployer.phar deployer "-V"'
); );
expect(script).toContain('Add-Composertool prestissimo prestissimo hirak/'); expect(script).toContain('Add-Composertool prestissimo prestissimo hirak/');
expect(script).toContain( expect(script).toContain(
'Add-Tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd' 'Add-Tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd "--version"'
); );
expect(script).toContain('Add-Composertool phinx phinx robmorgan/'); expect(script).toContain('Add-Composertool phinx phinx robmorgan/');
expect(script).toContain( expect(script).toContain(
'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.2/phive-0.13.2.phar phive' 'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.2/phive-0.13.2.phar phive status'
); );
expect(script).toContain( expect(script).toContain(
'Add-Tool https://github.com/symfony/cli/releases/latest/download/symfony_windows_amd64.exe symfony' 'Add-Tool https://github.com/symfony/cli/releases/latest/download/symfony_windows_amd64.exe symfony version'
); );
expect(script).toContain( expect(script).toContain(
'Add-Tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli' 'Add-Tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"'
); );
expect(script).toContain('phpize is not a windows tool'); expect(script).toContain('phpize is not a windows tool');
expect(script).toContain('php-config is not a windows tool'); expect(script).toContain('php-config is not a windows tool');
@ -621,7 +622,7 @@ describe('Tools tests', () => {
script = await tools.addTools('composer:preview', '7.4', 'linux'); script = await tools.addTools('composer:preview', '7.4', 'linux');
expect(script).toContain( expect(script).toContain(
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-preview.phar,https://getcomposer.org/composer-preview.phar composer' 'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-preview.phar,https://getcomposer.org/composer-preview.phar composer preview'
); );
script = await tools.addTools( script = await tools.addTools(
'composer:v1, composer:preview, composer:snapshot', 'composer:v1, composer:preview, composer:snapshot',
@ -629,7 +630,7 @@ describe('Tools tests', () => {
'linux' 'linux'
); );
expect(script).toContain( expect(script).toContain(
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-snapshot.phar,https://getcomposer.org/composer.phar composer' 'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-snapshot.phar,https://getcomposer.org/composer.phar composer snapshot'
); );
}); });
}); });

57
dist/index.js vendored
View File

@ -1837,14 +1837,14 @@ async function addPhive(version, os_version) {
switch (version) { switch (version) {
case 'latest': case 'latest':
return ((await utils.getCommand(os_version, 'tool')) + return ((await utils.getCommand(os_version, 'tool')) +
'https://phar.io/releases/phive.phar phive'); 'https://phar.io/releases/phive.phar phive status');
default: default:
return ((await utils.getCommand(os_version, 'tool')) + return ((await utils.getCommand(os_version, 'tool')) +
'https://github.com/phar-io/phive/releases/download/' + 'https://github.com/phar-io/phive/releases/download/' +
version + version +
'/phive-' + '/phive-' +
version + version +
'.phar phive'); '.phar phive status');
} }
} }
exports.addPhive = addPhive; exports.addPhive = addPhive;
@ -1976,7 +1976,7 @@ async function getCleanedToolsList(tools_csv) {
.map(function (extension) { .map(function (extension) {
return extension return extension
.trim() .trim()
.replace(/-agent|hirak\/|laravel\/|narrowspark\/automatic-|overtrue\/|robmorgan\/|symfony\//, ''); .replace(/-agent|hirak\/|icanhazstring\/|laravel\/|narrowspark\/automatic-|overtrue\/|robmorgan\/|symfony\//, '');
}) })
.filter(Boolean); .filter(Boolean);
return [...new Set(tools_list)]; return [...new Set(tools_list)];
@ -1988,9 +1988,11 @@ exports.getCleanedToolsList = getCleanedToolsList;
* @param tool * @param tool
* @param url * @param url
* @param os_version * @param os_version
* @param ver_param
*/ */
async function addArchive(tool, url, os_version) { async function addArchive(tool, url, os_version, ver_param) {
return (await utils.getCommand(os_version, 'tool')) + url + ' ' + tool; return ((await utils.getCommand(os_version, 'tool')) +
(await utils.joins(url, tool, ver_param)));
} }
exports.addArchive = addArchive; exports.addArchive = addArchive;
/** /**
@ -2002,11 +2004,8 @@ exports.addArchive = addArchive;
async function addDevTools(tool, os_version) { async function addDevTools(tool, os_version) {
switch (os_version) { switch (os_version) {
case 'linux': case 'linux':
return ('add_devtools' +
'\n' +
(await utils.addLog('$tick', tool, 'Added', 'linux')));
case 'darwin': case 'darwin':
return await utils.addLog('$tick', tool, 'Added', 'darwin'); return 'add_devtools ' + tool;
case 'win32': case 'win32':
return await utils.addLog('$cross', tool, tool + ' is not a windows tool', 'win32'); return await utils.addLog('$cross', tool, tool + ' is not a windows tool', 'win32');
default: default:
@ -2053,22 +2052,22 @@ async function addTools(tools_csv, php_version, os_version) {
break; break;
case 'blackfire-player': case 'blackfire-player':
url = await getPharUrl('https://get.blackfire.io', tool, 'v', version); url = await getPharUrl('https://get.blackfire.io', tool, 'v', version);
script += await addArchive(tool, url, os_version); script += await addArchive(tool, url, os_version, '"-V"');
break; break;
case 'codeception': case 'codeception':
url = url =
'https://codeception.com/' + 'https://codeception.com/' +
(await getCodeceptionUri(version, php_version)); (await getCodeceptionUri(version, php_version));
script += await addArchive(tool, url, os_version); script += await addArchive(tool, url, os_version, '"-V"');
break; break;
case 'composer': case 'composer':
url = await getComposerUrl(version); url = await getComposerUrl(version);
script += await addArchive('composer', url, os_version); script += await addArchive('composer', url, os_version, version);
break; 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, url, os_version); script += await addArchive(tool, url, os_version, '"-V"');
break; 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);
@ -2076,39 +2075,37 @@ async function addTools(tools_csv, php_version, os_version) {
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;
script += await addArchive(tool, url, os_version); script += await addArchive(tool, url, os_version, '"-V"');
break; break;
case 'composer-unused': case 'composer-unused':
uri = await getUri(tool, '.phar', version, 'releases', '', 'download'); script += await addPackage(tool, release, 'icanhazstring/', os_version);
url = github + 'composer-unused/composer-unused/' + uri;
script += await addArchive(tool, url, os_version);
break; break;
case 'cs2pr': case 'cs2pr':
uri = await getUri(tool, '', version, 'releases', '', 'download'); uri = await getUri(tool, '', version, 'releases', '', 'download');
url = github + 'staabm/annotate-pull-request-from-checkstyle/' + uri; url = github + 'staabm/annotate-pull-request-from-checkstyle/' + uri;
script += await addArchive(tool, url, os_version); script += await addArchive(tool, url, os_version, '"-V"');
break; break;
case 'deployer': case 'deployer':
url = await getDeployerUrl(version); url = await getDeployerUrl(version);
script += await addArchive(tool, url, os_version); script += await addArchive(tool, url, os_version, '"-V"');
break; break;
case 'flex': case 'flex':
script += await addPackage(tool, release, 'symfony/', os_version); script += await addPackage(tool, release, 'symfony/', os_version);
break; break;
case 'infection': case 'infection':
url = github + 'infection/infection/' + uri; url = github + 'infection/infection/' + uri;
script += await addArchive(tool, url, os_version); script += await addArchive(tool, url, os_version, '"-V"');
break; break;
case 'pecl': case 'pecl':
script += await utils.getCommand(os_version, 'pecl'); script += await utils.getCommand(os_version, 'pecl');
break; break;
case 'phan': case 'phan':
url = github + 'phan/phan/' + uri; url = github + 'phan/phan/' + uri;
script += await addArchive(tool, url, os_version); script += await addArchive(tool, url, os_version, '"-v"');
break; break;
case 'phing': case 'phing':
url = 'https://www.phing.info/get/phing-' + version + '.phar'; url = 'https://www.phing.info/get/phing-' + version + '.phar';
script += await addArchive(tool, url, os_version); script += await addArchive(tool, url, os_version, '"-v"');
break; break;
case 'phinx': case 'phinx':
script += await addPackage(tool, release, 'robmorgan/', os_version); script += await addPackage(tool, release, 'robmorgan/', os_version);
@ -2123,48 +2120,48 @@ async function addTools(tools_csv, php_version, os_version) {
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;
script += await addArchive(tool, url, os_version); script += await addArchive(tool, url, os_version, '"-V"');
break; break;
case 'phpcbf': case 'phpcbf':
case 'phpcs': case 'phpcs':
url = github + 'squizlabs/PHP_CodeSniffer/' + uri; url = github + 'squizlabs/PHP_CodeSniffer/' + uri;
script += await addArchive(tool, url, os_version); script += await addArchive(tool, url, os_version, '"--version"');
break; break;
case 'phpcpd': case 'phpcpd':
case 'phpunit': case 'phpunit':
url = await getPharUrl('https://phar.phpunit.de', tool, '', version); url = await getPharUrl('https://phar.phpunit.de', tool, '', version);
script += await addArchive(tool, url, os_version); script += await addArchive(tool, url, os_version, '"--version"');
break; break;
case 'phplint': case 'phplint':
script += await addPackage(tool, release, 'overtrue/', os_version); script += await addPackage(tool, release, 'overtrue/', os_version);
break; break;
case 'phpmd': case 'phpmd':
url = github + 'phpmd/phpmd/' + uri; url = github + 'phpmd/phpmd/' + uri;
script += await addArchive(tool, url, os_version); script += await addArchive(tool, url, os_version, '"--version"');
break; break;
case 'phpstan': case 'phpstan':
url = github + 'phpstan/phpstan/' + uri; url = github + 'phpstan/phpstan/' + uri;
script += await addArchive(tool, url, os_version); script += await addArchive(tool, url, os_version, '"-V"');
break; break;
case 'prestissimo': case 'prestissimo':
script += await addPackage(tool, release, 'hirak/', os_version); script += await addPackage(tool, release, 'hirak/', os_version);
break; break;
case 'psalm': case 'psalm':
url = github + 'vimeo/psalm/' + uri; url = github + 'vimeo/psalm/' + uri;
script += await addArchive(tool, url, os_version); script += await addArchive(tool, url, os_version, '"-v"');
break; 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', url, os_version); script += await addArchive('symfony', url, os_version, 'version');
break; break;
case 'vapor-cli': case 'vapor-cli':
script += await addPackage(tool, release, 'laravel/', os_version); script += await addPackage(tool, release, 'laravel/', os_version);
break; break;
case 'wp-cli': case 'wp-cli':
url = github + (await getWpCliUrl(version)); url = github + (await getWpCliUrl(version));
script += await addArchive(tool, url, os_version); script += await addArchive(tool, url, os_version, '"--version"');
break; break;
default: default:
script += await utils.addLog('$cross', tool, 'Tool ' + tool + ' is not supported', os_version); script += await utils.addLog('$cross', tool, 'Tool ' + tool + ' is not supported', os_version);

View File

@ -158,10 +158,29 @@ configure_composer() {
fi fi
} }
# Function to extract tool version.
get_tool_version() {
tool=$1
param=$2
version_regex="[0-9]+((\.{1}[0-9]+)+)(\.{0})(-[a-zA-Z0-9]+){0,1}"
if [ "$tool" = "composer" ]; then
if [ "$param" != "snapshot" ]; then
grep -Ea "const\sVERSION" "$tool_path_dir/composer" | grep -Eo "$version_regex"
else
trunk=$(grep -Ea "const\sBRANCH_ALIAS_VERSION" "$tool_path_dir/composer" | grep -Eo "$version_regex")
commit=$(grep -Ea "const\sVERSION" "$tool_path_dir/composer" | grep -Eo "[a-zA-z0-9]+" | tail -n 1)
echo "$trunk+$commit"
fi
else
$tool "$param" 2>/dev/null | sed -Ee "s/[Cc]omposer(.)?$version_regex//g" | grep -Eo "$version_regex" | head -n 1
fi
}
# Function to setup a remote tool. # Function to setup a remote tool.
add_tool() { add_tool() {
url=$1 url=$1
tool=$2 tool=$2
ver_param=$3
tool_path="$tool_path_dir/$tool" tool_path="$tool_path_dir/$tool"
if [ ! -e "$tool_path" ]; then if [ ! -e "$tool_path" ]; then
rm -rf "$tool_path" rm -rf "$tool_path"
@ -191,7 +210,8 @@ add_tool() {
elif [ "$tool" = "wp-cli" ]; then elif [ "$tool" = "wp-cli" ]; then
sudo cp -p "$tool_path" "$tool_path_dir"/wp sudo cp -p "$tool_path" "$tool_path_dir"/wp
fi fi
add_log "$tick" "$tool" "Added" tool_version=$(get_tool_version "$tool" "$ver_param")
add_log "$tick" "$tool" "Added $tool $tool_version"
else else
add_log "$cross" "$tool" "Could not setup $tool" add_log "$cross" "$tool" "Could not setup $tool"
fi fi
@ -203,10 +223,19 @@ add_composertool() {
release=$2 release=$2
prefix=$3 prefix=$3
( (
composer global require "$prefix$release" >/dev/null 2>&1 && add_log "$tick" "$tool" "Added" composer global require "$prefix$release" >/dev/null 2>&1 &&
json=$(grep "$prefix$tool" /Users/$USER/.composer/composer.json) &&
tool_version=$(get_tool_version 'echo' "$json") &&
add_log "$tick" "$tool" "Added $tool $tool_version"
) || add_log "$cross" "$tool" "Could not setup $tool" ) || add_log "$cross" "$tool" "Could not setup $tool"
} }
# Function to handle request to add phpize and php-config.
add_devtools() {
tool=$1
add_log "$tick" "$tool" "Added $tool $semver"
}
# Function to configure PECL # Function to configure PECL
configure_pecl() { configure_pecl() {
for tool in pear pecl; do for tool in pear pecl; do
@ -217,7 +246,8 @@ configure_pecl() {
# Function to handle request to add PECL. # Function to handle request to add PECL.
add_pecl() { add_pecl() {
add_log "$tick" "PECL" "Added" pecl_version=$(get_tool_version "pecl" "version")
add_log "$tick" "PECL" "Found PECL $pecl_version"
} }
# Function to setup PHP 5.6 and newer. # Function to setup PHP 5.6 and newer.

View File

@ -231,7 +231,7 @@ add_extension_from_source() {
args=$4 args=$4
prefix=$5 prefix=$5
( (
add_devtools add_devtools phpize
delete_extension "$extension" delete_extension "$extension"
curl -o /tmp/"$extension".tar.gz "${curl_opts[@]}" https://github.com/"$repo"/archive/"$release".tar.gz curl -o /tmp/"$extension".tar.gz "${curl_opts[@]}" https://github.com/"$repo"/archive/"$release".tar.gz
tar xf /tmp/"$extension".tar.gz -C /tmp tar xf /tmp/"$extension".tar.gz -C /tmp
@ -258,10 +258,29 @@ configure_composer() {
fi fi
} }
# Function to extract tool version.
get_tool_version() {
tool=$1
param=$2
version_regex="[0-9]+((\.{1}[0-9]+)+)(\.{0})(-[a-zA-Z0-9]+){0,1}"
if [ "$tool" = "composer" ]; then
if [ "$param" != "snapshot" ]; then
grep -Ea "const\sVERSION" "$tool_path_dir/composer" | grep -Eo "$version_regex"
else
trunk=$(grep -Ea "const\sBRANCH_ALIAS_VERSION" "$tool_path_dir/composer" | grep -Eo "$version_regex")
commit=$(grep -Ea "const\sVERSION" "$tool_path_dir/composer" | grep -Eo "[a-zA-z0-9]+" | tail -n 1)
echo "$trunk+$commit"
fi
else
$tool "$param" 2>/dev/null | sed -Ee "s/[Cc]omposer(.)?$version_regex//g" | grep -Eo "$version_regex" | head -n 1
fi
}
# Function to setup a remote tool. # Function to setup a remote tool.
add_tool() { add_tool() {
url=$1 url=$1
tool=$2 tool=$2
ver_param=$3
tool_path="$tool_path_dir/$tool" tool_path="$tool_path_dir/$tool"
if [ ! -e "$tool_path" ]; then if [ ! -e "$tool_path" ]; then
rm -rf "$tool_path" rm -rf "$tool_path"
@ -289,7 +308,8 @@ add_tool() {
elif [ "$tool" = "wp-cli" ]; then elif [ "$tool" = "wp-cli" ]; then
sudo cp -p "$tool_path" "$tool_path_dir"/wp sudo cp -p "$tool_path" "$tool_path_dir"/wp
fi fi
add_log "$tick" "$tool" "Added" tool_version=$(get_tool_version "$tool" "$ver_param")
add_log "$tick" "$tool" "Added $tool $tool_version"
else else
add_log "$cross" "$tool" "Could not setup $tool" add_log "$cross" "$tool" "Could not setup $tool"
fi fi
@ -302,18 +322,22 @@ add_composertool() {
prefix=$3 prefix=$3
( (
composer global require "$prefix$release" >/dev/null 2>&1 && composer global require "$prefix$release" >/dev/null 2>&1 &&
add_log "$tick" "$tool" "Added" json=$(grep "$prefix$tool" /home/$USER/.composer/composer.json) &&
tool_version=$(get_tool_version 'echo' "$json") &&
add_log "$tick" "$tool" "Added $tool $tool_version"
) || add_log "$cross" "$tool" "Could not setup $tool" ) || add_log "$cross" "$tool" "Could not setup $tool"
} }
# Function to setup phpize and php-config. # Function to setup phpize and php-config.
add_devtools() { add_devtools() {
tool=$1
if ! [ -e "/usr/bin/phpize$version" ] || ! [ -e "/usr/bin/php-config$version" ]; then if ! [ -e "/usr/bin/phpize$version" ] || ! [ -e "/usr/bin/php-config$version" ]; then
update_lists && $apt_install php"$version"-dev php"$version"-xml >/dev/null 2>&1 update_lists && $apt_install php"$version"-dev php"$version"-xml >/dev/null 2>&1
fi fi
sudo update-alternatives --set php-config /usr/bin/php-config"$version" >/dev/null 2>&1 sudo update-alternatives --set php-config /usr/bin/php-config"$version" >/dev/null 2>&1
sudo update-alternatives --set phpize /usr/bin/phpize"$version" >/dev/null 2>&1 sudo update-alternatives --set phpize /usr/bin/phpize"$version" >/dev/null 2>&1
configure_pecl >/dev/null 2>&1 configure_pecl >/dev/null 2>&1
add_log "$tick" "$tool" "Added $tool $semver"
} }
# Function to setup the nightly build from master branch. # Function to setup the nightly build from master branch.
@ -330,12 +354,13 @@ setup_old_versions() {
# Function to add PECL. # Function to add PECL.
add_pecl() { add_pecl() {
add_devtools >/dev/null 2>&1 add_devtools phpize >/dev/null 2>&1
if [ ! -e /usr/bin/pecl ]; then if [ ! -e /usr/bin/pecl ]; then
$apt_install php-pear >/dev/null 2>&1 || update_lists && $apt_install php-pear >/dev/null 2>&1 $apt_install php-pear >/dev/null 2>&1 || update_lists && $apt_install php-pear >/dev/null 2>&1
fi fi
configure_pecl >/dev/null 2>&1 configure_pecl >/dev/null 2>&1
add_log "$tick" "PECL" "Added" pecl_version=$(get_tool_version "pecl" "version")
add_log "$tick" "PECL" "Added PECL $pecl_version"
} }
# Function to switch versions of PHP binaries. # Function to switch versions of PHP binaries.

View File

@ -16,6 +16,6 @@ Function Add-Blackfire() {
if ((Test-Path env:BLACKFIRE_CLIENT_ID) -and (Test-Path env:BLACKFIRE_CLIENT_TOKEN)) { if ((Test-Path env:BLACKFIRE_CLIENT_ID) -and (Test-Path env:BLACKFIRE_CLIENT_TOKEN)) {
blackfire config --client-id=$env:BLACKFIRE_CLIENT_ID --client-token=$env:BLACKFIRE_CLIENT_TOKEN --ca-cert=$php_dir\ssl\cacert.pem >$null 2>&1 blackfire config --client-id=$env:BLACKFIRE_CLIENT_ID --client-token=$env:BLACKFIRE_CLIENT_TOKEN --ca-cert=$php_dir\ssl\cacert.pem >$null 2>&1
} }
Add-Log $tick "blackfire" "Added" Add-Log $tick "blackfire" "Added blackfire $agent_version"
Add-Log $tick "blackfire-agent" "Added" Add-Log $tick "blackfire-agent" "Added blackfire-agent $agent_version"
} }

View File

@ -29,6 +29,7 @@ add_blackfire() {
[ "$os" = "Linux" ] && add_blackfire_linux >/dev/null 2>&1 [ "$os" = "Linux" ] && add_blackfire_linux >/dev/null 2>&1
[ "$os" = "Darwin" ] && add_blackfire_darwin >/dev/null 2>&1 [ "$os" = "Darwin" ] && add_blackfire_darwin >/dev/null 2>&1
blackfire_config >/dev/null 2>&1 blackfire_config >/dev/null 2>&1
add_log "${tick:?}" "blackfire" "Added" tool_version=$(get_tool_version "blackfire" "version")
add_log "${tick:?}" "blackfire-agent" "Added" add_log "${tick:?}" "blackfire" "Added blackfire $tool_version"
add_log "${tick:?}" "blackfire-agent" "Added blackfire-agent $tool_version"
} }

View File

@ -9,11 +9,12 @@ Function Add-Msys2() {
Function Add-Grpc_php_plugin() { Function Add-Grpc_php_plugin() {
$msys_location = Add-Msys2 $msys_location = Add-Msys2
. $msys_location\usr\bin\bash -l -c "pacman -S --noconfirm mingw-w64-x86_64-grpc" >$null 2>&1 $logs = . $msys_location\usr\bin\bash -l -c "pacman -S --noconfirm mingw-w64-x86_64-grpc" >$null 2>&1
$grpc_version = Get-ToolVersion 'Write-Output' "$logs"
Write-Output "::add-path::$msys_location\mingw64\bin" Write-Output "::add-path::$msys_location\mingw64\bin"
Write-Output "::set-output name=grpc_php_plugin_path::$msys_location\mingw64\bin\grpc_php_plugin.exe" Write-Output "::set-output name=grpc_php_plugin_path::$msys_location\mingw64\bin\grpc_php_plugin.exe"
Add-ToProfile $current_profile 'grpc_php_plugin' "New-Alias grpc_php_plugin $msys_location\mingw64\bin\grpc_php_plugin.exe" Add-ToProfile $current_profile 'grpc_php_plugin' "New-Alias grpc_php_plugin $msys_location\mingw64\bin\grpc_php_plugin.exe"
Add-Log $tick "grpc_php_plugin" "Added" Add-Log $tick "grpc_php_plugin" "Added grpc_php_plugin $grpc_version"
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "grpc_php_plugin" "Click to read the grpc_php_plugin related license information" printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "grpc_php_plugin" "Click to read the grpc_php_plugin related license information"
Write-Output (Invoke-WebRequest https://raw.githubusercontent.com/grpc/grpc/master/LICENSE).Content Write-Output (Invoke-WebRequest https://raw.githubusercontent.com/grpc/grpc/master/LICENSE).Content
Write-Output "::endgroup::" Write-Output "::endgroup::"

View File

@ -44,7 +44,7 @@ add_grpc_php_plugin() {
sudo chmod a+x /usr/local/bin/grpc_php_plugin sudo chmod a+x /usr/local/bin/grpc_php_plugin
) >/dev/null 2>&1 ) >/dev/null 2>&1
echo "::set-output name=grpc_php_plugin_path::/usr/local/bin/grpc_php_plugin" echo "::set-output name=grpc_php_plugin_path::/usr/local/bin/grpc_php_plugin"
add_log "${tick:?}" "grpc_php_plugin" "Added" add_log "${tick:?}" "grpc_php_plugin" "Added grpc_php_plugin ${grpc_tag:1}"
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "grpc_php_plugin" "Click to read the grpc_php_plugin related license information" printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "grpc_php_plugin" "Click to read the grpc_php_plugin related license information"
cat "/tmp/grpc-${grpc_tag:1}/LICENSE" cat "/tmp/grpc-${grpc_tag:1}/LICENSE"
echo "::endgroup::" echo "::endgroup::"

View File

@ -31,7 +31,7 @@ Function Add-Protoc() {
Expand-Archive -Path $bin_dir\protoc.zip -DestinationPath $bin_dir\protoc -Force >$null 2>&1 Expand-Archive -Path $bin_dir\protoc.zip -DestinationPath $bin_dir\protoc -Force >$null 2>&1
Move-Item -Path $bin_dir\protoc\bin\protoc.exe -Destination $bin_dir\protoc.exe Move-Item -Path $bin_dir\protoc\bin\protoc.exe -Destination $bin_dir\protoc.exe
Add-ToProfile $current_profile 'protoc' "New-Alias protoc $bin_dir\protoc.exe" Add-ToProfile $current_profile 'protoc' "New-Alias protoc $bin_dir\protoc.exe"
Add-Log $tick "protoc" "Added" Add-Log $tick "protoc" "Added protoc $($protobuf_tag -replace 'v', '')"
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "protoc" "Click to read the protoc related license information" printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "protoc" "Click to read the protoc related license information"
Write-Output (Invoke-WebRequest https://raw.githubusercontent.com/protocolbuffers/protobuf/master/LICENSE).Content Write-Output (Invoke-WebRequest https://raw.githubusercontent.com/protocolbuffers/protobuf/master/LICENSE).Content
Write-Output "::endgroup::" Write-Output "::endgroup::"

View File

@ -21,7 +21,7 @@ add_protoc() {
sudo unzip /tmp/protobuf.zip -d /usr/local/ sudo unzip /tmp/protobuf.zip -d /usr/local/
sudo chmod 777 /usr/local/bin/protoc -R /usr/local/include/google sudo chmod 777 /usr/local/bin/protoc -R /usr/local/include/google
) >/dev/null 2>&1 ) >/dev/null 2>&1
add_log "${tick:?}" "protoc" "Added" add_log "${tick:?}" "protoc" "Added protoc ${protobuf_tag:1}"
printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "protoc" "Click to read the protoc related license information" printf "::group::\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "protoc" "Click to read the protoc related license information"
curl "${curl_opts[@]:?}" https://raw.githubusercontent.com/protocolbuffers/protobuf/master/LICENSE curl "${curl_opts[@]:?}" https://raw.githubusercontent.com/protocolbuffers/protobuf/master/LICENSE
echo "::endgroup::" echo "::endgroup::"

View File

@ -195,6 +195,27 @@ Function Edit-ComposerConfig() {
} }
} }
# Function to extract tool version.
Function Get-ToolVersion() {
Param (
[Parameter(Position = 0, Mandatory = $true)]
$tool,
[Parameter(Position = 1, Mandatory = $true)]
$param
)
$version_regex = "[0-9]+((\.{1}[0-9]+)+)(\.{0})(-[a-z0-9]+){0,1}"
if($tool -eq 'composer') {
if ($param -eq 'snapshot') {
$trunk = Select-String -Pattern "const\sBRANCH_ALIAS_VERSION" -Path $bin_dir\composer -Raw | Select-String -Pattern $version_regex | ForEach-Object { $_.matches.Value }
$commit = Select-String -Pattern "const\sVERSION" -Path $bin_dir\composer -Raw | Select-String -Pattern "[a-zA-Z0-9]+" -AllMatches | ForEach-Object { $_.matches[2].Value }
return "$trunk+$commit"
} else {
return Select-String -Pattern "const\sVERSION" -Path $bin_dir\composer -Raw | Select-String -Pattern $version_regex | ForEach-Object { $_.matches.Value }
}
}
return . $tool $param 2> $null | ForEach-Object { $_ -replace "composer $version_regex", '' } | Select-String -Pattern $version_regex | Select-Object -First 1 | ForEach-Object { $_.matches.Value }
}
# Function to add tools. # Function to add tools.
Function Add-Tool() { Function Add-Tool() {
Param ( Param (
@ -203,9 +224,10 @@ Function Add-Tool() {
$url, $url,
[Parameter(Position = 1, Mandatory = $true)] [Parameter(Position = 1, Mandatory = $true)]
[ValidateNotNull()] [ValidateNotNull()]
[ValidateLength(1, [int]::MaxValue)] $tool,
[string] [Parameter(Position = 2, Mandatory = $true)]
$tool [ValidateNotNull()]
$ver_param
) )
if (Test-Path $bin_dir\$tool) { if (Test-Path $bin_dir\$tool) {
Remove-Item $bin_dir\$tool Remove-Item $bin_dir\$tool
@ -239,7 +261,8 @@ Function Add-Tool() {
Copy-Item $bin_dir\wp-cli.bat -Destination $bin_dir\wp.bat Copy-Item $bin_dir\wp-cli.bat -Destination $bin_dir\wp.bat
} }
if (((Get-ChildItem -Path $bin_dir/* | Where-Object Name -Match "^$tool(.exe|.phar)*$").Count -gt 0)) { if (((Get-ChildItem -Path $bin_dir/* | Where-Object Name -Match "^$tool(.exe|.phar)*$").Count -gt 0)) {
Add-Log $tick $tool "Added" $tool_version = Get-ToolVersion $tool $ver_param
Add-Log $tick $tool "Added $tool $tool_version"
} else { } else {
Add-Log $cross $tool "Could not add $tool" Add-Log $cross $tool "Could not add $tool"
} }
@ -264,9 +287,11 @@ Function Add-Composertool() {
[string] [string]
$prefix $prefix
) )
composer -q global require $prefix$release 2>&1 | out-null composer global require $prefix$release 2>&1 | out-null
if($?) { $json = findstr $prefix$tool $env:APPDATA\Composer\composer.json
Add-Log $tick $tool "Added" if($json) {
$tool_version = Get-ToolVersion "Write-Output" "$json"
Add-Log $tick $tool "Added $tool $tool_version"
} else { } else {
Add-Log $cross $tool "Could not setup $tool" Add-Log $cross $tool "Could not setup $tool"
} }

View File

@ -167,7 +167,7 @@ export async function addPhive(
case 'latest': case 'latest':
return ( return (
(await utils.getCommand(os_version, 'tool')) + (await utils.getCommand(os_version, 'tool')) +
'https://phar.io/releases/phive.phar phive' 'https://phar.io/releases/phive.phar phive status'
); );
default: default:
return ( return (
@ -176,7 +176,7 @@ export async function addPhive(
version + version +
'/phive-' + '/phive-' +
version + version +
'.phar phive' '.phar phive status'
); );
} }
} }
@ -334,7 +334,7 @@ export async function getCleanedToolsList(
return extension return extension
.trim() .trim()
.replace( .replace(
/-agent|hirak\/|laravel\/|narrowspark\/automatic-|overtrue\/|robmorgan\/|symfony\//, /-agent|hirak\/|icanhazstring\/|laravel\/|narrowspark\/automatic-|overtrue\/|robmorgan\/|symfony\//,
'' ''
); );
}) })
@ -348,13 +348,18 @@ export async function getCleanedToolsList(
* @param tool * @param tool
* @param url * @param url
* @param os_version * @param os_version
* @param ver_param
*/ */
export async function addArchive( export async function addArchive(
tool: string, tool: string,
url: string, url: string,
os_version: string os_version: string,
ver_param: string
): Promise<string> { ): Promise<string> {
return (await utils.getCommand(os_version, 'tool')) + url + ' ' + tool; return (
(await utils.getCommand(os_version, 'tool')) +
(await utils.joins(url, tool, ver_param))
);
} }
/** /**
@ -369,13 +374,8 @@ export async function addDevTools(
): Promise<string> { ): Promise<string> {
switch (os_version) { switch (os_version) {
case 'linux': case 'linux':
return (
'add_devtools' +
'\n' +
(await utils.addLog('$tick', tool, 'Added', 'linux'))
);
case 'darwin': case 'darwin':
return await utils.addLog('$tick', tool, 'Added', 'darwin'); return 'add_devtools ' + tool;
case 'win32': case 'win32':
return await utils.addLog( return await utils.addLog(
'$cross', '$cross',
@ -447,22 +447,22 @@ export async function addTools(
break; break;
case 'blackfire-player': case 'blackfire-player':
url = await getPharUrl('https://get.blackfire.io', tool, 'v', version); url = await getPharUrl('https://get.blackfire.io', tool, 'v', version);
script += await addArchive(tool, url, os_version); script += await addArchive(tool, url, os_version, '"-V"');
break; break;
case 'codeception': case 'codeception':
url = url =
'https://codeception.com/' + 'https://codeception.com/' +
(await getCodeceptionUri(version, php_version)); (await getCodeceptionUri(version, php_version));
script += await addArchive(tool, url, os_version); script += await addArchive(tool, url, os_version, '"-V"');
break; break;
case 'composer': case 'composer':
url = await getComposerUrl(version); url = await getComposerUrl(version);
script += await addArchive('composer', url, os_version); script += await addArchive('composer', url, os_version, version);
break; 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, url, os_version); script += await addArchive(tool, url, os_version, '"-V"');
break; break;
case 'composer-prefetcher': case 'composer-prefetcher':
script += await addPackage( script += await addPackage(
@ -475,39 +475,37 @@ export async function addTools(
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;
script += await addArchive(tool, url, os_version); script += await addArchive(tool, url, os_version, '"-V"');
break; break;
case 'composer-unused': case 'composer-unused':
uri = await getUri(tool, '.phar', version, 'releases', '', 'download'); script += await addPackage(tool, release, 'icanhazstring/', os_version);
url = github + 'composer-unused/composer-unused/' + uri;
script += await addArchive(tool, url, os_version);
break; break;
case 'cs2pr': case 'cs2pr':
uri = await getUri(tool, '', version, 'releases', '', 'download'); uri = await getUri(tool, '', version, 'releases', '', 'download');
url = github + 'staabm/annotate-pull-request-from-checkstyle/' + uri; url = github + 'staabm/annotate-pull-request-from-checkstyle/' + uri;
script += await addArchive(tool, url, os_version); script += await addArchive(tool, url, os_version, '"-V"');
break; break;
case 'deployer': case 'deployer':
url = await getDeployerUrl(version); url = await getDeployerUrl(version);
script += await addArchive(tool, url, os_version); script += await addArchive(tool, url, os_version, '"-V"');
break; break;
case 'flex': case 'flex':
script += await addPackage(tool, release, 'symfony/', os_version); script += await addPackage(tool, release, 'symfony/', os_version);
break; break;
case 'infection': case 'infection':
url = github + 'infection/infection/' + uri; url = github + 'infection/infection/' + uri;
script += await addArchive(tool, url, os_version); script += await addArchive(tool, url, os_version, '"-V"');
break; break;
case 'pecl': case 'pecl':
script += await utils.getCommand(os_version, 'pecl'); script += await utils.getCommand(os_version, 'pecl');
break; break;
case 'phan': case 'phan':
url = github + 'phan/phan/' + uri; url = github + 'phan/phan/' + uri;
script += await addArchive(tool, url, os_version); script += await addArchive(tool, url, os_version, '"-v"');
break; break;
case 'phing': case 'phing':
url = 'https://www.phing.info/get/phing-' + version + '.phar'; url = 'https://www.phing.info/get/phing-' + version + '.phar';
script += await addArchive(tool, url, os_version); script += await addArchive(tool, url, os_version, '"-v"');
break; break;
case 'phinx': case 'phinx':
script += await addPackage(tool, release, 'robmorgan/', os_version); script += await addPackage(tool, release, 'robmorgan/', os_version);
@ -522,48 +520,48 @@ export async function addTools(
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;
script += await addArchive(tool, url, os_version); script += await addArchive(tool, url, os_version, '"-V"');
break; break;
case 'phpcbf': case 'phpcbf':
case 'phpcs': case 'phpcs':
url = github + 'squizlabs/PHP_CodeSniffer/' + uri; url = github + 'squizlabs/PHP_CodeSniffer/' + uri;
script += await addArchive(tool, url, os_version); script += await addArchive(tool, url, os_version, '"--version"');
break; break;
case 'phpcpd': case 'phpcpd':
case 'phpunit': case 'phpunit':
url = await getPharUrl('https://phar.phpunit.de', tool, '', version); url = await getPharUrl('https://phar.phpunit.de', tool, '', version);
script += await addArchive(tool, url, os_version); script += await addArchive(tool, url, os_version, '"--version"');
break; break;
case 'phplint': case 'phplint':
script += await addPackage(tool, release, 'overtrue/', os_version); script += await addPackage(tool, release, 'overtrue/', os_version);
break; break;
case 'phpmd': case 'phpmd':
url = github + 'phpmd/phpmd/' + uri; url = github + 'phpmd/phpmd/' + uri;
script += await addArchive(tool, url, os_version); script += await addArchive(tool, url, os_version, '"--version"');
break; break;
case 'phpstan': case 'phpstan':
url = github + 'phpstan/phpstan/' + uri; url = github + 'phpstan/phpstan/' + uri;
script += await addArchive(tool, url, os_version); script += await addArchive(tool, url, os_version, '"-V"');
break; break;
case 'prestissimo': case 'prestissimo':
script += await addPackage(tool, release, 'hirak/', os_version); script += await addPackage(tool, release, 'hirak/', os_version);
break; break;
case 'psalm': case 'psalm':
url = github + 'vimeo/psalm/' + uri; url = github + 'vimeo/psalm/' + uri;
script += await addArchive(tool, url, os_version); script += await addArchive(tool, url, os_version, '"-v"');
break; 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', url, os_version); script += await addArchive('symfony', url, os_version, 'version');
break; break;
case 'vapor-cli': case 'vapor-cli':
script += await addPackage(tool, release, 'laravel/', os_version); script += await addPackage(tool, release, 'laravel/', os_version);
break; break;
case 'wp-cli': case 'wp-cli':
url = github + (await getWpCliUrl(version)); url = github + (await getWpCliUrl(version));
script += await addArchive(tool, url, os_version); script += await addArchive(tool, url, os_version, '"--version"');
break; break;
default: default:
script += await utils.addLog( script += await utils.addLog(