3
3
# Licensed under the MIT License. See License in the project root for license information.
4
4
# ---------------------------------------------------------------------------------------------
5
5
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
+
6
25
New-Item - ItemType Directory - Force - Path .\devproxy - ErrorAction Stop | Out-Null
7
26
Set-Location .\devproxy | Out-Null
8
27
@@ -56,16 +75,23 @@ Add-Type -AssemblyName System.IO.Compression.FileSystem
56
75
Expand-Archive - Path devproxy.zip - DestinationPath . - Force - ErrorAction Stop
57
76
Remove-Item devproxy.zip
58
77
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
61
86
}
62
87
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 `" "
65
91
}
66
92
67
93
Write-Host " Dev Proxy $version installed!"
68
94
Write-Host
69
95
Write-Host " To get started, run:"
70
- Write-Host " . $PROFILE "
96
+ Write-Host " . ` $ PROFILE.CurrentUserAllHosts "
71
97
Write-Host " devproxy --help"
0 commit comments