forked from regisf/virtualenvwrapper-powershell
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInstall.ps1
More file actions
47 lines (39 loc) · 1.15 KB
/
Install.ps1
File metadata and controls
47 lines (39 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#
# VirtualEnvWrapper for Power shell
#
# Installation script
#
$MyDocuments = [Environment]::GetFolderPath("MyDocuments")
$PowerShellPath = Join-Path $MyDocuments WindowsPowerShell
$InstallationPath = Join-Path $PowerShellPath Modules
function Ask-User($Message)
{
Do
{
$Key = (Read-Host "$Message [Y/n]").ToLower()
} While ($Key -ne "y" -And $Key -ne "n")
return $Key
}
Write-Host
$key = Ask-User "Do you want to install VirtualEnvWrapper for PowerShell"
if ($key -eq "n")
{
Exit
}
# Test powershell directories in ~\Documents. If don't exists create it
if (!(Test-Path $InstallationPath))
{
Write-Host "Creaate directory : $InstallationPath"
New-Item -ItemType Directory -Force -Path $InstallationPath
}
Copy-Item VirtualEnvWrapper.psm1 $InstallationPath\VirtualEnvWrapper.psm1
if (!(Test-Path (Join-Path $PowerShellPath Profile.ps1)))
{
$key = Ask-User "The powershell profile is missing. Do you want to create it?"
if ($key -eq "y")
{
Copy-Item Profile.ps1 $PowerShellPath\Profile.ps1
}
}
Write-Host "Installation done. Close this PowerShell and re-open it to activate VirtualEnvWrapper"
Write-Host