Fix blackfire-player to v1.9.3 for PHP 5.5 to PHP 7.0

This commit is contained in:
Shivam Mathur 2020-10-30 10:35:13 +05:30
parent 294f03454a
commit c8111b053c
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
3 changed files with 60 additions and 3 deletions

View File

@ -187,6 +187,21 @@ describe('Tools tests', () => {
);
});
it('checking getBlackfirePlayerUrl', async () => {
expect(await tools.getBlackfirePlayerUrl('latest', '7.4')).toBe(
'https://get.blackfire.io/blackfire-player.phar'
);
expect(await tools.getBlackfirePlayerUrl('latest', '5.5')).toBe(
'https://get.blackfire.io/blackfire-player-v1.9.3.phar'
);
expect(await tools.getBlackfirePlayerUrl('latest', '7.0')).toBe(
'https://get.blackfire.io/blackfire-player-v1.9.3.phar'
);
expect(await tools.getBlackfirePlayerUrl('1.2.3', '7.0')).toBe(
'https://get.blackfire.io/blackfire-player-v1.2.3.phar'
);
});
it('checking getDeployerUri', async () => {
expect(await tools.getDeployerUrl('latest')).toBe(
'https://deployer.org/deployer.phar'

21
dist/index.js vendored
View File

@ -1764,7 +1764,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.addTools = exports.addPackage = exports.addDevTools = exports.addArchive = exports.getCleanedToolsList = exports.getComposerUrl = exports.addComposer = exports.getWpCliUrl = exports.getSymfonyUri = exports.getDeployerUrl = exports.getPharUrl = exports.addPhive = exports.getCodeceptionUri = exports.getCodeceptionUriBuilder = exports.getUri = exports.parseTool = exports.getToolVersion = void 0;
exports.addTools = exports.addPackage = exports.addDevTools = exports.addArchive = exports.getCleanedToolsList = exports.getComposerUrl = exports.addComposer = exports.getWpCliUrl = exports.getSymfonyUri = exports.getDeployerUrl = exports.getBlackfirePlayerUrl = exports.getPharUrl = exports.addPhive = exports.getCodeceptionUri = exports.getCodeceptionUriBuilder = exports.getUri = exports.parseTool = exports.getToolVersion = void 0;
const utils = __importStar(__webpack_require__(163));
/**
* Function to get tool version
@ -1942,6 +1942,23 @@ async function getPharUrl(domain, tool, prefix, version) {
}
}
exports.getPharUrl = getPharUrl;
/**
* Function to get blackfire player url for a PHP version.
*
* @param version
* @param php_version
*/
async function getBlackfirePlayerUrl(version, php_version) {
switch (true) {
case /5\.[5-6]|7\.0/.test(php_version) && version == 'latest':
version = '1.9.3';
break;
default:
break;
}
return await getPharUrl('https://get.blackfire.io', 'blackfire-player', 'v', version);
}
exports.getBlackfirePlayerUrl = getBlackfirePlayerUrl;
/**
* Function to get the Deployer url
*
@ -2136,7 +2153,7 @@ async function addTools(tools_csv, php_version, os_version) {
script += await addPackage(tool, release, tool + '/', os_version);
break;
case 'blackfire-player':
url = await getPharUrl('https://get.blackfire.io', tool, 'v', version);
url = await getBlackfirePlayerUrl(version, php_version);
script += await addArchive(tool, url, os_version, '"-V"');
break;
case 'codeception':

View File

@ -203,6 +203,31 @@ export async function getPharUrl(
}
}
/**
* Function to get blackfire player url for a PHP version.
*
* @param version
* @param php_version
*/
export async function getBlackfirePlayerUrl(
version: string,
php_version: string
): Promise<string> {
switch (true) {
case /5\.[5-6]|7\.0/.test(php_version) && version == 'latest':
version = '1.9.3';
break;
default:
break;
}
return await getPharUrl(
'https://get.blackfire.io',
'blackfire-player',
'v',
version
);
}
/**
* Function to get the Deployer url
*
@ -454,7 +479,7 @@ export async function addTools(
script += await addPackage(tool, release, tool + '/', os_version);
break;
case 'blackfire-player':
url = await getPharUrl('https://get.blackfire.io', tool, 'v', version);
url = await getBlackfirePlayerUrl(version, php_version);
script += await addArchive(tool, url, os_version, '"-V"');
break;
case 'codeception':