forked from lawrencegripper/PowerGist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
chocolateyInstall.ps1
56 lines (44 loc) · 1.52 KB
/
chocolateyInstall.ps1
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
48
49
50
51
52
53
54
55
56
$packageName = 'powergist'
$path = Split-Path -Parent $MyInvocation.MyCommand.Definition
$pathLib = "$path\..\lib\"
$iseInstances = get-process | ?{$_.ProcessName -like "powershell_ise"}
if ($iseInstances.Length -gt 0)
{
Write-Host "ISE Running, recomend stopping before install"
}
$addinDll = "$pathLib\GripDev.PowerGist.Addin.dll"
$depDll = "$pathLib\GistsApi.dll"
$iseProfile = "$pshome\Microsoft.PowerShellISE_profile.ps1"
Copy-Item $addinDll $pshome -Force
Copy-Item $depDll $pshome -Force
$line1 = "Add-Type -Path '$pshome\GripDev.PowerGist.Addin.dll'"
$line2 = "Add-Type -Path '$pshome\GistsApi.dll'"
$line3 = "`$psISE.CurrentPowerShellTab.VerticalAddOnTools.Add('PowerGist', [GripDev.PowerGist.Addin.PowerGistPanel], `$true)"
$iseProfileExists = Test-Path $iseProfile
if ($iseProfileExists)
{
$containsText = Select-String -Path $iseProfile -Pattern "PowerGist" `
| Select-Object -First 1 -ExpandProperty Matches `
| Select-Object -ExpandProperty Success
}
else
{
New-Item $iseProfile -type file
$containsTest = $false
}
if ($containsText)
{
Write-Host "*****************************************************"
Write-Host "ISE Profile configuration already setup, manually check the following is present in: " + $iseProfile
Write-Host $line1
Write-Host $line2
Write-Host $line3
Write-Host "*****************************************************"
}
else
{
Add-Content $iseProfile $line1 -Force
Add-Content $iseProfile $line2 -Force
Add-Content $iseProfile $line3 -Force
}
Write-ChocolateySuccess $packageName