Archive for May, 2012

22 May 2012

Setting Up A GitHub Specific PowerShell Profile

1 Comment Uncategorized

I was very excited to see that after several months of work Phil and Paul finally released their much talked about GitHub client for Windows. It has a great Metro style, and is very fluid and functional.  Here is an example of what my client looks like

As you can see it is very clean, and there are no typical windows borders or title bar which is common for Metro styled apps. As I was exploring the app, I stumbled on the fact that if you are using PowerShell as your default shell.

You can actually customize the PowerShell profile used by the app to be different and separate from your default Windows PowerShell profile. This can be useful if you want to install a separate set of modules or configure it in a different way than your default Windows PowerShell profile. To do this you create the PowerShell profile in the following path.

%USERPROFILE%\Documents\WindowsPowerShell\GitHub.PowerShell_profile.ps1

Here is how I configured my GitHub specific PowerShell profile.

###############################################################################
# global variables
###############################################################################
$profileDir = [System.IO.Path]::GetDirectoryName($profile)

###############################################################################
# Set up a simple prompt, adding the git prompt parts inside git repos
###############################################################################
function prompt {
    $realLASTEXITCODE = $LASTEXITCODE
    
    Write-Host

    # Reset color, which can be messed up by Enable-GitColors
    $Host.UI.RawUI.ForegroundColor = $GitPromptSettings.DefaultForegroundColor

    Write-VcsStatus

    Write-Host($pwd) -ForegroundColor Green

    $global:LASTEXITCODE = $realLASTEXITCODE
    
    return "$ "
}

###############################################################################
# Exposes the environment vars in a batch and sets them in this PS session
###############################################################################
function Get-Batchfile($file) 
{
    $theCmd = "`"$file`" & set" 
    cmd /c $theCmd | Foreach-Object {
        $thePath, $theValue = $_.split('=')
        Set-Item -path env:$thePath -value $theValue
    }
}


###############################################################################
# Sets the VS variables for this PS session to use
###############################################################################
function VsVars32($version = "10.0")
{
    $theKey = "HKLM:SOFTWARE\Microsoft\VisualStudio\" + $version
    $theVsKey = get-ItemProperty $theKey
    $theVsInstallPath = [System.IO.Path]::GetDirectoryName($theVsKey.InstallDir)
    $theVsToolsDir = [System.IO.Path]::GetDirectoryName($theVsInstallPath)
    $theVsToolsDir = [System.IO.Path]::Combine($theVsToolsDir, "Tools")
    $theBatchFile = [System.IO.Path]::Combine($theVsToolsDir, "vsvars32.bat")
    Get-Batchfile $theBatchFile
    [System.Console]::Title = "Visual Studio " + $version + " Windows Powershell"
}

###############################################################################
# aliases
###############################################################################

set-alias wide   format-wide

###############################################################################
# functions
###############################################################################

set-content function:\mklink "cmd /c mklink `$args"

###############################################################################
# setup posh-git
###############################################################################

Push-Location (Split-Path -Path $MyInvocation.MyCommand.Definition -Parent)

# add Git to PATH
$env:path += ";" + (Get-Item "Env:ProgramFiles(x86)").Value + "\Git\bin"

# import posh-git
Import-Module posh-git

# customize git prompt display settings
$global:GitPromptSettings.BeforeText = '['
$global:GitPromptSettings.AfterText = '] '
$global:GitPromptSettings.BranchAheadForegroundColor = [ConsoleColor]::DarkGreen
$global:GitPromptSettings.WorkingForegroundColor = [ConsoleColor]::Magenta
$global:GitPromptSettings.UntrackedForegroundColor = [ConsoleColor]::Magenta

# set TERM to cygwin
Enable-GitColors

Pop-Location

Start-SshAgent -Quiet

Let me know your configuration and any tips you have about the new GitHub app. A big thanks should be given to Phil and Paul for making our lives better.

21 May 2012

Using Git Bash in Console2

1 Comment Uncategorized

After reading Scott Hansleman’s post about Console2 I decided to give it a try full time. Overall I have to say I am very impressed and have no intention on switching back. It really is an impressive application, so if you are interested in trying something different, go to Scott’s post and follow his directions on setting it up.

As a long time mysysgit user for all my Git source control needs, I decided to find out if I could marry the two together to create a nice intersection between Console2 and msysgit’s Bash client.  And after a bit of searching and stumbling on my own post about setting up the bash client in Visual Studio, I answered my own question on how to set it up for Console2.  Here is what I cam up with:

  • Title: Git Bash
  • Icon: C:\Program Files (x86)\Git\etc\git.ico
  • Shell: C:\Windows\SysWOW64\cmd.exe /c “”C:\Program Files (x86)\Git\bin\sh.exe” –login -i”

 

17 May 2012

Philly.NET: Scott Hanselman: The Future of ASP.NET

No Comments Uncategorized

How Do I Sign Up

You can signup here: http://phillydotnet20120531.eventbrite.com/

The Event

May 31 Scott Hanselman: The Future of ASP.NET
Thursday Blue Bell, PA This special meeting will be held at the Montgomery County Community College Science Center Auditorium in Blue Bell, PA on Thursday, May 31 from 6:30-9:00.We have some great meetings lined up for the next few months. Please take a look at the upcoming schedule on the web site and follow other local user groups on our community calendar.
6:30 Scott Hanselman, Microsoft The Future of ASP.NET 8
Scott Hanselman, MicrosoftApprenda Software Spend a night with Scott and learn about the future of ASP.NET.Scott Hanselman works for Microsoft as Principal Community Architect for Web Platform and Tools, aiming to spread the good word about developing software, most often on the Microsoft stack. Before this he was the Chief Architect at Corillian Corporation, now a part of Checkfree, for 6+ years and before that he was a Principal Consultant at STEP Technology for nearly 7 years. He was also involved in a few things Microsoft-related like the MVP and RD programs and will speak about computers (and other passions) whenever someone will listen to him. He’s written in a few books, most recently with Bill Evjen and Devin Rader on Professional ASP.NET. He blogs athttp://www.hanselman.com for the last 10 years and podcasts weekly at http://www.hanselminutes.com and http://www.thisdeveloperslife.com.We are pleased to have Apprenda Software as our sponsor for this event:Apprenda is an Open Platform-as-a-Service (PaaS) stack for .NET that enables any organization to transform their existing infrastructure into a self-service cloud application platform. By decoupling applications from infrastructure and Developers from IT, Apprenda empowers organizations to achieve significant cost savings and massive productivity improvements that result in better business/IT alignment.

Come enjoy the company of the best geeks in the Delaware Valley!

9:00 Books, software, and other goodies!