mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +07:00
Fix composer tools setup
This commit is contained in:
parent
739ccacdc4
commit
121cb19a65
@ -9,6 +9,7 @@ export xdebug3_versions="7.[2-4]|8.[0-9]"
|
|||||||
export tool_path_dir="/usr/local/bin"
|
export tool_path_dir="/usr/local/bin"
|
||||||
export composer_bin="$HOME/.composer/vendor/bin"
|
export composer_bin="$HOME/.composer/vendor/bin"
|
||||||
export composer_json="$HOME/.composer/composer.json"
|
export composer_json="$HOME/.composer/composer.json"
|
||||||
|
export composer_lock="$HOME/.composer/composer.lock"
|
||||||
export latest="releases/latest/download"
|
export latest="releases/latest/download"
|
||||||
export github="https://github.com/shivammathur"
|
export github="https://github.com/shivammathur"
|
||||||
export bintray="https://dl.bintray/shivammathur"
|
export bintray="https://dl.bintray/shivammathur"
|
||||||
@ -191,6 +192,10 @@ configure_composer() {
|
|||||||
add_log "$cross" "composer" "Could not download composer"
|
add_log "$cross" "composer" "Could not download composer"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
if ! [ -e "$composer_json" ]; then
|
||||||
|
echo '{}' | tee "$composer_json" >/dev/null 2>&1
|
||||||
|
sudo chmod 644 "$composer_json"
|
||||||
|
fi
|
||||||
composer -q config -g process-timeout 0
|
composer -q config -g process-timeout 0
|
||||||
echo "$composer_bin" >> "$GITHUB_PATH"
|
echo "$composer_bin" >> "$GITHUB_PATH"
|
||||||
if [ -n "$COMPOSER_TOKEN" ]; then
|
if [ -n "$COMPOSER_TOKEN" ]; then
|
||||||
@ -240,7 +245,8 @@ add_composertool() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
(
|
(
|
||||||
composer global require "$prefix$release" >/dev/null 2>&1 &&
|
sudo rm -f "$composer_lock" >/dev/null 2>&1 || true
|
||||||
|
composer global require "$prefix$release" >/dev/null 2>&1
|
||||||
json=$(grep "$prefix$tool" "$composer_json") &&
|
json=$(grep "$prefix$tool" "$composer_json") &&
|
||||||
tool_version=$(get_tool_version 'echo' "$json") &&
|
tool_version=$(get_tool_version 'echo' "$json") &&
|
||||||
add_log "$tick" "$tool" "Added $tool $tool_version"
|
add_log "$tick" "$tool" "Added $tool $tool_version"
|
||||||
|
@ -201,6 +201,9 @@ Function Edit-ComposerConfig() {
|
|||||||
Add-Log "$cross" "composer" "Could not download composer"
|
Add-Log "$cross" "composer" "Could not download composer"
|
||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
|
if (-not(Test-Path $composer_json)) {
|
||||||
|
Set-Content -Path $composer_json -Value "{}"
|
||||||
|
}
|
||||||
composer -q config -g process-timeout 0
|
composer -q config -g process-timeout 0
|
||||||
Write-Output $composer_bin | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8
|
Write-Output $composer_bin | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8
|
||||||
if (Test-Path env:COMPOSER_TOKEN) {
|
if (Test-Path env:COMPOSER_TOKEN) {
|
||||||
@ -302,7 +305,10 @@ Function Add-Composertool() {
|
|||||||
Add-Log $cross $tool "Skipped"
|
Add-Log $cross $tool "Skipped"
|
||||||
Return
|
Return
|
||||||
}
|
}
|
||||||
composer global require $prefix$release 2>&1 | out-null
|
if(Test-Path $composer_lock) {
|
||||||
|
Remove-Item -Path $composer_lock -Force
|
||||||
|
}
|
||||||
|
composer global require $prefix$release >$null 2>&1
|
||||||
$json = findstr $prefix$tool $env:APPDATA\Composer\composer.json
|
$json = findstr $prefix$tool $env:APPDATA\Composer\composer.json
|
||||||
if(Test-Path $composer_bin\composer) {
|
if(Test-Path $composer_bin\composer) {
|
||||||
Copy-Item -Path "$bin_dir\composer" -Destination "$composer_bin\composer" -Force
|
Copy-Item -Path "$bin_dir\composer" -Destination "$composer_bin\composer" -Force
|
||||||
@ -330,6 +336,8 @@ $bin_dir = $php_dir
|
|||||||
$bintray = 'https://dl.bintray.com/shivammathur/php'
|
$bintray = 'https://dl.bintray.com/shivammathur/php'
|
||||||
$github = 'https://github.com'
|
$github = 'https://github.com'
|
||||||
$composer_bin = "$env:APPDATA\Composer\vendor\bin"
|
$composer_bin = "$env:APPDATA\Composer\vendor\bin"
|
||||||
|
$composer_json = "$env:APPDATA\Composer\composer.json"
|
||||||
|
$composer_lock = "$env:APPDATA\Composer\composer.lock"
|
||||||
$current_profile = "$env:TEMP\setup-php.ps1"
|
$current_profile = "$env:TEMP\setup-php.ps1"
|
||||||
$ProgressPreference = 'SilentlyContinue'
|
$ProgressPreference = 'SilentlyContinue'
|
||||||
$nightly_version = '8.[0-9]'
|
$nightly_version = '8.[0-9]'
|
||||||
|
Loading…
Reference in New Issue
Block a user