Add support for jolicode/castor

This commit is contained in:
Loïck Piera
2023-06-23 16:13:17 +02:00
parent 4bd44f22a9
commit 7ce22e0264
5 changed files with 86 additions and 2 deletions

View File

@ -222,6 +222,12 @@
"version_prefix": "v",
"version_parameter": "-V"
},
"castor": {
"type": "custom-function",
"domain": "https://github.com",
"repository": "jolicode/castor",
"function": "castor"
},
"composer": {
"type": "custom-function",
"domain": "https://getcomposer.org",

View File

@ -230,6 +230,39 @@ export async function addBlackfirePlayer(data: RS): Promise<string> {
return addArchive(data);
}
/**
* Function to add Castor
*
* @param data
*/
export async function addCastor(data: RS): Promise<string> {
let filename: string;
switch (data['os']) {
case 'linux':
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);
}
/**
* Function to add composer
*
@ -479,6 +512,7 @@ export async function getData(
}
export const functionRecord: Record<string, (data: RS) => Promise<string>> = {
castor: addCastor,
composer: addComposer,
deployer: addDeployer,
dev_tools: addDevTools,