Skip to content

Commit

Permalink
Fix blackfire-player on Linux and macOS
Browse files Browse the repository at this point in the history
Drop support for blackfire-player on Windows
  • Loading branch information
shivammathur committed Sep 13, 2023
1 parent 0de5aa9 commit 7fdd3ec
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 27 deletions.
20 changes: 11 additions & 9 deletions __tests__/tools.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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"',
Expand Down
23 changes: 14 additions & 9 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -826,16 +826,21 @@ async function addPackage(data) {
}
exports.addPackage = addPackage;
async function addBlackfirePlayer(data) {
if (data['version'] == 'latest') {
if (/5\.[5-6]|7\.0/.test(data['php_version'])) {
data['version'] = '1.9.3';
}
else if (/7\.[1-4]|8\.0/.test(data['php_version'])) {
data['version'] = '1.22.0';
}
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';
}
else if (/7\.[1-4]|8\.0/.test(data['php_version'])) {
data['version'] = '1.22.0';
}
}
data['url'] = await getPharUrl(data);
return addArchive(data);
}
data['url'] = await getPharUrl(data);
return addArchive(data);
}
exports.addBlackfirePlayer = addBlackfirePlayer;
async function addCastor(data) {
Expand Down
4 changes: 3 additions & 1 deletion src/scripts/tools/add_tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 18 additions & 8 deletions src/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,15 +219,25 @@ export async function addPackage(data: RS): Promise<string> {
* @param data
*/
export async function addBlackfirePlayer(data: RS): Promise<string> {
if (data['version'] == 'latest') {
if (/5\.[5-6]|7\.0/.test(data['php_version'])) {
data['version'] = '1.9.3';
} else if (/7\.[1-4]|8\.0/.test(data['php_version'])) {
data['version'] = '1.22.0';
}
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';
} else if (/7\.[1-4]|8\.0/.test(data['php_version'])) {
data['version'] = '1.22.0';
}
}
data['url'] = await getPharUrl(data);
return addArchive(data);
}
data['url'] = await getPharUrl(data);
return addArchive(data);
}

/**
Expand Down

0 comments on commit 7fdd3ec

Please sign in to comment.