diff --git a/__tests__/tools.test.ts b/__tests__/tools.test.ts index e582bd89..e430a404 100644 --- a/__tests__/tools.test.ts +++ b/__tests__/tools.test.ts @@ -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', diff --git a/dist/index.js b/dist/index.js index 107719d8..e5de0444 100644 --- a/dist/index.js +++ b/dist/index.js @@ -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; diff --git a/src/tools.ts b/src/tools.ts index d321d2a5..d5030a19 100644 --- a/src/tools.ts +++ b/src/tools.ts @@ -313,6 +313,12 @@ export async function addPECL(data: RS): Promise { export async function addPhing(data: RS): Promise { 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); }