mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-26 05:23:03 +07:00
Fix adding composer_bin to PATH
This commit is contained in:
parent
a72a638da4
commit
7854a0cae7
@ -23,6 +23,7 @@ Function Edit-ComposerConfig() {
|
|||||||
Set-Content -Path $composer_json -Value "{}"
|
Set-Content -Path $composer_json -Value "{}"
|
||||||
}
|
}
|
||||||
Add-EnvPATH $src\configs\composer.env
|
Add-EnvPATH $src\configs\composer.env
|
||||||
|
Add-Path $composer_bin
|
||||||
if (Test-Path env:COMPOSER_TOKEN) {
|
if (Test-Path env:COMPOSER_TOKEN) {
|
||||||
Add-Env COMPOSER_AUTH ('{"github-oauth": {"github.com": "' + $env:COMPOSER_TOKEN + '"}}')
|
Add-Env COMPOSER_AUTH ('{"github-oauth": {"github.com": "' + $env:COMPOSER_TOKEN + '"}}')
|
||||||
}
|
}
|
||||||
@ -175,7 +176,6 @@ Function Add-ComposertoolHelper() {
|
|||||||
Remove-Item -Path $composer_lock -Force
|
Remove-Item -Path $composer_lock -Force
|
||||||
}
|
}
|
||||||
composer global require $prefix$release $composer_args >$null 2>&1
|
composer global require $prefix$release $composer_args >$null 2>&1
|
||||||
Add-Path $composer_bin
|
|
||||||
return composer global show $prefix$tool 2>&1 | findstr '^versions'
|
return composer global show $prefix$tool 2>&1 | findstr '^versions'
|
||||||
} else {
|
} else {
|
||||||
$release_stream = [System.IO.MemoryStream]::New([System.Text.Encoding]::ASCII.GetBytes($release))
|
$release_stream = [System.IO.MemoryStream]::New([System.Text.Encoding]::ASCII.GetBytes($release))
|
||||||
|
@ -43,6 +43,7 @@ configure_composer() {
|
|||||||
chmod 644 "$composer_json"
|
chmod 644 "$composer_json"
|
||||||
fi
|
fi
|
||||||
add_env_path "${src:?}"/configs/composer.env
|
add_env_path "${src:?}"/configs/composer.env
|
||||||
|
add_path "$composer_bin"
|
||||||
if [ -n "$COMPOSER_TOKEN" ]; then
|
if [ -n "$COMPOSER_TOKEN" ]; then
|
||||||
add_env COMPOSER_AUTH '{"github-oauth": {"github.com": "'"$COMPOSER_TOKEN"'"}}'
|
add_env COMPOSER_AUTH '{"github-oauth": {"github.com": "'"$COMPOSER_TOKEN"'"}}'
|
||||||
fi
|
fi
|
||||||
@ -137,7 +138,6 @@ add_composertool_helper() {
|
|||||||
sudo rm -f "$composer_lock" >/dev/null 2>&1 || true
|
sudo rm -f "$composer_lock" >/dev/null 2>&1 || true
|
||||||
composer global require "$prefix$release" "$composer_args" >/dev/null 2>&1
|
composer global require "$prefix$release" "$composer_args" >/dev/null 2>&1
|
||||||
composer global show "$prefix$tool" 2>&1 | grep -E ^versions | sudo tee /tmp/composer.log >/dev/null 2>&1
|
composer global show "$prefix$tool" 2>&1 | grep -E ^versions | sudo tee /tmp/composer.log >/dev/null 2>&1
|
||||||
add_path "$composer_bin"
|
|
||||||
else
|
else
|
||||||
scoped_dir="$composer_bin/_tools/$tool-$(echo -n "$release" | shasum -a 256 | cut -d ' ' -f 1)"
|
scoped_dir="$composer_bin/_tools/$tool-$(echo -n "$release" | shasum -a 256 | cut -d ' ' -f 1)"
|
||||||
if ! [ -d "$scoped_dir" ]; then
|
if ! [ -d "$scoped_dir" ]; then
|
||||||
|
@ -99,7 +99,7 @@ get_shell_profile() {
|
|||||||
# Function to add a path to the PATH variable.
|
# Function to add a path to the PATH variable.
|
||||||
add_path() {
|
add_path() {
|
||||||
path_to_add=$1
|
path_to_add=$1
|
||||||
{ [ ! -d "$path_to_add" ] || [[ ":$PATH:" == *":$path_to_add:"* ]]; } && return
|
[[ ":$PATH:" == *":$path_to_add:"* ]] && return
|
||||||
if [[ -n "$GITHUB_PATH" ]]; then
|
if [[ -n "$GITHUB_PATH" ]]; then
|
||||||
echo "$path_to_add" | tee -a "$GITHUB_PATH" >/dev/null 2>&1
|
echo "$path_to_add" | tee -a "$GITHUB_PATH" >/dev/null 2>&1
|
||||||
else
|
else
|
||||||
|
@ -83,7 +83,7 @@ Function Add-Path {
|
|||||||
param(
|
param(
|
||||||
[string]$PathItem
|
[string]$PathItem
|
||||||
)
|
)
|
||||||
if(-not(Test-Path $PathItem) -or "$env:PATH;".contains("$PathItem;")) {
|
if("$env:PATH;".contains("$PathItem;")) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if ($env:GITHUB_PATH) {
|
if ($env:GITHUB_PATH) {
|
||||||
|
Loading…
Reference in New Issue
Block a user