Fix blackfire-player on Linux and macOS

Drop support for blackfire-player on Windows
This commit is contained in:
Shivam Mathur 2023-09-11 12:54:15 +05:30
parent 0de5aa9140
commit 7fdd3ece87
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
4 changed files with 46 additions and 27 deletions

View File

@ -281,16 +281,18 @@ describe('Tools tests', () => {
);
it.each`
version | php_version | url
${'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'}
${'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'} | ${'7.0'} | ${'https://get.blackfire.io/blackfire-player-v1.9.3.phar'}
os | version | php_version | url
${'linux'} | ${'latest'} | ${'8.1'} | ${'https://get.blackfire.io/blackfire-player.phar'}
${'linux'} | ${'1.2.3'} | ${'7.4'} | ${'https://get.blackfire.io/blackfire-player-v1.2.3.phar'}
${'linux'} | ${'latest'} | ${'7.4'} | ${'https://get.blackfire.io/blackfire-player-v1.22.0.phar'}
${'linux'} | ${'latest'} | ${'5.5'} | ${'https://get.blackfire.io/blackfire-player-v1.9.3.phar'}
${'linux'} | ${'latest'} | ${'7.0'} | ${'https://get.blackfire.io/blackfire-player-v1.9.3.phar'}
${'win32'} | ${'latest'} | ${'7.0'} | ${'blackfire-player is not a windows tool'}
`(
'checking addBlackfirePlayer: $version, $php_version',
async ({version, php_version, url}) => {
'checking addBlackfirePlayer: $os, $version, $php_version',
async ({os, version, php_version, url}) => {
const data = getData({
os: os,
tool: 'blackfire-player',
domain: 'https://get.blackfire.io',
version_prefix: 'v',
@ -480,7 +482,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-Blackfire',
'Add-Tool https://get.blackfire.io/blackfire-player-v1.2.3.phar blackfire-player "-V"',
'blackfire-player is not a windows tool',
'Add-Tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr "-V"',
'Add-Tool https://github.com/bmitch/churn-php/releases/latest/download/churn.phar churn "-V"',
'Add-Tool https://deployer.org/deployer.phar deployer "-V"',

5
dist/index.js vendored
View File

@ -826,6 +826,10 @@ async function addPackage(data) {
}
exports.addPackage = addPackage;
async function addBlackfirePlayer(data) {
switch (data['os']) {
case 'win32':
return await utils.addLog('$cross', data['tool'], data['tool'] + ' is not a windows tool', 'win32');
default:
if (data['version'] == 'latest') {
if (/5\.[5-6]|7\.0/.test(data['php_version'])) {
data['version'] = '1.9.3';
@ -836,6 +840,7 @@ async function addBlackfirePlayer(data) {
}
data['url'] = await getPharUrl(data);
return addArchive(data);
}
}
exports.addBlackfirePlayer = addBlackfirePlayer;
async function addCastor(data) {

View File

@ -72,7 +72,9 @@ set_composer_auth() {
add_tools_helper() {
tool=$1
extensions=()
if [ "$tool" = "codeception" ]; then
if [ "$tool" = "blackfire-player" ]; then
extensions+=(uuid)
elif [ "$tool" = "codeception" ]; then
extensions+=(json mbstring)
sudo ln -s "$scoped_dir"/vendor/bin/codecept "$scoped_dir"/vendor/bin/codeception
elif [ "$tool" = "composer" ]; then

View File

@ -219,6 +219,15 @@ export async function addPackage(data: RS): Promise<string> {
* @param data
*/
export async function addBlackfirePlayer(data: RS): Promise<string> {
switch (data['os']) {
case 'win32':
return await utils.addLog(
'$cross',
data['tool'],
data['tool'] + ' is not a windows tool',
'win32'
);
default:
if (data['version'] == 'latest') {
if (/5\.[5-6]|7\.0/.test(data['php_version'])) {
data['version'] = '1.9.3';
@ -228,6 +237,7 @@ export async function addBlackfirePlayer(data: RS): Promise<string> {
}
data['url'] = await getPharUrl(data);
return addArchive(data);
}
}
/**