diff --git a/__tests__/extensions.test.ts b/__tests__/extensions.test.ts index 4e06f4a3..81734487 100644 --- a/__tests__/extensions.test.ts +++ b/__tests__/extensions.test.ts @@ -42,10 +42,10 @@ describe('Extension tests', () => { expect(win32).toContain('Platform fedora is not supported'); win32 = await extensions.addExtension('blackfire', '7.3', 'win32'); - expect(win32).toContain('blackfire.ps1 7.3 1.31.0'); + expect(win32).toContain('blackfire.ps1 7.3 blackfire'); win32 = await extensions.addExtension('blackfire-1.31.0', '7.3', 'win32'); - expect(win32).toContain('blackfire.ps1 7.3 1.31.0'); + expect(win32).toContain('blackfire.ps1 7.3 blackfire-1.31.0'); }); it('checking addExtensionOnLinux', async () => { @@ -92,10 +92,10 @@ describe('Extension tests', () => { expect(linux).toContain('phalcon.sh phalcon4 7.3'); linux = await extensions.addExtension('blackfire', '7.3', 'linux'); - expect(linux).toContain('blackfire.sh 7.3 1.31.0'); + expect(linux).toContain('blackfire.sh 7.3 blackfire'); linux = await extensions.addExtension('blackfire-1.31.0', '7.3', 'linux'); - expect(linux).toContain('blackfire.sh 7.3 1.31.0'); + expect(linux).toContain('blackfire.sh 7.3 blackfire-1.31.0'); }); it('checking addExtensionOnDarwin', async () => { @@ -156,10 +156,10 @@ describe('Extension tests', () => { expect(darwin).toContain('sudo pecl install -f imagick'); darwin = await extensions.addExtension('blackfire', '7.3', 'darwin'); - expect(darwin).toContain('blackfire_darwin.sh 7.3 1.31.0'); + expect(darwin).toContain('blackfire_darwin.sh 7.3 blackfire'); darwin = await extensions.addExtension('blackfire-1.31.0', '7.3', 'darwin'); - expect(darwin).toContain('blackfire_darwin.sh 7.3 1.31.0'); + expect(darwin).toContain('blackfire_darwin.sh 7.3 blackfire-1.31.0'); darwin = await extensions.addExtension( 'does_not_exist', diff --git a/__tests__/tools.test.ts b/__tests__/tools.test.ts index 1de2efe3..8a16d45c 100644 --- a/__tests__/tools.test.ts +++ b/__tests__/tools.test.ts @@ -450,7 +450,7 @@ describe('Tools tests', () => { '7.4', 'win32' ); - expect(script).toContain('Add-Blackfire 1.32.0'); + expect(script).toContain('Add-Blackfire'); expect(script).toContain( 'Add-Tool https://get.blackfire.io/blackfire-player-v1.8.1.phar blackfire-player' ); diff --git a/__tests__/utils.test.ts b/__tests__/utils.test.ts index 92e29b85..c4dfdfc3 100644 --- a/__tests__/utils.test.ts +++ b/__tests__/utils.test.ts @@ -161,14 +161,4 @@ describe('Utils tests', () => { 'Platform fedora is not supported' ); }); - - it('checking getBlackfireVersion', async () => { - expect(await utils.getBlackfireVersion('')).toEqual('1.31.0'); - expect(await utils.getBlackfireVersion(undefined)).toEqual('1.31.0'); - expect(await utils.getBlackfireVersion(null)).toEqual('1.31.0'); - expect(await utils.getBlackfireVersion('1.32.0')).toEqual('1.32.0'); - }); - it('checking getBlackfireAgentVersion', async () => { - expect(await utils.getBlackfireAgentVersion()).toEqual('1.32.0'); - }); }); diff --git a/dist/index.js b/dist/index.js index f814feb0..129b7101 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1214,29 +1214,6 @@ async function suppressOutput(os_version) { } } exports.suppressOutput = suppressOutput; -/** - * Function to get Blackfire version - * - * @param blackfire_version - */ -async function getBlackfireVersion(blackfire_version) { - switch (blackfire_version) { - case null: - case undefined: - case '': - return '1.31.0'; - default: - return blackfire_version; - } -} -exports.getBlackfireVersion = getBlackfireVersion; -/** - * Function to get Blackfire Agent version - */ -async function getBlackfireAgentVersion() { - return '1.32.0'; -} -exports.getBlackfireAgentVersion = getBlackfireAgentVersion; /***/ }), @@ -1940,7 +1917,7 @@ async function addTools(tools_csv, php_version, os_version) { switch (tool) { case 'blackfire': case 'blackfire-agent': - script += await getCommand(os_version, 'blackfire ' + (await utils.getBlackfireAgentVersion())); + script += await getCommand(os_version, 'blackfire'); break; case 'blackfire-player': url = await getPharUrl('https://get.blackfire.io', tool, 'v', version); @@ -2620,7 +2597,7 @@ async function addExtensionDarwin(extension_csv, version, pipe) { ' ' + version + ' ' + - (await utils.getBlackfireVersion(ext_version)); + extension; break; // match pre-release versions. For example - xdebug-beta case /.*-(beta|alpha|devel|snapshot)/.test(version_extension): @@ -2692,7 +2669,7 @@ async function addExtensionDarwin(extension_csv, version, pipe) { break; } add_script += - '\nadd_extension ' + extension + ' "' + command + '" ' + ext_prefix; + '\nadd_extension ' + ext_name + ' "' + command + '" ' + ext_prefix; }); return add_script + remove_script; } @@ -2725,7 +2702,7 @@ async function addExtensionWindows(extension_csv, version) { ' ' + version + ' ' + - (await utils.getBlackfireVersion(ext_version)); + extension; return; // match pre-release versions. For example - xdebug-beta case /.*-(beta|alpha|devel|snapshot)/.test(version_extension): @@ -2771,7 +2748,7 @@ async function addExtensionWindows(extension_csv, version) { '\n'; break; default: - add_script += '\nAdd-Extension ' + extension; + add_script += '\nAdd-Extension ' + ext_name; break; } }); @@ -2801,7 +2778,7 @@ async function addExtensionLinux(extension_csv, version, pipe) { remove_script += '\nremove_extension ' + ext_name.slice(1); return; // match 5.3blackfire...5.6blackfire, 7.0blackfire...7.4blackfire - // match 5.3blackfire-1.31.0...5.6blackfire-1.31.0, 7.0blackfire-1.31.0...7.4blackfire-1.31.0 + // match 5.3blackfire-{semver}...5.6blackfire-{semver}, 7.0blackfire-{semver}...7.4blackfire-{semver} case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension): command = 'bash ' + @@ -2809,7 +2786,7 @@ async function addExtensionLinux(extension_csv, version, pipe) { ' ' + version + ' ' + - (await utils.getBlackfireVersion(ext_version)); + extension; break; // match pre-release versions. For example - xdebug-beta case /.*-(beta|alpha|devel|snapshot)/.test(version_extension): @@ -2877,7 +2854,7 @@ async function addExtensionLinux(extension_csv, version, pipe) { break; } add_script += - '\nadd_extension ' + extension + ' "' + command + '" ' + ext_prefix; + '\nadd_extension ' + ext_name + ' "' + command + '" ' + ext_prefix; }); return add_script + remove_script; } diff --git a/src/extensions.ts b/src/extensions.ts index 23703243..f38c565a 100644 --- a/src/extensions.ts +++ b/src/extensions.ts @@ -38,7 +38,7 @@ export async function addExtensionDarwin( ' ' + version + ' ' + - (await utils.getBlackfireVersion(ext_version)); + extension; break; // match pre-release versions. For example - xdebug-beta case /.*-(beta|alpha|devel|snapshot)/.test(version_extension): @@ -110,7 +110,7 @@ export async function addExtensionDarwin( break; } add_script += - '\nadd_extension ' + extension + ' "' + command + '" ' + ext_prefix; + '\nadd_extension ' + ext_name + ' "' + command + '" ' + ext_prefix; }); return add_script + remove_script; } @@ -148,7 +148,7 @@ export async function addExtensionWindows( ' ' + version + ' ' + - (await utils.getBlackfireVersion(ext_version)); + extension; return; // match pre-release versions. For example - xdebug-beta case /.*-(beta|alpha|devel|snapshot)/.test(version_extension): @@ -198,7 +198,7 @@ export async function addExtensionWindows( '\n'; break; default: - add_script += '\nAdd-Extension ' + extension; + add_script += '\nAdd-Extension ' + ext_name; break; } }); @@ -232,7 +232,7 @@ export async function addExtensionLinux( remove_script += '\nremove_extension ' + ext_name.slice(1); return; // match 5.3blackfire...5.6blackfire, 7.0blackfire...7.4blackfire - // match 5.3blackfire-1.31.0...5.6blackfire-1.31.0, 7.0blackfire-1.31.0...7.4blackfire-1.31.0 + // match 5.3blackfire-{semver}...5.6blackfire-{semver}, 7.0blackfire-{semver}...7.4blackfire-{semver} case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test( version_extension ): @@ -242,7 +242,7 @@ export async function addExtensionLinux( ' ' + version + ' ' + - (await utils.getBlackfireVersion(ext_version)); + extension; break; // match pre-release versions. For example - xdebug-beta case /.*-(beta|alpha|devel|snapshot)/.test(version_extension): @@ -310,7 +310,7 @@ export async function addExtensionLinux( break; } add_script += - '\nadd_extension ' + extension + ' "' + command + '" ' + ext_prefix; + '\nadd_extension ' + ext_name + ' "' + command + '" ' + ext_prefix; }); return add_script + remove_script; } diff --git a/src/scripts/ext/blackfire.ps1 b/src/scripts/ext/blackfire.ps1 index 084eb544..2b391d29 100644 --- a/src/scripts/ext/blackfire.ps1 +++ b/src/scripts/ext/blackfire.ps1 @@ -3,10 +3,10 @@ Param ( [ValidateNotNull()] [string] $version, - [Parameter(Position = 2, Mandatory = $false)] + [Parameter(Position = 1, Mandatory = $true)] [ValidateNotNull()] [string] - $extension_version + $extension ) $tick = ([char]8730) @@ -15,7 +15,11 @@ $ext_dir = $php_dir + '\ext' $arch='x64' if ($version -lt '7.0') { $arch='x86' } $version = $version.replace('.', '') - +$extension_version = $extension.split('-')[1] +if ($extension_version -notmatch "\S") { + $ext_data = Invoke-WebRequest https://blackfire.io/docs/up-and-running/update | ForEach-Object { $_.tostring() -split "[`r`n]" | Select-String '