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