|
66 | 66 | $installerUrl = 'https://getcomposer.org/installer';
|
67 | 67 | $installer = ''
|
68 | 68 | $tempPhar = ''
|
69 |
| - $actualPharUrl = '' |
70 | 69 | $pathCreatedHere = $false
|
71 | 70 | try {
|
72 | 71 | if ($NoCache) {
|
|
75 | 74 | Write-Verbose "Downloading from $installerUrl"
|
76 | 75 | Invoke-WebRequest -UseBasicParsing -Uri $installerUrl -OutFile $installer
|
77 | 76 | } else {
|
78 |
| - $installer = Get-FileFromUrlOrCache -Url $installerUrl -CachedFileName 'composer-installer.php' |
| 77 | + $installer, $foo = Get-FileFromUrlOrCache -Url $installerUrl -CachedFileName 'composer-installer.php' |
79 | 78 | }
|
80 | 79 | $tempPhar = [System.IO.Path]::GetTempFileName();
|
81 | 80 | $arguments = @()
|
|
86 | 85 | if ($Version -match '\.') {
|
87 | 86 | $arguments += '--version=' + $Version
|
88 | 87 | } else {
|
89 |
| - $actualPharUrl = "https://getcomposer.org/composer-$Version.phar" |
90 |
| - switch ($Version) { |
91 |
| - '1' { |
92 |
| - $testVersion = '1.10.16' |
93 |
| - } |
94 |
| - '2' { |
95 |
| - $testVersion = '2.0.1' |
96 |
| - } |
97 |
| - default { |
98 |
| - $testVersion = "$Version.0.1" |
99 |
| - } |
100 |
| - } |
101 |
| - $arguments += "--version=$testVersion" |
102 |
| - $arguments += '--check' |
| 88 | + $arguments += '--' + $Version |
103 | 89 | }
|
104 | 90 | }
|
105 | 91 | $arguments += '2>&1'
|
106 |
| - Write-Verbose "Launching Composer installer" |
| 92 | + Write-Verbose ('Launching Composer installer with: ' + ($arguments -join ' ')) |
107 | 93 | $installerResult = & $phpVersion.ExecutablePath $arguments
|
108 | 94 | if ($LASTEXITCODE -ne 0) {
|
109 | 95 | throw $installerResult
|
110 | 96 | }
|
111 | 97 | Write-Verbose "Composer installed succeeded"
|
112 |
| - if ($actualPharUrl -ne '') { |
113 |
| - Write-Verbose "Downloading Composer" |
114 |
| - Set-NetSecurityProtocolType |
115 |
| - Write-Verbose "Downloading from $actualPharUrl" |
116 |
| - Invoke-WebRequest -UseBasicParsing -Uri $actualPharUrl -OutFile $tempPhar |
117 |
| - } |
118 | 98 | Write-Verbose "Installing to $Path"
|
119 | 99 | If (-Not(Test-Path -LiteralPath $Path)) {
|
120 | 100 | New-Item -ItemType Directory -Path $Path | Out-Null
|
|
0 commit comments