mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-26 05:23:03 +07:00
Fetch blackfire latest versions
This commit is contained in:
parent
8123132b99
commit
5c2618165a
@ -42,10 +42,10 @@ describe('Extension tests', () => {
|
|||||||
expect(win32).toContain('Platform fedora is not supported');
|
expect(win32).toContain('Platform fedora is not supported');
|
||||||
|
|
||||||
win32 = await extensions.addExtension('blackfire', '7.3', 'win32');
|
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');
|
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 () => {
|
it('checking addExtensionOnLinux', async () => {
|
||||||
@ -92,10 +92,10 @@ describe('Extension tests', () => {
|
|||||||
expect(linux).toContain('phalcon.sh phalcon4 7.3');
|
expect(linux).toContain('phalcon.sh phalcon4 7.3');
|
||||||
|
|
||||||
linux = await extensions.addExtension('blackfire', '7.3', 'linux');
|
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');
|
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 () => {
|
it('checking addExtensionOnDarwin', async () => {
|
||||||
@ -156,10 +156,10 @@ describe('Extension tests', () => {
|
|||||||
expect(darwin).toContain('sudo pecl install -f imagick');
|
expect(darwin).toContain('sudo pecl install -f imagick');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('blackfire', '7.3', 'darwin');
|
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');
|
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(
|
darwin = await extensions.addExtension(
|
||||||
'does_not_exist',
|
'does_not_exist',
|
||||||
|
@ -450,7 +450,7 @@ describe('Tools tests', () => {
|
|||||||
'7.4',
|
'7.4',
|
||||||
'win32'
|
'win32'
|
||||||
);
|
);
|
||||||
expect(script).toContain('Add-Blackfire 1.32.0');
|
expect(script).toContain('Add-Blackfire');
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'Add-Tool https://get.blackfire.io/blackfire-player-v1.8.1.phar blackfire-player'
|
'Add-Tool https://get.blackfire.io/blackfire-player-v1.8.1.phar blackfire-player'
|
||||||
);
|
);
|
||||||
|
@ -161,14 +161,4 @@ describe('Utils tests', () => {
|
|||||||
'Platform fedora is not supported'
|
'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');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
39
dist/index.js
vendored
39
dist/index.js
vendored
@ -1214,29 +1214,6 @@ async function suppressOutput(os_version) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.suppressOutput = suppressOutput;
|
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) {
|
switch (tool) {
|
||||||
case 'blackfire':
|
case 'blackfire':
|
||||||
case 'blackfire-agent':
|
case 'blackfire-agent':
|
||||||
script += await getCommand(os_version, 'blackfire ' + (await utils.getBlackfireAgentVersion()));
|
script += await getCommand(os_version, 'blackfire');
|
||||||
break;
|
break;
|
||||||
case 'blackfire-player':
|
case 'blackfire-player':
|
||||||
url = await getPharUrl('https://get.blackfire.io', tool, 'v', version);
|
url = await getPharUrl('https://get.blackfire.io', tool, 'v', version);
|
||||||
@ -2620,7 +2597,7 @@ async function addExtensionDarwin(extension_csv, version, pipe) {
|
|||||||
' ' +
|
' ' +
|
||||||
version +
|
version +
|
||||||
' ' +
|
' ' +
|
||||||
(await utils.getBlackfireVersion(ext_version));
|
extension;
|
||||||
break;
|
break;
|
||||||
// match pre-release versions. For example - xdebug-beta
|
// match pre-release versions. For example - xdebug-beta
|
||||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
@ -2692,7 +2669,7 @@ async function addExtensionDarwin(extension_csv, version, pipe) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
add_script +=
|
add_script +=
|
||||||
'\nadd_extension ' + extension + ' "' + command + '" ' + ext_prefix;
|
'\nadd_extension ' + ext_name + ' "' + command + '" ' + ext_prefix;
|
||||||
});
|
});
|
||||||
return add_script + remove_script;
|
return add_script + remove_script;
|
||||||
}
|
}
|
||||||
@ -2725,7 +2702,7 @@ async function addExtensionWindows(extension_csv, version) {
|
|||||||
' ' +
|
' ' +
|
||||||
version +
|
version +
|
||||||
' ' +
|
' ' +
|
||||||
(await utils.getBlackfireVersion(ext_version));
|
extension;
|
||||||
return;
|
return;
|
||||||
// match pre-release versions. For example - xdebug-beta
|
// match pre-release versions. For example - xdebug-beta
|
||||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
@ -2771,7 +2748,7 @@ async function addExtensionWindows(extension_csv, version) {
|
|||||||
'\n';
|
'\n';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
add_script += '\nAdd-Extension ' + extension;
|
add_script += '\nAdd-Extension ' + ext_name;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -2801,7 +2778,7 @@ async function addExtensionLinux(extension_csv, version, pipe) {
|
|||||||
remove_script += '\nremove_extension ' + ext_name.slice(1);
|
remove_script += '\nremove_extension ' + ext_name.slice(1);
|
||||||
return;
|
return;
|
||||||
// match 5.3blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
|
// 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):
|
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
|
||||||
command =
|
command =
|
||||||
'bash ' +
|
'bash ' +
|
||||||
@ -2809,7 +2786,7 @@ async function addExtensionLinux(extension_csv, version, pipe) {
|
|||||||
' ' +
|
' ' +
|
||||||
version +
|
version +
|
||||||
' ' +
|
' ' +
|
||||||
(await utils.getBlackfireVersion(ext_version));
|
extension;
|
||||||
break;
|
break;
|
||||||
// match pre-release versions. For example - xdebug-beta
|
// match pre-release versions. For example - xdebug-beta
|
||||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
@ -2877,7 +2854,7 @@ async function addExtensionLinux(extension_csv, version, pipe) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
add_script +=
|
add_script +=
|
||||||
'\nadd_extension ' + extension + ' "' + command + '" ' + ext_prefix;
|
'\nadd_extension ' + ext_name + ' "' + command + '" ' + ext_prefix;
|
||||||
});
|
});
|
||||||
return add_script + remove_script;
|
return add_script + remove_script;
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ export async function addExtensionDarwin(
|
|||||||
' ' +
|
' ' +
|
||||||
version +
|
version +
|
||||||
' ' +
|
' ' +
|
||||||
(await utils.getBlackfireVersion(ext_version));
|
extension;
|
||||||
break;
|
break;
|
||||||
// match pre-release versions. For example - xdebug-beta
|
// match pre-release versions. For example - xdebug-beta
|
||||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
@ -110,7 +110,7 @@ export async function addExtensionDarwin(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
add_script +=
|
add_script +=
|
||||||
'\nadd_extension ' + extension + ' "' + command + '" ' + ext_prefix;
|
'\nadd_extension ' + ext_name + ' "' + command + '" ' + ext_prefix;
|
||||||
});
|
});
|
||||||
return add_script + remove_script;
|
return add_script + remove_script;
|
||||||
}
|
}
|
||||||
@ -148,7 +148,7 @@ export async function addExtensionWindows(
|
|||||||
' ' +
|
' ' +
|
||||||
version +
|
version +
|
||||||
' ' +
|
' ' +
|
||||||
(await utils.getBlackfireVersion(ext_version));
|
extension;
|
||||||
return;
|
return;
|
||||||
// match pre-release versions. For example - xdebug-beta
|
// match pre-release versions. For example - xdebug-beta
|
||||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
@ -198,7 +198,7 @@ export async function addExtensionWindows(
|
|||||||
'\n';
|
'\n';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
add_script += '\nAdd-Extension ' + extension;
|
add_script += '\nAdd-Extension ' + ext_name;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -232,7 +232,7 @@ export async function addExtensionLinux(
|
|||||||
remove_script += '\nremove_extension ' + ext_name.slice(1);
|
remove_script += '\nremove_extension ' + ext_name.slice(1);
|
||||||
return;
|
return;
|
||||||
// match 5.3blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
|
// 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(
|
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
@ -242,7 +242,7 @@ export async function addExtensionLinux(
|
|||||||
' ' +
|
' ' +
|
||||||
version +
|
version +
|
||||||
' ' +
|
' ' +
|
||||||
(await utils.getBlackfireVersion(ext_version));
|
extension;
|
||||||
break;
|
break;
|
||||||
// match pre-release versions. For example - xdebug-beta
|
// match pre-release versions. For example - xdebug-beta
|
||||||
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
@ -310,7 +310,7 @@ export async function addExtensionLinux(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
add_script +=
|
add_script +=
|
||||||
'\nadd_extension ' + extension + ' "' + command + '" ' + ext_prefix;
|
'\nadd_extension ' + ext_name + ' "' + command + '" ' + ext_prefix;
|
||||||
});
|
});
|
||||||
return add_script + remove_script;
|
return add_script + remove_script;
|
||||||
}
|
}
|
||||||
|
@ -3,10 +3,10 @@ Param (
|
|||||||
[ValidateNotNull()]
|
[ValidateNotNull()]
|
||||||
[string]
|
[string]
|
||||||
$version,
|
$version,
|
||||||
[Parameter(Position = 2, Mandatory = $false)]
|
[Parameter(Position = 1, Mandatory = $true)]
|
||||||
[ValidateNotNull()]
|
[ValidateNotNull()]
|
||||||
[string]
|
[string]
|
||||||
$extension_version
|
$extension
|
||||||
)
|
)
|
||||||
|
|
||||||
$tick = ([char]8730)
|
$tick = ([char]8730)
|
||||||
@ -15,7 +15,11 @@ $ext_dir = $php_dir + '\ext'
|
|||||||
$arch='x64'
|
$arch='x64'
|
||||||
if ($version -lt '7.0') { $arch='x86' }
|
if ($version -lt '7.0') { $arch='x86' }
|
||||||
$version = $version.replace('.', '')
|
$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 '<td class="version">' | Select-Object -Index 2 }
|
||||||
|
$extension_version = [regex]::Matches($ext_data, '<td.*?>(.+)</td>') | ForEach-Object { $_.Captures[0].Groups[1].value }
|
||||||
|
}
|
||||||
if (Test-Path $ext_dir\blackfire.dll) {
|
if (Test-Path $ext_dir\blackfire.dll) {
|
||||||
Enable-PhpExtension -Extension blackfire -Path $php_dir
|
Enable-PhpExtension -Extension blackfire -Path $php_dir
|
||||||
$status="Enabled"
|
$status="Enabled"
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
version=${1/./}
|
version=${1/./}
|
||||||
extension_version=$2
|
extension=${2}
|
||||||
|
extension_version=$(echo "$extension" | cut -d '-' -f 2)
|
||||||
|
if [ "$extension_version" = "blackfire" ]; then
|
||||||
|
extension_version=$(curl -sSL https://blackfire.io/docs/up-and-running/update | grep 'class="version"' | sed -e 's/<[^>]*>\| //g' | sed -n '3,3p')
|
||||||
|
fi
|
||||||
ext_dir=$(php -i | grep "extension_dir => /" | sed -e "s|.*=> s*||")
|
ext_dir=$(php -i | grep "extension_dir => /" | sed -e "s|.*=> s*||")
|
||||||
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
|
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
|
||||||
ini_file="$scan_dir/50-blackfire.ini"
|
ini_file="$scan_dir/50-blackfire.ini"
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
version=${1/./}
|
version=${1/./}
|
||||||
extension_version=$2
|
extension=${2}
|
||||||
|
extension_version=$(echo "$extension" | cut -d '-' -f 2)
|
||||||
|
if [ "$extension_version" = "blackfire" ]; then
|
||||||
|
extension_version=$(curl -sSL https://blackfire.io/docs/up-and-running/update | grep 'class="version"' | sed -e "s/ //g" | sed -n '3,3p' | cut -d '>' -f 2 | cut -d '<' -f 1)
|
||||||
|
fi
|
||||||
ext_dir=$(php -i | grep -Ei "extension_dir => /usr" | sed -e "s|.*=> s*||")
|
ext_dir=$(php -i | grep -Ei "extension_dir => /usr" | sed -e "s|.*=> s*||")
|
||||||
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
|
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
|
||||||
ini_file="$scan_dir/50-blackfire.ini"
|
ini_file="$scan_dir/50-blackfire.ini"
|
||||||
|
@ -216,13 +216,8 @@ Function Add-Pecl() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Function Add-Blackfire() {
|
Function Add-Blackfire() {
|
||||||
Param (
|
$agent_data = Invoke-WebRequest https://blackfire.io/docs/up-and-running/update | ForEach-Object { $_.tostring() -split "[`r`n]" | Select-String '<td class="version">' | Select-Object -Index 0 }
|
||||||
[Parameter(Position = 0, Mandatory = $true)]
|
$agent_version = [regex]::Matches($agent_data, '<td.*?>(.+)</td>') | ForEach-Object {$_.Captures[0].Groups[1].value }
|
||||||
[ValidateNotNull()]
|
|
||||||
[ValidateLength(1, [int]::MaxValue)]
|
|
||||||
[string]
|
|
||||||
$agent_version
|
|
||||||
)
|
|
||||||
$url = "https://packages.blackfire.io/binaries/blackfire-agent/${agent_version}/blackfire-agent-windows_${arch_name}.zip"
|
$url = "https://packages.blackfire.io/binaries/blackfire-agent/${agent_version}/blackfire-agent-windows_${arch_name}.zip"
|
||||||
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $php_dir\blackfire.zip >$null 2>&1
|
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $php_dir\blackfire.zip >$null 2>&1
|
||||||
Expand-Archive -Path $php_dir\blackfire.zip -DestinationPath $php_dir -Force >$null 2>&1
|
Expand-Archive -Path $php_dir\blackfire.zip -DestinationPath $php_dir -Force >$null 2>&1
|
||||||
|
@ -438,10 +438,7 @@ export async function addTools(
|
|||||||
switch (tool) {
|
switch (tool) {
|
||||||
case 'blackfire':
|
case 'blackfire':
|
||||||
case 'blackfire-agent':
|
case 'blackfire-agent':
|
||||||
script += await getCommand(
|
script += await getCommand(os_version, 'blackfire');
|
||||||
os_version,
|
|
||||||
'blackfire ' + (await utils.getBlackfireAgentVersion())
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
case 'blackfire-player':
|
case 'blackfire-player':
|
||||||
url = await getPharUrl('https://get.blackfire.io', tool, 'v', version);
|
url = await getPharUrl('https://get.blackfire.io', tool, 'v', version);
|
||||||
|
25
src/utils.ts
25
src/utils.ts
@ -255,28 +255,3 @@ export async function suppressOutput(os_version: string): Promise<string> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Function to get Blackfire version
|
|
||||||
*
|
|
||||||
* @param blackfire_version
|
|
||||||
*/
|
|
||||||
export async function getBlackfireVersion(
|
|
||||||
blackfire_version: null | undefined | string
|
|
||||||
): Promise<string> {
|
|
||||||
switch (blackfire_version) {
|
|
||||||
case null:
|
|
||||||
case undefined:
|
|
||||||
case '':
|
|
||||||
return '1.31.0';
|
|
||||||
default:
|
|
||||||
return blackfire_version;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function to get Blackfire Agent version
|
|
||||||
*/
|
|
||||||
export async function getBlackfireAgentVersion(): Promise<string> {
|
|
||||||
return '1.32.0';
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user