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