Skip to content

Instantly share code, notes, and snippets.

@bcachet
Last active August 29, 2017 15:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bcachet/b580cab86c14763903439a98c36c0b62 to your computer and use it in GitHub Desktop.
Save bcachet/b580cab86c14763903439a98c36c0b62 to your computer and use it in GitHub Desktop.
PowerShell Profile
$modules = @('posh-git', 'Jump.Location', 'PathUtils')
$notInstalledModules = New-Object System.Collections.ArrayList
$modules | ForEach-Object {
If(-Not (Test-Path -Path (Join-Path $PSScriptRoot ".\Modules\$_")))
{
$notInstalledModules.Add($_)
}
}
If ($notInstalledModules.Length -gt 0)
{
Write-Output "Installing missing Modules"
If ((Get-PSRepository -Name PSGallery).InstallationPolicy -eq 'Untrusted')
{
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
}
$notInstalledModules | ForEach-Object {Install-Module -Scope CurrentUser -Name $_}
}
$modules | ForEach-Object {Import-Module -Name $_}
# Chocolatey profile
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile)) {
Import-Module "$ChocolateyProfile"
}
function Ssh-Agent-Helper()
{
Set-Alias ssh-agent "$env:ProgramFiles\git\usr\bin\ssh-agent.exe"
Set-Alias ssh-add "$env:ProgramFiles\git\usr\bin\ssh-add.exe"
Start-SshAgent -Quiet
}
function ..() {
Set-Location ..
}
Add-ToEnvVar PATH 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin'
function Launch() {
param([switch]$Release=$false)
$path = if ($Release) { ".\Deploy\Release\VirtualGrindPro.exe" } else { ".\Deploy\Debug\VirtualGrindPro.exe" }
if (-not (Test-Path $path)) {
Build -Release=$Release
}
Start-Process $path
}
function Clean() {
param([switch]$Deep=$false)
if ($Deep -And (Test-Path .paket\paket.exe)) {
.paket\paket.exe clear-cache
}
svn cleanup --remove-unversioned --remove-ignored
}
function Build() {
param([string]$Project="VGPro", [switch]$Release=$false, [switch]$Clean=$false)
if ($Clean) {
MSBuild.exe "$Project.sln" /target:clean /m
if (Test-Path ".\deploy") {
Remove-Item .\deploy -Recurse -Force
}
}
$configuration = if ($Release) { "Release" } else { "Debug" }
MSBuild.exe "$Project.sln" /target:build /m /p:Configuration=$configuration
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment