Skip to content

Commit

Permalink
Improve support for blackfire-player
Browse files Browse the repository at this point in the history
  • Loading branch information
shivammathur committed Jan 16, 2023
1 parent 52eb86c commit 6db1a06
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
7 changes: 4 additions & 3 deletions __tests__/tools.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,9 @@ describe('Tools tests', () => {

it.each`
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'}
${'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'}
`(
Expand Down Expand Up @@ -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_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/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr "-V"',
'add_composertool flex flex symfony/ global',
Expand Down Expand Up @@ -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_composertool behat behat behat/ scoped',
'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/ergebnis/composer-normalize/releases/latest/download/composer-normalize.phar composer-normalize "-V"',
'add_composertool composer-require-checker composer-require-checker maglnet/ scoped',
Expand Down
10 changes: 7 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -759,9 +759,13 @@ async function addPackage(data) {
}
exports.addPackage = addPackage;
async function addBlackfirePlayer(data) {
if (/5\.[5-6]|7\.0/.test(data['php_version']) &&
data['version'] == 'latest') {
data['version'] = '1.9.3';
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);
Expand Down
11 changes: 6 additions & 5 deletions src/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,12 @@ export async function addPackage(data: RS): Promise<string> {
* @param data
*/
export async function addBlackfirePlayer(data: RS): Promise<string> {
if (
/5\.[5-6]|7\.0/.test(data['php_version']) &&
data['version'] == 'latest'
) {
data['version'] = '1.9.3';
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);
Expand Down

0 comments on commit 6db1a06

Please # to comment.