Last active
August 29, 2015 14:16
-
-
Save Arcath/e438ae1bec54f5ff9c08 to your computer and use it in GitHub Desktop.
My Powershell Profile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set the Location to my Powershell FOlders | |
set-location c:\Code\Powershell | |
# Fix/Set the console size | |
$Shell = $Host.UI.RawUI | |
$size = $Shell.WindowSize | |
$size.width=150 | |
$size.height=50 | |
$Shell.WindowSize = $size | |
# Load git from Github for Windows | |
. (Resolve-Path "$env:LOCALAPPDATA\GitHub\shell.ps1") | |
# Set the atom root Folder | |
$atomRoot = "$env:LOCALAPPDATA\atom" | |
# List all folders in the atomRoot and set the highest version to 0.0.0 | |
$atomVersions = Get-ChildItem -Path $atomRoot | ?{ $_.PSIsContainer } | Select-Object FullName | |
$atomVersionParts = 0, 0, 0 | |
# Loop through each folder, if it is higher than the highest version update it. | |
forEach($versionFolder in $atomVersions){ | |
$folderName = ($versionFolder.FullName -split '\\')[-1] | |
if($folderName -match '^app'){ | |
$version = $folderName -replace '^app-', '' | |
$versionParts = $version -split '\.' | |
if($versionParts[0] -ge $atomVersionParts[0]){ | |
$atomVersionParts[0] = $versionParts[0] | |
$atomVersionParts[1] = $versionParts[1] | |
$atomVersionParts[2] = $versionParts[2] | |
if($versionParts[1] -ge $atomVersionParts[1]){ | |
$atomVersionParts[1] = $versionParts[1] | |
$atomVersionParts[2] = $versionParts[2] | |
if($versionParts[2] -ge $atomVersionParts[2]){ | |
$atomVersionParts[2] = $versionParts[2] | |
} | |
} | |
} | |
} | |
} | |
# Set the path to the latest atom version | |
$atomVersion = $atomVersionParts -join '.' | |
$atomPath = $atomRoot + "\app-" + $atomVersion | |
# Set the aliases | |
New-Item alias:atom -value ($atomPath + '\resources\cli\atom.cmd') | |
New-Item alias:apm -Value ($atomPath + '\resources\app\apm\bin\apm.cmd') | |
# Load Ruby into PATH | |
$env:Path = $env:Path + ";C:\Ruby22\Bin" | |
. ("C:\RubyDevKit\devkitvars.ps1") | |
# Load the Windows Dev Kit into the PATH | |
$env:Path = $env:Path + ";C:\Program Files (x86)\Windows Kits\8.1\bin\x64" | |
# Load Python | |
$env:Path = $env:Path + ";C:\Python27" | |
Clear-Host | |
$nodeVersion = node -v | |
$rubyVersion = ruby -v | |
Write-Host ("Atom: " + $atomVersion) | |
Write-Host ("Node: " + $nodeVersion) | |
Write-Host ("Ruby: " + $rubyVersion) | |
# Start the SSH Agent | |
cmd /c start-ssh-agent.cmd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment