]> apps.delaporte.us Git - dotfiles.git/blob - bootstrap.ps1
68ea146224156da608f593846ec031629b4b60b8
[dotfiles.git] / bootstrap.ps1
1 <#
2 .SYNOPSIS
3
4 Setup my Windows PowerShell environment.
5
6 .DESCRIPTION
7
8 .NOTES
9
10 Relies heavily on the Chocolatey package manager.
11
12 #>
13
14 param(
15 [Parameter(Mandatory=$true, HelpMessage="Install Development Tools")]
16 [switch]$dev_tools,
17 [Parameter(Mandatory=$true, HelpMessage="Install Modeling Tools")]
18 [switch]$archi,
19 [Parameter(Mandatory=$true, HelpMessage="Install Vim")]
20 [switch]$vim,
21 )
22
23 # Setup my PowerShell Profile (on Windows)
24 if(-Not(Test-Path -Path $profile)) {
25 New-Item -Path "$profile" -ItemType File
26 }
27
28 $sourceMeFile = "$pwd\Microsoft.PowerShell_profile.ps1"
29 $sourceMeLine = '$profileContents = [string]::join([environment]::newline, (get-content -path'
30 $sourceMeLine += $sourceMeFile
31 $sourceMeLine += '));invoke-expression $profileContents'
32
33 $doneFlagFile = "./DONE.md"
34 $doBootStrap = -Not (Test-Path -Path $doneFlagFile)
35
36 $profileContents = Get-Content $profile
37 if(! $profileContents -contains $sourceMeLine) {
38 Add-Content -Path $profile -Value $sourceMeLine
39 }
40
41 ## Install Chocolatey
42 $testchoco = powershell choco -v
43 if(-not($testchoco)){
44 Write-Output "Seems Chocolatey is not installed, installing now..."
45 Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
46 }
47
48 # Install Python3 and Pip
49
50 # Install Stub PowerShell Profile that sources the one from DotFiles
51
52 # Install profile for Windows Terminal
53 $destFile = "C:\Users\delaport\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\profiles.json"
54 if(-Not(Test-Path -Path $destFile)) {
55 Copy-Item -Path ./profiles.json -Destination $destFile
56 } else {
57 # Brute force ensure we update our git copy once in awhile.
58 Copy-Item -Path $destFile -Destination ./profiles.json
59 }
60
61 # OWASP ZAP for web application security scanning
62 if($false) {
63 choco install zap
64 }
65
66 ## TODO: Can I set this via command line: chrome://flags/#enable-force-dark
67
68 if($doBootStrap) {
69 # DONE!
70 New-Item -ItemType File -Path $doneFlagFile
71 }
72
73 # ArchiMate for enterprise modeling
74 if($archi) {
75 choco install archi
76 }
77
78 # Install dev tools
79 if($dev_tools){
80 ./install/dev.ps1
81 }
82
83 if($vim){
84 ./install/vim.ps1
85 }