Fix scoped tool setup on Windows

This commit is contained in:
Shivam Mathur 2022-07-20 19:20:56 +05:30
parent e8ba27f3d2
commit e57ea715eb
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A

View File

@ -215,11 +215,12 @@ Function Add-ComposertoolHelper() {
$scoped_dir_suffix = (Get-FileHash -InputStream $release_stream -Algorithm sha256).Hash $scoped_dir_suffix = (Get-FileHash -InputStream $release_stream -Algorithm sha256).Hash
$scoped_dir = "$composer_bin\_tools\$tool-$scoped_dir_suffix" $scoped_dir = "$composer_bin\_tools\$tool-$scoped_dir_suffix"
$unix_scoped_dir = $scoped_dir.replace('\', '/') $unix_scoped_dir = $scoped_dir.replace('\', '/')
if((composer show $prefix$tool -d $unix_scoped_dir -a 2>&1 | findstr '^type *: *composer-plugin') -and ($composer_args -ne '')) {
composer config -d $unix_scoped_dir --no-plugins allow-plugins."$prefix$release" true >$null 2>&1
}
if(-not(Test-Path $scoped_dir)) { if(-not(Test-Path $scoped_dir)) {
New-Item -ItemType Directory -Force -Path $scoped_dir > $null 2>&1 New-Item -ItemType Directory -Force -Path $scoped_dir > $null 2>&1
Set-Content -Path $scoped_dir\composer.json -Value "{}"
if((composer show $prefix$tool $tool_version -d $unix_scoped_dir -a 2>&1 | findstr '^type *: *composer-plugin') -and ($composer_args -ne '')) {
composer config -d $unix_scoped_dir --no-plugins allow-plugins."$prefix$tool" true >$null 2>&1
}
composer require $prefix$release -d $unix_scoped_dir $composer_args >$null 2>&1 composer require $prefix$release -d $unix_scoped_dir $composer_args >$null 2>&1
} }
[System.Environment]::SetEnvironmentVariable(($tool.replace('-', '_') + '_bin'), "$scoped_dir\vendor\bin") [System.Environment]::SetEnvironmentVariable(($tool.replace('-', '_') + '_bin'), "$scoped_dir\vendor\bin")