Add GitHub releases fallback URL for phing

This commit is contained in:
Shivam Mathur 2022-03-01 01:31:58 +05:30
parent 293da043d1
commit 94c859a50e
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
3 changed files with 13 additions and 1 deletions

View File

@ -412,7 +412,7 @@ describe('Tools tests', () => {
'add_tool https://github.com/infection/infection/releases/latest/download/infection.phar infection "-V"',
'add_tool https://github.com/phan/phan/releases/latest/download/phan.phar phan "-v"',
'add_tool https://github.com/phan/phan/releases/download/1.2.3/phan.phar phan "-v"',
'add_tool https://www.phing.info/get/phing-1.2.3.phar phing "-v"',
'add_tool https://www.phing.info/get/phing-1.2.3.phar,https://github.com/phingofficial/phing/releases/download/1.2.3/phing-1.2.3.phar phing "-v"',
'add_composertool phinx phinx robmorgan/ scoped',
'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive',
'add_devtools php-config',

6
dist/index.js vendored
View File

@ -789,6 +789,12 @@ exports.addPECL = addPECL;
async function addPhing(data) {
data['url'] =
data['domain'] + '/get/phing-' + data['version'] + data['extension'];
if (data['version'] != 'latest') {
[data['prefix'], data['verb']] = ['releases', 'download'];
data['domain'] = data['github'];
data['extension'] = '-' + data['version'] + data['extension'];
data['url'] += ',' + (await getUrl(data));
}
return await addArchive(data);
}
exports.addPhing = addPhing;

View File

@ -313,6 +313,12 @@ export async function addPECL(data: RS): Promise<string> {
export async function addPhing(data: RS): Promise<string> {
data['url'] =
data['domain'] + '/get/phing-' + data['version'] + data['extension'];
if (data['version'] != 'latest') {
[data['prefix'], data['verb']] = ['releases', 'download'];
data['domain'] = data['github'];
data['extension'] = '-' + data['version'] + data['extension'];
data['url'] += ',' + (await getUrl(data));
}
return await addArchive(data);
}