Skip to content

Commit

Permalink
Add GitHub releases fallback URL for phing
Browse files Browse the repository at this point in the history
  • Loading branch information
shivammathur committed Mar 1, 2022
1 parent 293da04 commit 94c859a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion __tests__/tools.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
6 changes: 6 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions src/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 94c859a

Please sign in to comment.