Fix version prefix for castor

This commit is contained in:
Shivam Mathur 2023-06-23 23:28:05 +05:30
parent e40aa32c04
commit c63f07d82e
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
4 changed files with 10 additions and 44 deletions

View File

@ -539,6 +539,7 @@ describe('Tools tests', () => {
const data = getData({ const data = getData({
tool: 'castor', tool: 'castor',
php_version: '8.1', php_version: '8.1',
version_prefix: 'v',
version: version, version: version,
os: os os: os
}); });

22
dist/index.js vendored
View File

@ -838,25 +838,9 @@ async function addBlackfirePlayer(data) {
} }
exports.addBlackfirePlayer = addBlackfirePlayer; exports.addBlackfirePlayer = addBlackfirePlayer;
async function addCastor(data) { async function addCastor(data) {
let filename; data['tool'] = 'castor.' + data['os'].replace('win32', 'windows') + '-amd64';
switch (data['os']) { data['url'] = await getUrl(data);
case 'linux': data['tool'] = 'castor';
case 'darwin':
filename = 'castor.' + data['os'] + '-amd64.phar';
break;
case 'win32':
filename = 'castor.windows-amd64.phar';
break;
default:
return await utils.log('Platform ' + data['os'] + ' is not supported', data['os'], 'error');
}
if (data['version'] === 'latest') {
data['uri'] = ['releases/latest/download', filename].join('/');
}
else {
data['uri'] = ['releases/download', 'v' + data['version'], filename].join('/');
}
data['url'] = [data['domain'], data['repository'], data['uri']].join('/');
return await addArchive(data); return await addArchive(data);
} }
exports.addCastor = addCastor; exports.addCastor = addCastor;

View File

@ -226,7 +226,9 @@
"type": "custom-function", "type": "custom-function",
"domain": "https://github.com", "domain": "https://github.com",
"repository": "jolicode/castor", "repository": "jolicode/castor",
"function": "castor" "function": "castor",
"version_prefix": "v",
"version_parameter": "-V"
}, },
"composer": { "composer": {
"type": "custom-function", "type": "custom-function",

View File

@ -236,30 +236,9 @@ export async function addBlackfirePlayer(data: RS): Promise<string> {
* @param data * @param data
*/ */
export async function addCastor(data: RS): Promise<string> { export async function addCastor(data: RS): Promise<string> {
let filename: string; data['tool'] = 'castor.' + data['os'].replace('win32', 'windows') + '-amd64';
switch (data['os']) { data['url'] = await getUrl(data);
case 'linux': data['tool'] = 'castor';
case 'darwin':
filename = 'castor.' + data['os'] + '-amd64.phar';
break;
case 'win32':
filename = 'castor.windows-amd64.phar';
break;
default:
return await utils.log(
'Platform ' + data['os'] + ' is not supported',
data['os'],
'error'
);
}
if (data['version'] === 'latest') {
data['uri'] = ['releases/latest/download', filename].join('/');
} else {
data['uri'] = ['releases/download', 'v' + data['version'], filename].join(
'/'
);
}
data['url'] = [data['domain'], data['repository'], data['uri']].join('/');
return await addArchive(data); return await addArchive(data);
} }