-
Notifications
You must be signed in to change notification settings - Fork 7
/
install.ps1
51 lines (46 loc) · 1.27 KB
/
install.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
param($installPath, $toolsPath, $package, $project)
$ErrorActionPreference = "Stop"
if ($project -ne $null)
{
Foreach ($item in $project.ProjectItems)
{
if ($item.Name -eq "ToBeRemoved.txt")
{
$item.Delete()
}
}
}
$gitDir = $null
$workingDirectory = Get-Item $project.FullName
Write-Host "Looking for .git directory, starting in $workingDirectory.FullName"
while ($true)
{
$possibleGitDir = Join-Path $workingDirectory.FullName ".git"
if (Test-Path $possibleGitDir)
{
$gitDir = $possibleGitDir
Break
}
$parent = $workingDirectory.Parent
if ($parent -eq $null)
{
Break
}
$workingDirectory = $parent;
}
if ($gitDir -ne $null)
{
Write-Host "Found git directory for project at $gitDir"
$repositoryDir = (get-item $gitDir -Force).Parent.FullName
$gitHubFlowToolsDir = Join-Path $repositoryDir "tools\GitHubFlowVersion"
if ((Test-Path $gitHubFlowToolsDir -PathType Container) -eq $false)
{
Write-Host "Creating directory $gitHubFlowToolsDir"
}
Write-Host "GitHubFlowVersion tools installed to $gitHubFlowToolsDir"
Copy-Item $toolsPath –destination $gitHubFlowToolsDir -recurse -container -force
}
else
{
Write-Host "Cannot find git directory"
}