Skip to content

Commit 1d3af48

Browse files
Updates setup script. Closes #464, #479 (#480)
1 parent 6655096 commit 1d3af48

File tree

2 files changed

+54
-6
lines changed

2 files changed

+54
-6
lines changed

scripts/setup.ps1

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,25 @@
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 "`nExiting"
20+
exit 1
21+
}
22+
23+
Write-Host "`n"
24+
625
New-Item -ItemType Directory -Force -Path .\devproxy -ErrorAction Stop | Out-Null
726
Set-Location .\devproxy | Out-Null
827

@@ -56,16 +75,23 @@ Add-Type -AssemblyName System.IO.Compression.FileSystem
5675
Expand-Archive -Path devproxy.zip -DestinationPath . -Force -ErrorAction Stop
5776
Remove-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

6793
Write-Host "Dev Proxy $version installed!"
6894
Write-Host
6995
Write-Host "To get started, run:"
70-
Write-Host " . $PROFILE"
96+
Write-Host " . `$PROFILE.CurrentUserAllHosts"
7197
Write-Host " devproxy --help"

scripts/setup.sh

100644100755
Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,25 @@
44
# Licensed under the MIT License. See License in the project root for license information.
55
#---------------------------------------------------------------------------------------------
66

7+
echo ""
8+
echo "This script installs Dev Proxy on your machine. It runs the following steps:"
9+
echo ""
10+
echo "1. Create the 'devproxy' directory in the current working folder"
11+
echo "2. Download the latest Dev Proxy release"
12+
echo "3. Unzip the release in the devproxy directory"
13+
echo "4. Configure devproxy and its files as executable"
14+
echo "5. Add the devproxy directory to your PATH environment variable in your shell profile"
15+
echo ""
16+
echo -n "Continue (y/n)? "
17+
18+
read -n1 -r response
19+
if [[ "$response" != [yY] ]]; then
20+
echo -e "\nExiting"
21+
exit 1
22+
fi
23+
24+
echo -e "\n"
25+
726
mkdir devproxy
827
cd devproxy
928
full_path=$(pwd)
@@ -42,7 +61,10 @@ fi
4261

4362
unzip -o ./devproxy.zip -d ./
4463
rm ./devproxy.zip
45-
chmod +x ./devproxy
64+
echo "Configuring devproxy and its files as executable..."
65+
chmod +x ./devproxy ./libe_sqlite3.dylib
66+
67+
echo "Adding devproxy to the PATH environment variable in your shell profile..."
4668

4769
if [[ ":$PATH:" != *":$full_path:"* ]]; then
4870
if [[ -e ~/.zshrc ]]; then

0 commit comments

Comments
 (0)