-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.ps1
77 lines (68 loc) · 2.32 KB
/
build.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# Simple function for applying template-based config files
function Set-ContentFromTemplate {
Param($Path, $TemplatePath, $Parameters)
$content = Get-Content "$TemplatePath"
foreach ($paramName in $Parameters.Keys) {
$content = $content.replace("{{ ${paramName} }}", $Parameters.Item($paramName))
}
Set-Content -Path $Path -Value $content
}
$buildParameters = $args[0]
function Install-Packages {
cinst git -y
cinst gitextensions -y
cinst openssh -y
cinst visualstudiocode --params '/NoDesktopIcon' -y
cinst nodejs -y
cinst nuget.commandline -y
cinst awscli -y
cinst terraform -y
cinst vault -y
cinst python -y
cinst jq -y
cinst sql-server-management-studio -y
cinst visualstudio2019professional -y --package-parameters '--allWorkloads --includeRecommended --passive'
cinst jdk8 -y
cinst sbt
}
function Configure-Powershell {
mkdir ~/Documents/WindowsPowerShell/autoload -Force
Copy-Item Microsoft.PowerShell_profile.ps1 ~/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1
}
function Configure-Git {
PowerShellGet\Install-Module posh-git -Scope CurrentUser -Confirm
Update-Module posh-git
Set-ContentFromTemplate -Path ~/.gitconfig -TemplatePath gitconfig -Parameters $buildParameters
}
function Configure-VSCode {
code --install-extension vscodevim.vim
code --install-extension ms-dotnettools.csharp
code --install-extension formulahendry.dotnet-test-explorer
code --install-extension ms-mssql.mssql
code --install-extension ms-vscode.PowerShell
code --install-extension hashicorp.terraform
code --install-extension rebornix.ruby
code --install-extension mshdinsight.azure-hdinsight
code --install-extension scalameta.metals
code --install-extension lextudio.restructuredtext
Copy-Item keybindings.json ~\AppData\Roaming\Code\User\keybindings.json
Copy-Item settings.json ~\AppData\Roaming\Code\User\settings.json
}
function Configure-VisualStudio {
Copy-Item my.vssettings ~/my.vssettings
Copy-Item vimrc ~/.vimrc
}
@(
"Install-Packages",
"Configure-Powershell",
"Configure-Git",
"Configure-VSCode",
"Configure-VisualStudio"
) | ForEach-Object {
echo ""
echo "***** $_ *****"
echo ""
# Invoke function and exit on error
&$_
if ($LastExitCode -ne 0) { Exit $LastExitCode }
}