mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +07:00
Add support for composer packages using tools input
This commit is contained in:
parent
3c6827c2c3
commit
23393c46d7
@ -16,7 +16,7 @@ describe('Tools tests', () => {
|
|||||||
expect(await tools.getToolVersion('1.2.3-alpha.1')).toBe('1.2.3-alpha.1');
|
expect(await tools.getToolVersion('1.2.3-alpha.1')).toBe('1.2.3-alpha.1');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking parseToolVersion', async () => {
|
it('checking parseTool', async () => {
|
||||||
expect(await tools.parseTool('phpunit')).toStrictEqual({
|
expect(await tools.parseTool('phpunit')).toStrictEqual({
|
||||||
name: 'phpunit',
|
name: 'phpunit',
|
||||||
version: 'latest'
|
version: 'latest'
|
||||||
@ -65,6 +65,10 @@ describe('Tools tests', () => {
|
|||||||
name: 'phpunit',
|
name: 'phpunit',
|
||||||
version: '1.2.3-alpha.1'
|
version: '1.2.3-alpha.1'
|
||||||
});
|
});
|
||||||
|
expect(await tools.parseTool('phpunit/phpunit:^1.2.3')).toStrictEqual({
|
||||||
|
name: 'phpunit/phpunit',
|
||||||
|
version: '^1.2.3'
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking getUri', async () => {
|
it('checking getUri', async () => {
|
||||||
@ -234,22 +238,6 @@ describe('Tools tests', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking getCleanedToolsList', async () => {
|
|
||||||
const tools_list: string[] = await tools.getCleanedToolsList(
|
|
||||||
'tool, composer:1.2, behat/behat, icanhazstring/composer-unused, laravel/vapor-cli, robmorgan/phinx, phpspec/phpspec, symfony/flex'
|
|
||||||
);
|
|
||||||
expect(tools_list).toStrictEqual([
|
|
||||||
'composer',
|
|
||||||
'tool',
|
|
||||||
'behat',
|
|
||||||
'composer-unused',
|
|
||||||
'vapor-cli',
|
|
||||||
'phinx',
|
|
||||||
'phpspec',
|
|
||||||
'flex'
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking getWpCliUri', async () => {
|
it('checking getWpCliUri', async () => {
|
||||||
expect(await tools.getWpCliUrl('latest')).toBe(
|
expect(await tools.getWpCliUrl('latest')).toBe(
|
||||||
'wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true'
|
'wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true'
|
||||||
@ -548,9 +536,11 @@ describe('Tools tests', () => {
|
|||||||
const listOfTools = [
|
const listOfTools = [
|
||||||
'composer:v1',
|
'composer:v1',
|
||||||
'codeception/codeception',
|
'codeception/codeception',
|
||||||
|
'prestissimo',
|
||||||
'hirak/prestissimo',
|
'hirak/prestissimo',
|
||||||
|
'composer-prefetcher',
|
||||||
'narrowspark/automatic-composer-prefetcher',
|
'narrowspark/automatic-composer-prefetcher',
|
||||||
'robmorgan/phinx'
|
'robmorgan/phinx: ^1.2'
|
||||||
];
|
];
|
||||||
|
|
||||||
const script: string = await tools.addTools(
|
const script: string = await tools.addTools(
|
||||||
@ -563,9 +553,9 @@ describe('Tools tests', () => {
|
|||||||
'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-1.phar,https://getcomposer.org/composer-1.phar composer'
|
'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-1.phar,https://getcomposer.org/composer-1.phar composer'
|
||||||
);
|
);
|
||||||
expect(script).toContain('Add-Composertool prestissimo prestissimo hirak/');
|
expect(script).toContain('Add-Composertool prestissimo prestissimo hirak/');
|
||||||
expect(script).toContain('Add-Composertool phinx phinx robmorgan/');
|
expect(script).toContain('Add-Composertool phinx phinx:^1.2 robmorgan/');
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'Add-Composertool composer-prefetcher composer-prefetcher narrowspark/automatic-'
|
'Add-Composertool automatic-composer-prefetcher automatic-composer-prefetcher narrowspark/'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('checking composer setup', async () => {
|
it('checking composer setup', async () => {
|
||||||
|
109
dist/index.js
vendored
109
dist/index.js
vendored
@ -2162,7 +2162,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.addTools = exports.addPackage = exports.addDevTools = exports.addArchive = exports.getCleanedToolsList = exports.getComposerUrl = exports.addComposer = exports.getWpCliUrl = exports.getSymfonyUri = exports.getDeployerUrl = exports.getBlackfirePlayerUrl = exports.getPharUrl = exports.addPhive = exports.getUri = exports.parseTool = exports.getToolVersion = void 0;
|
exports.addTools = exports.addPackage = exports.addDevTools = exports.addArchive = exports.getComposerUrl = exports.addComposer = exports.getWpCliUrl = exports.getSymfonyUri = exports.getDeployerUrl = exports.getBlackfirePlayerUrl = exports.getPharUrl = exports.addPhive = exports.getUri = exports.parseTool = exports.getToolVersion = void 0;
|
||||||
const utils = __importStar(__nccwpck_require__(314));
|
const utils = __importStar(__nccwpck_require__(314));
|
||||||
/**
|
/**
|
||||||
* Function to get tool version
|
* Function to get tool version
|
||||||
@ -2194,12 +2194,17 @@ async function parseTool(release) {
|
|||||||
const parts = release.split(':');
|
const parts = release.split(':');
|
||||||
const tool = parts[0];
|
const tool = parts[0];
|
||||||
const version = parts[1];
|
const version = parts[1];
|
||||||
switch (version) {
|
switch (true) {
|
||||||
case undefined:
|
case version === undefined:
|
||||||
return {
|
return {
|
||||||
name: tool,
|
name: tool,
|
||||||
version: 'latest'
|
version: 'latest'
|
||||||
};
|
};
|
||||||
|
case /^[\w.-]+\/[\w.-]+$/.test(tool):
|
||||||
|
return {
|
||||||
|
name: tool,
|
||||||
|
version: version
|
||||||
|
};
|
||||||
default:
|
default:
|
||||||
return {
|
return {
|
||||||
name: tool,
|
name: tool,
|
||||||
@ -2395,24 +2400,6 @@ async function getComposerUrl(version) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.getComposerUrl = getComposerUrl;
|
exports.getComposerUrl = getComposerUrl;
|
||||||
/**
|
|
||||||
* Function to get Tools list after cleanup
|
|
||||||
*
|
|
||||||
* @param tools_csv
|
|
||||||
*/
|
|
||||||
async function getCleanedToolsList(tools_csv) {
|
|
||||||
let tools_list = await utils.CSVArray(tools_csv);
|
|
||||||
tools_list = await addComposer(tools_list);
|
|
||||||
tools_list = tools_list
|
|
||||||
.map(function (extension) {
|
|
||||||
return extension
|
|
||||||
.trim()
|
|
||||||
.replace(/-agent|behat\/|codeception\/|hirak\/|icanhazstring\/|laravel\/|narrowspark\/automatic-|overtrue\/|phpspec\/|robmorgan\/|symfony\//, '');
|
|
||||||
})
|
|
||||||
.filter(Boolean);
|
|
||||||
return [...new Set(tools_list)];
|
|
||||||
}
|
|
||||||
exports.getCleanedToolsList = getCleanedToolsList;
|
|
||||||
/**
|
/**
|
||||||
* Helper function to get script to setup a tool using a phar url
|
* Helper function to get script to setup a tool using a phar url
|
||||||
*
|
*
|
||||||
@ -2466,7 +2453,7 @@ exports.addPackage = addPackage;
|
|||||||
*/
|
*/
|
||||||
async function addTools(tools_csv, php_version, os_version) {
|
async function addTools(tools_csv, php_version, os_version) {
|
||||||
let script = '\n' + (await utils.stepLog('Setup Tools', os_version));
|
let script = '\n' + (await utils.stepLog('Setup Tools', os_version));
|
||||||
const tools_list = await getCleanedToolsList(tools_csv);
|
const tools_list = await addComposer(await utils.CSVArray(tools_csv));
|
||||||
await utils.asyncForEach(tools_list, async function (release) {
|
await utils.asyncForEach(tools_list, async function (release) {
|
||||||
const tool_data = await parseTool(release);
|
const tool_data = await parseTool(release);
|
||||||
const tool = tool_data.name;
|
const tool = tool_data.name;
|
||||||
@ -2475,126 +2462,122 @@ async function addTools(tools_csv, php_version, os_version) {
|
|||||||
let uri = await getUri(tool, '.phar', version, 'releases', '', 'download');
|
let uri = await getUri(tool, '.phar', version, 'releases', '', 'download');
|
||||||
script += '\n';
|
script += '\n';
|
||||||
let url = '';
|
let url = '';
|
||||||
switch (tool) {
|
switch (true) {
|
||||||
case 'blackfire':
|
case /^blackfire(-agent)?$/.test(tool):
|
||||||
case 'grpc_php_plugin':
|
script += await utils.customPackage('blackfire', 'tools', version, os_version);
|
||||||
case 'protoc':
|
break;
|
||||||
|
case /^grpc_php_plugin$|^protoc$/.test(tool):
|
||||||
script += await utils.customPackage(tool, 'tools', version, os_version);
|
script += await utils.customPackage(tool, 'tools', version, os_version);
|
||||||
break;
|
break;
|
||||||
case 'behat':
|
case /^behat$|^codeception$|^phpspec$/.test(tool):
|
||||||
case 'codeception':
|
|
||||||
case 'phpspec':
|
|
||||||
script += await addPackage(tool, release, tool + '/', os_version);
|
script += await addPackage(tool, release, tool + '/', os_version);
|
||||||
break;
|
break;
|
||||||
case 'blackfire-player':
|
case /^blackfire-player$/.test(tool):
|
||||||
url = await getBlackfirePlayerUrl(version, php_version);
|
url = await getBlackfirePlayerUrl(version, php_version);
|
||||||
script += await addArchive(tool, url, os_version, '"-V"');
|
script += await addArchive(tool, url, os_version, '"-V"');
|
||||||
break;
|
break;
|
||||||
case 'composer':
|
case /^composer$/.test(tool):
|
||||||
url = await getComposerUrl(version);
|
url = await getComposerUrl(version);
|
||||||
script += await addArchive('composer', url, os_version, version);
|
script += await addArchive('composer', url, os_version, version);
|
||||||
break;
|
break;
|
||||||
case 'composer-normalize':
|
case /^composer-normalize$/.test(tool):
|
||||||
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, '"-V"');
|
script += await addArchive(tool, url, os_version, '"-V"');
|
||||||
break;
|
break;
|
||||||
case 'composer-prefetcher':
|
case /^composer-prefetcher$/.test(tool):
|
||||||
script += await addPackage(tool, release, 'narrowspark/automatic-', os_version);
|
script += await addPackage('automatic-' + tool, release, 'narrowspark/', os_version);
|
||||||
break;
|
break;
|
||||||
case 'composer-require-checker':
|
case /^composer-require-checker$/.test(tool):
|
||||||
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, '"-V"');
|
script += await addArchive(tool, url, os_version, '"-V"');
|
||||||
break;
|
break;
|
||||||
case 'composer-unused':
|
case /^composer-unused$/.test(tool):
|
||||||
script += await addPackage(tool, release, 'icanhazstring/', os_version);
|
script += await addPackage(tool, release, 'icanhazstring/', os_version);
|
||||||
break;
|
break;
|
||||||
case 'cs2pr':
|
case /^cs2pr$/.test(tool):
|
||||||
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, '"-V"');
|
script += await addArchive(tool, url, os_version, '"-V"');
|
||||||
break;
|
break;
|
||||||
case 'deployer':
|
case /^deployer$/.test(tool):
|
||||||
url = await getDeployerUrl(version);
|
url = await getDeployerUrl(version);
|
||||||
script += await addArchive(tool, url, os_version, '"-V"');
|
script += await addArchive(tool, url, os_version, '"-V"');
|
||||||
break;
|
break;
|
||||||
case 'flex':
|
case /^flex$/.test(tool):
|
||||||
script += await addPackage(tool, release, 'symfony/', os_version);
|
script += await addPackage(tool, release, 'symfony/', os_version);
|
||||||
break;
|
break;
|
||||||
case 'infection':
|
case /^infection$/.test(tool):
|
||||||
url = github + 'infection/infection/' + uri;
|
url = github + 'infection/infection/' + uri;
|
||||||
script += await addArchive(tool, url, os_version, '"-V"');
|
script += await addArchive(tool, url, os_version, '"-V"');
|
||||||
break;
|
break;
|
||||||
case 'pecl':
|
case /^pecl/.test(tool):
|
||||||
script += await utils.getCommand(os_version, 'pecl');
|
script += await utils.getCommand(os_version, 'pecl');
|
||||||
break;
|
break;
|
||||||
case 'phan':
|
case /^phan$/.test(tool):
|
||||||
url = github + 'phan/phan/' + uri;
|
url = github + 'phan/phan/' + uri;
|
||||||
script += await addArchive(tool, url, os_version, '"-v"');
|
script += await addArchive(tool, url, os_version, '"-v"');
|
||||||
break;
|
break;
|
||||||
case 'phing':
|
case /^phing$/.test(tool):
|
||||||
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, '"-v"');
|
script += await addArchive(tool, url, os_version, '"-v"');
|
||||||
break;
|
break;
|
||||||
case 'phinx':
|
case /^phinx$/.test(tool):
|
||||||
script += await addPackage(tool, release, 'robmorgan/', os_version);
|
script += await addPackage(tool, release, 'robmorgan/', os_version);
|
||||||
break;
|
break;
|
||||||
case 'phive':
|
case /^phive$/.test(tool):
|
||||||
script += await addPhive(version, php_version, os_version);
|
script += await addPhive(version, php_version, os_version);
|
||||||
break;
|
break;
|
||||||
case 'php-config':
|
case /^php(-config|ize)$/.test(tool):
|
||||||
case 'phpize':
|
|
||||||
script += await addDevTools(tool, os_version);
|
script += await addDevTools(tool, os_version);
|
||||||
break;
|
break;
|
||||||
case 'php-cs-fixer':
|
case /^php-cs-fixer$/.test(tool):
|
||||||
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, '"-V"');
|
script += await addArchive(tool, url, os_version, '"-V"');
|
||||||
break;
|
break;
|
||||||
case 'phpcbf':
|
case /^php(cbf|cs)$/.test(tool):
|
||||||
case 'phpcs':
|
|
||||||
url = github + 'squizlabs/PHP_CodeSniffer/' + uri;
|
url = github + 'squizlabs/PHP_CodeSniffer/' + uri;
|
||||||
script += await addArchive(tool, url, os_version, '"--version"');
|
script += await addArchive(tool, url, os_version, '"--version"');
|
||||||
break;
|
break;
|
||||||
case 'phpcpd':
|
case /^php(cpd|unit)$/.test(tool):
|
||||||
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, '"--version"');
|
script += await addArchive(tool, url, os_version, '"--version"');
|
||||||
break;
|
break;
|
||||||
case 'phplint':
|
case /^phplint$/.test(tool):
|
||||||
script += await addPackage(tool, release, 'overtrue/', os_version);
|
script += await addPackage(tool, release, 'overtrue/', os_version);
|
||||||
break;
|
break;
|
||||||
case 'phpmd':
|
case /^phpmd$/.test(tool):
|
||||||
url = github + 'phpmd/phpmd/' + uri;
|
url = github + 'phpmd/phpmd/' + uri;
|
||||||
script += await addArchive(tool, url, os_version, '"--version"');
|
script += await addArchive(tool, url, os_version, '"--version"');
|
||||||
break;
|
break;
|
||||||
case 'phpstan':
|
case /^phpstan$/.test(tool):
|
||||||
url = github + 'phpstan/phpstan/' + uri;
|
url = github + 'phpstan/phpstan/' + uri;
|
||||||
script += await addArchive(tool, url, os_version, '"-V"');
|
script += await addArchive(tool, url, os_version, '"-V"');
|
||||||
break;
|
break;
|
||||||
case 'prestissimo':
|
case /^prestissimo$/.test(tool):
|
||||||
script += await addPackage(tool, release, 'hirak/', os_version);
|
script += await addPackage(tool, release, 'hirak/', os_version);
|
||||||
break;
|
break;
|
||||||
case 'psalm':
|
case /^psalm$/.test(tool):
|
||||||
url = github + 'vimeo/psalm/' + uri;
|
url = github + 'vimeo/psalm/' + uri;
|
||||||
script += await addArchive(tool, url, os_version, '"-v"');
|
script += await addArchive(tool, url, os_version, '"-v"');
|
||||||
break;
|
break;
|
||||||
case 'symfony':
|
case /^symfony(-cli)?$/.test(tool):
|
||||||
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, 'version');
|
script += await addArchive('symfony', url, os_version, 'version');
|
||||||
break;
|
break;
|
||||||
case 'vapor-cli':
|
case /^vapor(-cli)?$/.test(tool):
|
||||||
case 'vapor':
|
|
||||||
script += await addPackage('vapor-cli', release, 'laravel/', os_version);
|
script += await addPackage('vapor-cli', release, 'laravel/', os_version);
|
||||||
break;
|
break;
|
||||||
case 'wp':
|
case /^wp(-cli)?$/.test(tool):
|
||||||
case 'wp-cli':
|
|
||||||
url = github + (await getWpCliUrl(version));
|
url = github + (await getWpCliUrl(version));
|
||||||
script += await addArchive('wp-cli', url, os_version, '"--version"');
|
script += await addArchive('wp-cli', url, os_version, '"--version"');
|
||||||
break;
|
break;
|
||||||
|
case /^[\w.-]+\/[\w.-]+$/.test(tool):
|
||||||
|
script += await addPackage(tool.split('/')[1], release.split('/')[1].replace(/\s+/, ''), tool.split('/')[0] + '/', os_version);
|
||||||
|
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);
|
||||||
break;
|
break;
|
||||||
|
124
src/tools.ts
124
src/tools.ts
@ -32,12 +32,17 @@ export async function parseTool(
|
|||||||
const parts: string[] = release.split(':');
|
const parts: string[] = release.split(':');
|
||||||
const tool: string = parts[0];
|
const tool: string = parts[0];
|
||||||
const version: string | undefined = parts[1];
|
const version: string | undefined = parts[1];
|
||||||
switch (version) {
|
switch (true) {
|
||||||
case undefined:
|
case version === undefined:
|
||||||
return {
|
return {
|
||||||
name: tool,
|
name: tool,
|
||||||
version: 'latest'
|
version: 'latest'
|
||||||
};
|
};
|
||||||
|
case /^[\w.-]+\/[\w.-]+$/.test(tool):
|
||||||
|
return {
|
||||||
|
name: tool,
|
||||||
|
version: version
|
||||||
|
};
|
||||||
default:
|
default:
|
||||||
return {
|
return {
|
||||||
name: tool,
|
name: tool,
|
||||||
@ -283,29 +288,6 @@ export async function getComposerUrl(version: string): Promise<string> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Function to get Tools list after cleanup
|
|
||||||
*
|
|
||||||
* @param tools_csv
|
|
||||||
*/
|
|
||||||
export async function getCleanedToolsList(
|
|
||||||
tools_csv: string
|
|
||||||
): Promise<string[]> {
|
|
||||||
let tools_list: string[] = await utils.CSVArray(tools_csv);
|
|
||||||
tools_list = await addComposer(tools_list);
|
|
||||||
tools_list = tools_list
|
|
||||||
.map(function (extension: string) {
|
|
||||||
return extension
|
|
||||||
.trim()
|
|
||||||
.replace(
|
|
||||||
/-agent|behat\/|codeception\/|hirak\/|icanhazstring\/|laravel\/|narrowspark\/automatic-|overtrue\/|phpspec\/|robmorgan\/|symfony\//,
|
|
||||||
''
|
|
||||||
);
|
|
||||||
})
|
|
||||||
.filter(Boolean);
|
|
||||||
return [...new Set(tools_list)];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper function to get script to setup a tool using a phar url
|
* Helper function to get script to setup a tool using a phar url
|
||||||
*
|
*
|
||||||
@ -387,7 +369,7 @@ export async function addTools(
|
|||||||
os_version: string
|
os_version: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
let script = '\n' + (await utils.stepLog('Setup Tools', os_version));
|
let script = '\n' + (await utils.stepLog('Setup Tools', os_version));
|
||||||
const tools_list: Array<string> = await getCleanedToolsList(tools_csv);
|
const tools_list = await addComposer(await utils.CSVArray(tools_csv));
|
||||||
await utils.asyncForEach(tools_list, async function (release: string) {
|
await utils.asyncForEach(tools_list, async function (release: string) {
|
||||||
const tool_data: {name: string; version: string} = await parseTool(release);
|
const tool_data: {name: string; version: string} = await parseTool(release);
|
||||||
const tool: string = tool_data.name;
|
const tool: string = tool_data.name;
|
||||||
@ -403,124 +385,123 @@ export async function addTools(
|
|||||||
);
|
);
|
||||||
script += '\n';
|
script += '\n';
|
||||||
let url = '';
|
let url = '';
|
||||||
switch (tool) {
|
switch (true) {
|
||||||
case 'blackfire':
|
case /^blackfire(-agent)?$/.test(tool):
|
||||||
case 'grpc_php_plugin':
|
script += await utils.customPackage(
|
||||||
case 'protoc':
|
'blackfire',
|
||||||
|
'tools',
|
||||||
|
version,
|
||||||
|
os_version
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case /^grpc_php_plugin$|^protoc$/.test(tool):
|
||||||
script += await utils.customPackage(tool, 'tools', version, os_version);
|
script += await utils.customPackage(tool, 'tools', version, os_version);
|
||||||
break;
|
break;
|
||||||
case 'behat':
|
case /^behat$|^codeception$|^phpspec$/.test(tool):
|
||||||
case 'codeception':
|
|
||||||
case 'phpspec':
|
|
||||||
script += await addPackage(tool, release, tool + '/', os_version);
|
script += await addPackage(tool, release, tool + '/', os_version);
|
||||||
break;
|
break;
|
||||||
case 'blackfire-player':
|
case /^blackfire-player$/.test(tool):
|
||||||
url = await getBlackfirePlayerUrl(version, php_version);
|
url = await getBlackfirePlayerUrl(version, php_version);
|
||||||
script += await addArchive(tool, url, os_version, '"-V"');
|
script += await addArchive(tool, url, os_version, '"-V"');
|
||||||
break;
|
break;
|
||||||
case 'composer':
|
case /^composer$/.test(tool):
|
||||||
url = await getComposerUrl(version);
|
url = await getComposerUrl(version);
|
||||||
script += await addArchive('composer', url, os_version, version);
|
script += await addArchive('composer', url, os_version, version);
|
||||||
break;
|
break;
|
||||||
case 'composer-normalize':
|
case /^composer-normalize$/.test(tool):
|
||||||
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, '"-V"');
|
script += await addArchive(tool, url, os_version, '"-V"');
|
||||||
break;
|
break;
|
||||||
case 'composer-prefetcher':
|
case /^composer-prefetcher$/.test(tool):
|
||||||
script += await addPackage(
|
script += await addPackage(
|
||||||
tool,
|
'automatic-' + tool,
|
||||||
release,
|
release,
|
||||||
'narrowspark/automatic-',
|
'narrowspark/',
|
||||||
os_version
|
os_version
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'composer-require-checker':
|
case /^composer-require-checker$/.test(tool):
|
||||||
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, '"-V"');
|
script += await addArchive(tool, url, os_version, '"-V"');
|
||||||
break;
|
break;
|
||||||
case 'composer-unused':
|
case /^composer-unused$/.test(tool):
|
||||||
script += await addPackage(tool, release, 'icanhazstring/', os_version);
|
script += await addPackage(tool, release, 'icanhazstring/', os_version);
|
||||||
break;
|
break;
|
||||||
case 'cs2pr':
|
case /^cs2pr$/.test(tool):
|
||||||
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, '"-V"');
|
script += await addArchive(tool, url, os_version, '"-V"');
|
||||||
break;
|
break;
|
||||||
case 'deployer':
|
case /^deployer$/.test(tool):
|
||||||
url = await getDeployerUrl(version);
|
url = await getDeployerUrl(version);
|
||||||
script += await addArchive(tool, url, os_version, '"-V"');
|
script += await addArchive(tool, url, os_version, '"-V"');
|
||||||
break;
|
break;
|
||||||
case 'flex':
|
case /^flex$/.test(tool):
|
||||||
script += await addPackage(tool, release, 'symfony/', os_version);
|
script += await addPackage(tool, release, 'symfony/', os_version);
|
||||||
break;
|
break;
|
||||||
case 'infection':
|
case /^infection$/.test(tool):
|
||||||
url = github + 'infection/infection/' + uri;
|
url = github + 'infection/infection/' + uri;
|
||||||
script += await addArchive(tool, url, os_version, '"-V"');
|
script += await addArchive(tool, url, os_version, '"-V"');
|
||||||
break;
|
break;
|
||||||
case 'pecl':
|
case /^pecl/.test(tool):
|
||||||
script += await utils.getCommand(os_version, 'pecl');
|
script += await utils.getCommand(os_version, 'pecl');
|
||||||
break;
|
break;
|
||||||
case 'phan':
|
case /^phan$/.test(tool):
|
||||||
url = github + 'phan/phan/' + uri;
|
url = github + 'phan/phan/' + uri;
|
||||||
script += await addArchive(tool, url, os_version, '"-v"');
|
script += await addArchive(tool, url, os_version, '"-v"');
|
||||||
break;
|
break;
|
||||||
case 'phing':
|
case /^phing$/.test(tool):
|
||||||
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, '"-v"');
|
script += await addArchive(tool, url, os_version, '"-v"');
|
||||||
break;
|
break;
|
||||||
case 'phinx':
|
case /^phinx$/.test(tool):
|
||||||
script += await addPackage(tool, release, 'robmorgan/', os_version);
|
script += await addPackage(tool, release, 'robmorgan/', os_version);
|
||||||
break;
|
break;
|
||||||
case 'phive':
|
case /^phive$/.test(tool):
|
||||||
script += await addPhive(version, php_version, os_version);
|
script += await addPhive(version, php_version, os_version);
|
||||||
break;
|
break;
|
||||||
case 'php-config':
|
case /^php(-config|ize)$/.test(tool):
|
||||||
case 'phpize':
|
|
||||||
script += await addDevTools(tool, os_version);
|
script += await addDevTools(tool, os_version);
|
||||||
break;
|
break;
|
||||||
case 'php-cs-fixer':
|
case /^php-cs-fixer$/.test(tool):
|
||||||
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, '"-V"');
|
script += await addArchive(tool, url, os_version, '"-V"');
|
||||||
break;
|
break;
|
||||||
case 'phpcbf':
|
case /^php(cbf|cs)$/.test(tool):
|
||||||
case 'phpcs':
|
|
||||||
url = github + 'squizlabs/PHP_CodeSniffer/' + uri;
|
url = github + 'squizlabs/PHP_CodeSniffer/' + uri;
|
||||||
script += await addArchive(tool, url, os_version, '"--version"');
|
script += await addArchive(tool, url, os_version, '"--version"');
|
||||||
break;
|
break;
|
||||||
case 'phpcpd':
|
case /^php(cpd|unit)$/.test(tool):
|
||||||
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, '"--version"');
|
script += await addArchive(tool, url, os_version, '"--version"');
|
||||||
break;
|
break;
|
||||||
case 'phplint':
|
case /^phplint$/.test(tool):
|
||||||
script += await addPackage(tool, release, 'overtrue/', os_version);
|
script += await addPackage(tool, release, 'overtrue/', os_version);
|
||||||
break;
|
break;
|
||||||
case 'phpmd':
|
case /^phpmd$/.test(tool):
|
||||||
url = github + 'phpmd/phpmd/' + uri;
|
url = github + 'phpmd/phpmd/' + uri;
|
||||||
script += await addArchive(tool, url, os_version, '"--version"');
|
script += await addArchive(tool, url, os_version, '"--version"');
|
||||||
break;
|
break;
|
||||||
case 'phpstan':
|
case /^phpstan$/.test(tool):
|
||||||
url = github + 'phpstan/phpstan/' + uri;
|
url = github + 'phpstan/phpstan/' + uri;
|
||||||
script += await addArchive(tool, url, os_version, '"-V"');
|
script += await addArchive(tool, url, os_version, '"-V"');
|
||||||
break;
|
break;
|
||||||
case 'prestissimo':
|
case /^prestissimo$/.test(tool):
|
||||||
script += await addPackage(tool, release, 'hirak/', os_version);
|
script += await addPackage(tool, release, 'hirak/', os_version);
|
||||||
break;
|
break;
|
||||||
case 'psalm':
|
case /^psalm$/.test(tool):
|
||||||
url = github + 'vimeo/psalm/' + uri;
|
url = github + 'vimeo/psalm/' + uri;
|
||||||
script += await addArchive(tool, url, os_version, '"-v"');
|
script += await addArchive(tool, url, os_version, '"-v"');
|
||||||
break;
|
break;
|
||||||
case 'symfony':
|
case /^symfony(-cli)?$/.test(tool):
|
||||||
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, 'version');
|
script += await addArchive('symfony', url, os_version, 'version');
|
||||||
break;
|
break;
|
||||||
case 'vapor-cli':
|
case /^vapor(-cli)?$/.test(tool):
|
||||||
case 'vapor':
|
|
||||||
script += await addPackage(
|
script += await addPackage(
|
||||||
'vapor-cli',
|
'vapor-cli',
|
||||||
release,
|
release,
|
||||||
@ -528,11 +509,18 @@ export async function addTools(
|
|||||||
os_version
|
os_version
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'wp':
|
case /^wp(-cli)?$/.test(tool):
|
||||||
case 'wp-cli':
|
|
||||||
url = github + (await getWpCliUrl(version));
|
url = github + (await getWpCliUrl(version));
|
||||||
script += await addArchive('wp-cli', url, os_version, '"--version"');
|
script += await addArchive('wp-cli', url, os_version, '"--version"');
|
||||||
break;
|
break;
|
||||||
|
case /^[\w.-]+\/[\w.-]+$/.test(tool):
|
||||||
|
script += await addPackage(
|
||||||
|
tool.split('/')[1],
|
||||||
|
release.split('/')[1].replace(/\s+/, ''),
|
||||||
|
tool.split('/')[0] + '/',
|
||||||
|
os_version
|
||||||
|
);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
script += await utils.addLog(
|
script += await utils.addLog(
|
||||||
'$cross',
|
'$cross',
|
||||||
|
Loading…
Reference in New Issue
Block a user