Skip to content

Commit

Permalink
chore(powershell): Fix PSScriptAnalyzer warnings (#5158)
Browse files Browse the repository at this point in the history
Fix some PSScriptAnalyzer warnings and remove unused variable.
  • Loading branch information
big-r81 authored Jul 31, 2024
1 parent 1e30333 commit 7a1b7ba
Showing 1 changed file with 20 additions and 21 deletions.
41 changes: 20 additions & 21 deletions configure.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ $InstallDir="$LibDir\couchdb"
$LogFile="$LogDir\couch.log"
$BuildFauxton = (-not $DisableFauxton).ToString().ToLower()
$BuildDocs = (-not $DisableDocs).ToString().ToLower()
$Hostname = [System.Net.Dns]::GetHostEntry([string]"localhost").HostName
$WithProper = (-not $DisableProper).ToString().ToLower()
$ErlangMD5 = ($EnableErlangMD5).ToString().ToLower()
$WithSpiderMonkey = (-not $DisableSpiderMonkey).ToString().ToLower()
Expand Down Expand Up @@ -252,57 +251,57 @@ $ConfigERL = @"
"@
$ConfigERL | Out-File "$rootdir\config.erl" -encoding ascii

if (((Get-Command "rebar.cmd" -ErrorAction SilentlyContinue) -eq $null) -or
((Get-Command "rebar3.cmd" -ErrorAction SilentlyContinue) -eq $null) -or
((Get-Command "erlfmt.cmd" -ErrorAction SilentlyContinue) -eq $null)) {
if (($null -eq (Get-Command "rebar.cmd" -ErrorAction SilentlyContinue)) -or
($null -eq (Get-Command "rebar3.cmd" -ErrorAction SilentlyContinue)) -or
($null -eq (Get-Command "erlfmt.cmd" -ErrorAction SilentlyContinue))) {
$env:Path += ";$rootdir\bin"
}

# check for rebar; if not found, build it and add it to our path
if ((Get-Command "rebar.cmd" -ErrorAction SilentlyContinue) -eq $null)
if ($null -eq (Get-Command "rebar.cmd" -ErrorAction SilentlyContinue))
{
Write-Verbose "==> rebar.cmd not found; bootstrapping..."
if (-Not (Test-Path "src\rebar"))
{
git clone --depth 1 https://github.com/apache/couchdb-rebar.git $rootdir\src\rebar
}
cmd /c "cd src\rebar && $rootdir\src\rebar\bootstrap.bat"
cp $rootdir\src\rebar\rebar $rootdir\bin\rebar
cp $rootdir\src\rebar\rebar.cmd $rootdir\bin\rebar.cmd
Copy-Item $rootdir\src\rebar\rebar $rootdir\bin\rebar
Copy-Item $rootdir\src\rebar\rebar.cmd $rootdir\bin\rebar.cmd
make -C $rootdir\src\rebar clean
}

# check for rebar3; if not found, build it and add it to our path
if ((Get-Command "rebar3.cmd" -ErrorAction SilentlyContinue) -eq $null)
if ($null -eq (Get-Command "rebar3.cmd" -ErrorAction SilentlyContinue))
{
Write-Verbose "==> rebar3.cmd not found; bootstrapping..."
if (-Not (Test-Path "src\rebar3"))
{
git clone --depth 1 https://github.com/erlang/rebar3.git $rootdir\src\rebar3
}
cd src\rebar3
Set-Location src\rebar3
.\bootstrap.ps1
cp $rootdir\src\rebar3\rebar3 $rootdir\bin\rebar3
cp $rootdir\src\rebar3\rebar3.cmd $rootdir\bin\rebar3.cmd
cp $rootdir\src\rebar3\rebar3.ps1 $rootdir\bin\rebar3.ps1
Copy-Item $rootdir\src\rebar3\rebar3 $rootdir\bin\rebar3
Copy-Item $rootdir\src\rebar3\rebar3.cmd $rootdir\bin\rebar3.cmd
Copy-Item $rootdir\src\rebar3\rebar3.ps1 $rootdir\bin\rebar3.ps1
make -C $rootdir\src\rebar3 clean
cd ..\..
Set-Location ..\..
}

# check for erlfmt; if not found, build it and add it to our path
if ((Get-Command "erlfmt.cmd" -ErrorAction SilentlyContinue) -eq $null)
if ($null -eq (Get-Command "erlfmt.cmd" -ErrorAction SilentlyContinue))
{
Write-Verbose "==> erlfmt.cmd not found; bootstrapping..."
if (-Not (Test-Path "src\erlfmt"))
{
git clone --depth 1 https://github.com/WhatsApp/erlfmt.git $rootdir\src\erlfmt
}
cd src\erlfmt
Set-Location src\erlfmt
rebar3 as release escriptize
cp $rootdir\src\erlfmt\_build\release\bin\erlfmt $rootdir\bin\erlfmt
cp $rootdir\src\erlfmt\_build\release\bin\erlfmt.cmd $rootdir\bin\erlfmt.cmd
Copy-Item $rootdir\src\erlfmt\_build\release\bin\erlfmt $rootdir\bin\erlfmt
Copy-Item $rootdir\src\erlfmt\_build\release\bin\erlfmt.cmd $rootdir\bin\erlfmt.cmd
make -C $rootdir\src\erlfmt clean
cd ..\..
Set-Location ..\..
}

$ClouseauDir = "$rootdir\clouseau"
Expand Down Expand Up @@ -337,9 +336,9 @@ if ($WithClouseau)
Write-Output "ERROR: Clouseau distribution package (clouseau.zip) could not be extracted."
exit 1
}
mv "$ClouseauDir\*\*.jar" "$ClouseauDir"
rm "$ClouseauDir\clouseau-$ClouseauVersion"
rm clouseau.zip
Move-Item "$ClouseauDir\*\*.jar" "$ClouseauDir"
Remove-Item "$ClouseauDir\clouseau-$ClouseauVersion"
Remove-Item clouseau.zip

Invoke-WebRequest -MaximumRedirection 1 -OutFile "$ClouseauDir\$Slf4jSimpleJar" $Slf4jSimpleUrl
If ($LASTEXITCODE -ne 0) {
Expand Down

0 comments on commit 7a1b7ba

Please sign in to comment.