PS CodePlex

For some reason I decided to write some PowerShell functions to manage checking out projects from CodePlex, and updating them in batch.  It makes use of the CodePlex Client (cpc), which allows anonymous access to CodePlex's TFS repository.

They're fairly primitive, but seem to do the job.  You'll need to have cpc in your path, and you'll notice I've defined a drive 'CodePlex' at the repository root.  There's also a $CodePlexDirectory variable I'm setting in my profile which contains the path to where CodePlex: is rooted.

What I should do is install them on one of my servers at home and set update-codeplex on a timer to just automatically retrieve the latest changes.  Maybe even do a build.

function view-codeplex
{
    param([string] $project = $(throw "Provide a project name")) 

    $destination = 'http://www.codeplex.com/' + $project

    start $destination
}

function get-codeplex
{
    param([string] $project = $(throw "Provide a project name")) 

    $destination = (Join-Path $CodePlexDirectory $project)

    cpc checkout $project $destination

    push-location $destination

    cpc info

    pop-location
}

function update-codeplex
{
    param([string] $project) 

    $list = , $project

    if ($project -eq "")
    {
        $list = (get-childitem 'CodePlex:\\' | foreach-object { $_.Name })
    }

    foreach ($item in $list)
    {
        push-location (Join-Path 'CodePlex:' $item)

        cpc info
        cpc update

       pop-location
    }
}