33# Licensed under the MIT License. See License in the project root for license information.
44# ---------------------------------------------------------------------------------------------
55
6+ Write-Host " "
7+ Write-Host " This script installs Dev Proxy on your machine. It runs the following steps:"
8+ Write-Host " "
9+ Write-Host " 1. Create the 'devproxy' directory in the current working folder"
10+ Write-Host " 2. Download the latest Dev Proxy release"
11+ Write-Host " 3. Unzip the release in the devproxy directory"
12+ Write-Host " 4. Configure devproxy and its files as executable (Linux and macOS only)"
13+ Write-Host " 5. Add the devproxy directory to your PATH environment variable in `$ PROFILE.CurrentUserAllHosts"
14+ Write-Host " "
15+ Write-Host " Continue (y/n)? " - NoNewline
16+ $response = [System.Console ]::ReadKey().KeyChar
17+
18+ if ($response -notin @ (' y' , ' Y' )) {
19+ Write-Host " `n Exiting"
20+ exit 1
21+ }
22+
23+ Write-Host " `n "
24+
625New-Item - ItemType Directory - Force - Path .\devproxy - ErrorAction Stop | Out-Null
726Set-Location .\devproxy | Out-Null
827
@@ -56,16 +75,23 @@ Add-Type -AssemblyName System.IO.Compression.FileSystem
5675Expand-Archive - Path devproxy.zip - DestinationPath . - Force - ErrorAction Stop
5776Remove-Item devproxy.zip
5877
59- if (! (Test-Path $PROFILE )) {
60- New-Item - ItemType File - Force - Path $PROFILE
78+ if ($os -match " Linux" -or $os -match " Darwin" ) {
79+ Write-Host " Configuring devproxy and its files as executable..."
80+ chmod + x ./ devproxy ./ libe_sqlite3.dylib
81+ }
82+
83+ if (! (Test-Path $PROFILE.CurrentUserAllHosts )) {
84+ Write-Host " Creating `$ PROFILE.CurrentUserAllHosts..."
85+ New-Item - ItemType File - Force - Path $PROFILE.CurrentUserAllHosts | Out-Null
6186}
6287
63- if (! (Select-String - Path $PROFILE - Pattern " devproxy" )) {
64- Add-Content - Path $PROFILE - Value " $ ( [Environment ]::NewLine) `$ env:PATH += `" $ ( [IO.Path ]::PathSeparator) $full_path `" "
88+ if (! (Select-String - Path $PROFILE.CurrentUserAllHosts - Pattern " devproxy" )) {
89+ Write-Host " Adding devproxy to `$ PROFILE.CurrentUserAllHosts..."
90+ Add-Content - Path $PROFILE.CurrentUserAllHosts - Value " $ ( [Environment ]::NewLine) `$ env:PATH += `" $ ( [IO.Path ]::PathSeparator) $full_path `" "
6591}
6692
6793Write-Host " Dev Proxy $version installed!"
6894Write-Host
6995Write-Host " To get started, run:"
70- Write-Host " . $PROFILE "
96+ Write-Host " . ` $ PROFILE.CurrentUserAllHosts "
7197Write-Host " devproxy --help"
0 commit comments