mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +07:00
Add support for tools: none
This commit is contained in:
parent
254ecd5a66
commit
8cfcbb030f
@ -583,5 +583,15 @@ describe('Tools tests', () => {
|
|||||||
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 snapshot'
|
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-snapshot.phar,https://getcomposer.org/composer.phar composer snapshot'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
script = await tools.addTools('none', '7.4', 'linux');
|
||||||
|
expect(script).toStrictEqual('');
|
||||||
|
|
||||||
|
script = await tools.addTools('none, phpunit', '7.4', 'linux');
|
||||||
|
expect(script).toStrictEqual(
|
||||||
|
'\nstep_log "Setup Tools"' +
|
||||||
|
'\nadd_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar,https://getcomposer.org/composer-stable.phar composer latest\n' +
|
||||||
|
'\nadd_tool https://phar.phpunit.de/phpunit.phar phpunit "--version"'
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
10
dist/index.js
vendored
10
dist/index.js
vendored
@ -2452,7 +2452,13 @@ exports.addPackage = addPackage;
|
|||||||
* @param os_version
|
* @param os_version
|
||||||
*/
|
*/
|
||||||
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';
|
||||||
|
if (tools_csv === 'none') {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
script += await utils.stepLog('Setup Tools', os_version);
|
||||||
|
}
|
||||||
const tools_list = await addComposer(await utils.CSVArray(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);
|
||||||
@ -2575,6 +2581,8 @@ async function addTools(tools_csv, php_version, os_version) {
|
|||||||
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 /^none$/.test(tool):
|
||||||
|
break;
|
||||||
case /^[\w.-]+\/[\w.-]+$/.test(tool):
|
case /^[\w.-]+\/[\w.-]+$/.test(tool):
|
||||||
script += await addPackage(tool.split('/')[1], release.split('/')[1].replace(/\s+/, ''), tool.split('/')[0] + '/', os_version);
|
script += await addPackage(tool.split('/')[1], release.split('/')[1].replace(/\s+/, ''), tool.split('/')[0] + '/', os_version);
|
||||||
break;
|
break;
|
||||||
|
@ -368,7 +368,12 @@ export async function addTools(
|
|||||||
php_version: string,
|
php_version: string,
|
||||||
os_version: string
|
os_version: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
let script = '\n' + (await utils.stepLog('Setup Tools', os_version));
|
let script = '\n';
|
||||||
|
if (tools_csv === 'none') {
|
||||||
|
return '';
|
||||||
|
} else {
|
||||||
|
script += await utils.stepLog('Setup Tools', os_version);
|
||||||
|
}
|
||||||
const tools_list = await addComposer(await utils.CSVArray(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);
|
||||||
@ -513,6 +518,8 @@ export async function addTools(
|
|||||||
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 /^none$/.test(tool):
|
||||||
|
break;
|
||||||
case /^[\w.-]+\/[\w.-]+$/.test(tool):
|
case /^[\w.-]+\/[\w.-]+$/.test(tool):
|
||||||
script += await addPackage(
|
script += await addPackage(
|
||||||
tool.split('/')[1],
|
tool.split('/')[1],
|
||||||
|
Loading…
Reference in New Issue
Block a user