Improve support for blackfire-player

This commit is contained in:
Shivam Mathur 2023-01-17 05:11:26 +05:30
parent 52eb86c60c
commit 6db1a06425
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
3 changed files with 17 additions and 11 deletions

View File

@ -265,8 +265,9 @@ describe('Tools tests', () => {
it.each` it.each`
version | php_version | url version | php_version | url
${'latest'} | ${'7.4'} | ${'https://get.blackfire.io/blackfire-player.phar'} ${'latest'} | ${'8.1'} | ${'https://get.blackfire.io/blackfire-player.phar'}
${'1.2.3'} | ${'7.4'} | ${'https://get.blackfire.io/blackfire-player-v1.2.3.phar'} ${'1.2.3'} | ${'7.4'} | ${'https://get.blackfire.io/blackfire-player-v1.2.3.phar'}
${'latest'} | ${'7.4'} | ${'https://get.blackfire.io/blackfire-player-v1.22.0.phar'}
${'latest'} | ${'5.5'} | ${'https://get.blackfire.io/blackfire-player-v1.9.3.phar'} ${'latest'} | ${'5.5'} | ${'https://get.blackfire.io/blackfire-player-v1.9.3.phar'}
${'latest'} | ${'7.0'} | ${'https://get.blackfire.io/blackfire-player-v1.9.3.phar'} ${'latest'} | ${'7.0'} | ${'https://get.blackfire.io/blackfire-player-v1.9.3.phar'}
`( `(
@ -376,7 +377,7 @@ describe('Tools tests', () => {
[ [
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer', 'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer',
'add_blackfire', 'add_blackfire',
'add_tool https://get.blackfire.io/blackfire-player.phar blackfire-player "-V"', 'add_tool https://get.blackfire.io/blackfire-player-v1.22.0.phar blackfire-player "-V"',
'add_tool https://github.com/bmitch/churn-php/releases/latest/download/churn.phar churn "-V"', 'add_tool https://github.com/bmitch/churn-php/releases/latest/download/churn.phar churn "-V"',
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr "-V"', 'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr "-V"',
'add_composertool flex flex symfony/ global', 'add_composertool flex flex symfony/ global',
@ -417,7 +418,7 @@ describe('Tools tests', () => {
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer', 'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer',
'add_composertool behat behat behat/ scoped', 'add_composertool behat behat behat/ scoped',
'add_blackfire', 'add_blackfire',
'add_tool https://get.blackfire.io/blackfire-player.phar blackfire-player "-V"', 'add_tool https://get.blackfire.io/blackfire-player-v1.22.0.phar blackfire-player "-V"',
'add_tool https://github.com/bmitch/churn-php/releases/latest/download/churn.phar churn "-V"', 'add_tool https://github.com/bmitch/churn-php/releases/latest/download/churn.phar churn "-V"',
'add_tool https://github.com/ergebnis/composer-normalize/releases/latest/download/composer-normalize.phar composer-normalize "-V"', 'add_tool https://github.com/ergebnis/composer-normalize/releases/latest/download/composer-normalize.phar composer-normalize "-V"',
'add_composertool composer-require-checker composer-require-checker maglnet/ scoped', 'add_composertool composer-require-checker composer-require-checker maglnet/ scoped',

8
dist/index.js vendored
View File

@ -759,10 +759,14 @@ async function addPackage(data) {
} }
exports.addPackage = addPackage; exports.addPackage = addPackage;
async function addBlackfirePlayer(data) { async function addBlackfirePlayer(data) {
if (/5\.[5-6]|7\.0/.test(data['php_version']) && if (data['version'] == 'latest') {
data['version'] == 'latest') { if (/5\.[5-6]|7\.0/.test(data['php_version'])) {
data['version'] = '1.9.3'; data['version'] = '1.9.3';
} }
else if (/7\.[1-4]|8\.0/.test(data['php_version'])) {
data['version'] = '1.22.0';
}
}
data['url'] = await getPharUrl(data); data['url'] = await getPharUrl(data);
return addArchive(data); return addArchive(data);
} }

View File

@ -218,11 +218,12 @@ export async function addPackage(data: RS): Promise<string> {
* @param data * @param data
*/ */
export async function addBlackfirePlayer(data: RS): Promise<string> { export async function addBlackfirePlayer(data: RS): Promise<string> {
if ( if (data['version'] == 'latest') {
/5\.[5-6]|7\.0/.test(data['php_version']) && if (/5\.[5-6]|7\.0/.test(data['php_version'])) {
data['version'] == 'latest'
) {
data['version'] = '1.9.3'; data['version'] = '1.9.3';
} else if (/7\.[1-4]|8\.0/.test(data['php_version'])) {
data['version'] = '1.22.0';
}
} }
data['url'] = await getPharUrl(data); data['url'] = await getPharUrl(data);
return addArchive(data); return addArchive(data);