mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 11:51:07 +07:00
Assorted fixes
This commit is contained in:
parent
d27996462b
commit
0c0ae39775
@ -116,8 +116,8 @@ describe('Extension tests', () => {
|
||||
darwin = await extensions.addExtension('xdebug', '7.0', 'darwin');
|
||||
expect(darwin).toContain('add_brew_extension xdebug');
|
||||
|
||||
darwin = await extensions.addExtension('xdebug', '7.2', 'darwin');
|
||||
expect(darwin).toContain('add_brew_extension xdebug');
|
||||
darwin = await extensions.addExtension('xdebug2', '7.2', 'darwin');
|
||||
expect(darwin).toContain('add_brew_extension xdebug2');
|
||||
|
||||
darwin = await extensions.addExtension(
|
||||
'does_not_exist',
|
||||
|
@ -36,7 +36,7 @@ export async function addExtensionDarwin(
|
||||
version_extension
|
||||
):
|
||||
case /(7\.[1-4]|8\.0])pcov/.test(version_extension):
|
||||
command = 'add_brew_extension ' + extension_name;
|
||||
command = 'add_brew_extension ' + extension_name.replace('pecl_', '');
|
||||
break;
|
||||
// match sqlite
|
||||
case /^sqlite$/.test(extension):
|
||||
@ -93,7 +93,7 @@ export async function addExtensionWindows(
|
||||
script +=
|
||||
'\nAdd-Extension mysql\nAdd-Extension mysqli\nAdd-Extension mysqlnd';
|
||||
break;
|
||||
// match 7.2xdebug
|
||||
// match 7.2xdebug2 to 7.4xdebug2
|
||||
case /7\.[2-4]xdebug2/.test(version_extension):
|
||||
script += '\nAdd-Extension xdebug stable 2.9.8';
|
||||
break;
|
||||
@ -177,7 +177,7 @@ export async function addExtensionLinux(
|
||||
' ' +
|
||||
version;
|
||||
return;
|
||||
// match 7.2xdebug
|
||||
// match 7.2xdebug2 to 7.4xdebug2
|
||||
case /^7\.[2-4]xdebug2$/.test(version_extension):
|
||||
script += '\nadd_pecl_extension xdebug 2.9.8 ' + ext_prefix;
|
||||
return;
|
||||
|
@ -102,12 +102,13 @@ add_brew_tap() {
|
||||
|
||||
# Function to install a php extension from shivammathur/extensions tap.
|
||||
add_brew_extension() {
|
||||
extension=$1
|
||||
formula=$1
|
||||
extension=${formula//[0-9]/}
|
||||
add_brew_tap shivammathur/homebrew-php
|
||||
add_brew_tap shivammathur/homebrew-extensions
|
||||
sudo mv "$tap_dir"/shivammathur/homebrew-extensions/.github/deps/"$extension"/* "$tap_dir/homebrew/homebrew-core/Formula/" 2>/dev/null || true
|
||||
brew install "$extension@$version"
|
||||
sudo cp "$brew_prefix/opt/$extension@$version/$extension.so" "$ext_dir"
|
||||
sudo mv "$tap_dir"/shivammathur/homebrew-extensions/.github/deps/"$formula"/* "$tap_dir/homebrew/homebrew-core/Formula/" 2>/dev/null || true
|
||||
brew install "$formula@$version"
|
||||
sudo cp "$brew_prefix/opt/$formula@$version/$extension.so" "$ext_dir"
|
||||
}
|
||||
|
||||
# Function to setup extensions
|
||||
@ -211,13 +212,15 @@ add_composertool() {
|
||||
if [ -e "$composer_bin/composer" ]; then
|
||||
sudo cp -p "$tool_path_dir/composer" "$composer_bin"
|
||||
fi
|
||||
if [ "$tool" = "codeception" ]; then
|
||||
sudo ln -s $composer_bin/codecept $composer_bin/codeception
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to configure PECL
|
||||
configure_pecl() {
|
||||
for tool in pear pecl; do
|
||||
sudo "$tool" config-set php_ini "$ini_file" >/dev/null 2>&1
|
||||
sudo "$tool" config-set auto_discover 1 >/dev/null 2>&1
|
||||
sudo "$tool" channel-update "$tool".php.net >/dev/null 2>&1
|
||||
done
|
||||
}
|
||||
|
@ -41,8 +41,8 @@ configure_pecl() {
|
||||
add_pecl >/dev/null 2>&1
|
||||
fi
|
||||
for script in pear pecl; do
|
||||
sudo "$script" config-set php_ini "${pecl_file:-${ini_file[@]}}"
|
||||
sudo "$script" channel-update "$script".php.net
|
||||
sudo "$script" config-set php_ini "${pecl_file:-$ini_file}" >/dev/null 2>&1
|
||||
sudo "$script" channel-update "$script".php.net >/dev/null 2>&1
|
||||
done
|
||||
echo '' | sudo tee /tmp/pecl_config >/dev/null 2>&1
|
||||
fi
|
||||
@ -118,6 +118,7 @@ add_pecl_extension() {
|
||||
extension=$1
|
||||
pecl_version=$2
|
||||
prefix=$3
|
||||
configure_pecl
|
||||
if [[ $pecl_version =~ .*(alpha|beta|rc|snapshot|preview).* ]]; then
|
||||
pecl_version=$(get_pecl_version "$extension" "$pecl_version")
|
||||
fi
|
||||
@ -216,6 +217,9 @@ add_composertool() {
|
||||
if [ -e "$composer_bin/composer" ]; then
|
||||
sudo cp -p "$tool_path_dir/composer" "$composer_bin"
|
||||
fi
|
||||
if [ "$tool" = "codeception" ]; then
|
||||
sudo ln -s $composer_bin/codecept $composer_bin/codeception
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to setup phpize and php-config
|
||||
|
@ -203,15 +203,15 @@ Function Add-Tool() {
|
||||
$bat_content += "php %BIN_TARGET% %*"
|
||||
Set-Content -Path $php_dir\$tool.bat -Value $bat_content
|
||||
Add-ToProfile $current_profile $tool "New-Alias $tool $php_dir\$tool.bat" >$null 2>&1
|
||||
if($tool -eq "phan") {
|
||||
if($tool -eq "composer") {
|
||||
Edit-ComposerConfig $php_dir\$tool
|
||||
} elseif($tool -eq "cs2pr") {
|
||||
(Get-Content $php_dir/cs2pr).replace('exit(9)', 'exit(0)') | Set-Content $php_dir/cs2pr
|
||||
} elseif($tool -eq "phan") {
|
||||
Add-Extension fileinfo >$null 2>&1
|
||||
Add-Extension ast >$null 2>&1
|
||||
} elseif($tool -eq "phive") {
|
||||
Add-Extension xml >$null 2>&1
|
||||
} elseif($tool -eq "cs2pr") {
|
||||
(Get-Content $php_dir/cs2pr).replace('exit(9)', 'exit(0)') | Set-Content $php_dir/cs2pr
|
||||
} elseif($tool -eq "composer") {
|
||||
Edit-ComposerConfig $php_dir\$tool
|
||||
} elseif($tool -eq "wp-cli") {
|
||||
Copy-Item $php_dir\wp-cli.bat -Destination $php_dir\wp.bat
|
||||
}
|
||||
@ -243,6 +243,9 @@ Function Add-Composertool() {
|
||||
Remove-Item -Path $composer_lock -Force
|
||||
}
|
||||
composer -q global require $prefix$release 2>&1 | out-null
|
||||
if($tool -eq "codeception") {
|
||||
Copy-Item $composer_bin\codecept.bat -Destination $composer_bin\codeception.bat
|
||||
}
|
||||
if($?) {
|
||||
Add-Log $tick $tool "Added"
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user