Unpacking Software Livestream

Join our monthly Unpacking Software livestream to hear about the latest news, chat and opinion on packaging, software deployment and lifecycle management!

Learn More

Chocolatey Product Spotlight

Join the Chocolatey Team on our regular monthly stream where we put a spotlight on the most recent Chocolatey product releases. You'll have a chance to have your questions answered in a live Ask Me Anything format.

Learn More

Chocolatey Coding Livestream

Join us for the Chocolatey Coding Livestream, where members of our team dive into the heart of open source development by coding live on various Chocolatey projects. Tune in to witness real-time coding, ask questions, and gain insights into the world of package management. Don't miss this opportunity to engage with our team and contribute to the future of Chocolatey!

Learn More

Calling All Chocolatiers! Whipping Up Windows Automation with Chocolatey Central Management

Webinar from
Wednesday, 17 January 2024

We are delighted to announce the release of Chocolatey Central Management v0.12.0, featuring seamless Deployment Plan creation, time-saving duplications, insightful Group Details, an upgraded Dashboard, bug fixes, user interface polishing, and refined documentation. As an added bonus we'll have members of our Solutions Engineering team on-hand to dive into some interesting ways you can leverage the new features available!

Watch On-Demand
Chocolatey Community Coffee Break

Join the Chocolatey Team as we discuss all things Community, what we do, how you can get involved and answer your Chocolatey questions.

Watch The Replays
Chocolatey and Intune Overview

Webinar Replay from
Wednesday, 30 March 2022

At Chocolatey Software we strive for simple, and teaching others. Let us teach you just how simple it could be to keep your 3rd party applications updated across your devices, all with Intune!

Watch On-Demand
Chocolatey For Business. In Azure. In One Click.

Livestream from
Thursday, 9 June 2022

Join James and Josh to show you how you can get the Chocolatey For Business recommended infrastructure and workflow, created, in Azure, in around 20 minutes.

Watch On-Demand
The Future of Chocolatey CLI

Livestream from
Thursday, 04 August 2022

Join Paul and Gary to hear more about the plans for the Chocolatey CLI in the not so distant future. We'll talk about some cool new features, long term asks from Customers and Community and how you can get involved!

Watch On-Demand
Hacktoberfest Tuesdays 2022

Livestreams from
October 2022

For Hacktoberfest, Chocolatey ran a livestream every Tuesday! Re-watch Cory, James, Gary, and Rain as they share knowledge on how to contribute to open-source projects such as Chocolatey CLI.

Watch On-Demand

Downloads:

11,900

Downloads of v 0.0.37:

424

Last Update:

23 Mar 2015

Package Maintainer(s):

Software Author(s):

  • Chris Dostert

Tags:

powershell poshdevops taskrunner ci continuousintegration build deployment admin

PoshDevOps

This is not the latest version of PoshDevOps available.

  • 1
  • 2
  • 3

0.0.37 | Updated: 23 Mar 2015

Downloads:

11,900

Downloads of v 0.0.37:

424

Maintainer(s):

Software Author(s):

  • Chris Dostert

PoshDevOps 0.0.37

This is not the latest version of PoshDevOps available.

  • 1
  • 2
  • 3

Some Checks Have Failed or Are Not Yet Complete

Not All Tests Have Passed


Validation Testing Unknown


Verification Testing Unknown


Scan Testing Successful:

No detections found in any package files

Details
Learn More

Deployment Method: Individual Install, Upgrade, & Uninstall

To install PoshDevOps, run the following command from the command line or from PowerShell:

>

To upgrade PoshDevOps, run the following command from the command line or from PowerShell:

>

To uninstall PoshDevOps, run the following command from the command line or from PowerShell:

>

Deployment Method:

NOTE

This applies to both open source and commercial editions of Chocolatey.

1. Enter Your Internal Repository Url

(this should look similar to https://community.chocolatey.org/api/v2/)


2. Setup Your Environment

1. Ensure you are set for organizational deployment

Please see the organizational deployment guide

2. Get the package into your environment

  • Open Source or Commercial:
    • Proxy Repository - Create a proxy nuget repository on Nexus, Artifactory Pro, or a proxy Chocolatey repository on ProGet. Point your upstream to https://community.chocolatey.org/api/v2/. Packages cache on first access automatically. Make sure your choco clients are using your proxy repository as a source and NOT the default community repository. See source command for more information.
    • You can also just download the package and push it to a repository Download

3. Copy Your Script

choco upgrade poshdevops -y --source="'INTERNAL REPO URL'" --version="'0.0.37'" [other options]

See options you can pass to upgrade.

See best practices for scripting.

Add this to a PowerShell script or use a Batch script with tools and in places where you are calling directly to Chocolatey. If you are integrating, keep in mind enhanced exit codes.

If you do use a PowerShell script, use the following to ensure bad exit codes are shown as failures:


choco upgrade poshdevops -y --source="'INTERNAL REPO URL'" --version="'0.0.37'" 
$exitCode = $LASTEXITCODE

Write-Verbose "Exit code was $exitCode"
$validExitCodes = @(0, 1605, 1614, 1641, 3010)
if ($validExitCodes -contains $exitCode) {
  Exit 0
}

Exit $exitCode

- name: Install poshdevops
  win_chocolatey:
    name: poshdevops
    version: '0.0.37'
    source: INTERNAL REPO URL
    state: present

See docs at https://docs.ansible.com/ansible/latest/modules/win_chocolatey_module.html.


chocolatey_package 'poshdevops' do
  action    :install
  source   'INTERNAL REPO URL'
  version  '0.0.37'
end

See docs at https://docs.chef.io/resource_chocolatey_package.html.


cChocoPackageInstaller poshdevops
{
    Name     = "poshdevops"
    Version  = "0.0.37"
    Source   = "INTERNAL REPO URL"
}

Requires cChoco DSC Resource. See docs at https://github.com/chocolatey/cChoco.


package { 'poshdevops':
  ensure   => '0.0.37',
  provider => 'chocolatey',
  source   => 'INTERNAL REPO URL',
}

Requires Puppet Chocolatey Provider module. See docs at https://forge.puppet.com/puppetlabs/chocolatey.


4. If applicable - Chocolatey configuration/installation

See infrastructure management matrix for Chocolatey configuration elements and examples.

Package Approved

This package was approved as a trusted package on 24 Apr 2015.

Description

PowerShell driven distributed DevOps

Installation notes:
- installs to: C:\ProgramFiles\PoshDevOps
- appends C:\ProgramFiles\PoshDevOps\Modules to PSModulePath environment variable


tools\chocolateyInstall.ps1
try {    
    
    . "$PSScriptRoot\PoshDevOps\Install.ps1"

} catch {

    Write-ChocolateyFailure 'PoshDevOps' $_.Exception.Message

    throw 
}
tools\chocolateyUninstall.ps1
try {

    . "$PSScriptRoot\PoshDevOps\Uninstall.ps1"

} catch {

    Write-ChocolateyFailure 'PoshDevOps' $_.Exception.Message

    throw 
}
tools\PoshDevOps\HashtableExtensions\HashtableExtensions.psm1

function Get-UnionOfHashtables(
[Hashtable]
[ValidateNotNull()]
[Parameter(
    ValueFromPipelineByPropertyName=$true)]
$Source1,

[Hashtable]
[ValidateNotNull()]
[Parameter(
    ValueFromPipelineByPropertyName=$true)]
$Source2){
    $destination = $Source1.Clone()
    Write-Debug "After adding `$Source1, destination is $($destination|Out-String)"

    $Source2.GetEnumerator() | ?{!$destination.ContainsKey($_.Key)} |%{$destination[$_.Key] = $_.Value}
    Write-Debug "After adding `$Source2, destination is $($destination|Out-String)"

    Write-Output $destination
}

Export-ModuleMember -Function Get-UnionOfHashtables
tools\PoshDevOps\Install.ps1
# installer based on guidelines provided by Microsoft 
# for installing shared/3rd party powershell modules
# (see: https://msdn.microsoft.com/en-us/library/dd878350%28v=vs.85%29.aspx )
if($PSVersionTable.PSVersion.Major -lt 3) {
    Write-Warning "PoshDevOps requires PowerShell 3.0 or better; you have version $($Host.Version)."
    return
}

# prepare install dir
$installRootDirPath = "$env:ProgramFiles\PoshDevOps"
$installDirPath = "$installRootDirPath\Modules"

# handle upgrade scenario
if(Test-Path "$installRootDirPath"){
    Write-Debug 'removing previous PoshDevOps installation'
    . "$PSScriptRoot\Uninstall.ps1"
}
New-Item $installDirPath -ItemType Directory | Out-Null

Copy-Item -Path "$PSScriptRoot" -Destination $installDirPath -Recurse

$psModulePath = [Environment]::GetEnvironmentVariable('PSModulePath','Machine')

# if installation dir path is not already in path then add it.
if(!($psModulePath.Split(';').Contains($installDirPath))){
    Write-Debug "adding $installDirPath to '$env:PSModulePath'"
    
    # trim trailing semicolon if exists
    $psModulePath = $psModulePath.TrimEnd(';');

    # append path to PoshDevOps installation
    $psModulePath = $psModulePath + ";$installDirPath"
    
    # save
    [Environment]::SetEnvironmentVariable('PSModulePath',$psModulePath,'Machine')    
    
    # make effective in current session
    $env:PSModulePath = $env:PSModulePath + ";$installDirPath"
}
tools\PoshDevOps\OrderedDictionaryExtensions\OrderedDictionaryExtensions.psm1

function Get-IndexOfKeyInOrderedDictionary(
[string]
[ValidateNotNullOrEmpty()]
$Key,

[System.Collections.Specialized.OrderedDictionary]
[ValidateNotNullOrEmpty()]
$OrderedDictionary){
    <#
        .SYNOPSIS
        an internal utility function to find the index of a key in an ordered dictionary
    #>

    $indexOfKey = -1
    $keysArray = [string[]]$OrderedDictionary.Keys
    for ($i = 0; $i -lt $OrderedDictionary.Count; $i++){
        if($keysArray[$i] -eq $Key){
            $indexOfKey = $i
            break
        }
    }

Write-Output $indexOfKey
}

Export-ModuleMember -Function Get-IndexOfKeyInOrderedDictionary
tools\PoshDevOps\PoshDevOps.psm1
Import-Module "$PSScriptRoot\PoshDevOpsPackageManager" -Force -Global
Import-Module "$PSScriptRoot\TaskGroupStorage" -Force -Global
Import-Module "$PSScriptRoot\HashtableExtensions" -Force -Global
Import-Module "$PSScriptRoot\OrderedDictionaryExtensions" -Force -Global

function Add-PoshDevOpsTask(
[CmdletBinding(
    DefaultParameterSetName="add-TaskLast")]

[string]
[ValidateNotNullOrEmpty()]
[Parameter(
    Mandatory=$true)]
$TaskGroupName,

[string]
[ValidateNotNullOrEmpty()]
[Parameter(
    Mandatory=$true)]
$Name,

[string]
[Parameter(
    Mandatory=$true)]
$PackageId,

[string]
$PackageVersion,

[switch]
[Parameter(
    Mandatory=$true,
    ParameterSetName='add-TaskFirst')]
$First,

[switch]
[Parameter(
    ParameterSetName='add-TaskLast')]
$Last,

[string]
[Parameter(
    Mandatory=$true,
    ParameterSetName='add-TaskAfter')]
$After,

[string]
[Parameter(
    Mandatory=$true,
    ParameterSetName='add-TaskBefore')]
$Before,

[switch]
$Force,

[string[]]
[ValidateNotNullOrEmpty()]
$PackageSource= $DefaultPackageSources,

[string]
[ValidateScript({Test-Path $_ -PathType Container})]
[Parameter(
    ValueFromPipeline=$true,
    ValueFromPipelineByPropertyName=$true)]
$ProjectRootDirPath = '.'){

    <#
        .SYNOPSIS
        Adds a new task to a task group
        
        .EXAMPLE
        Add-PoshDevOpsTask -TaskGroup "Azure" -Name "LastTask" -PackageId "DeployNupkgToAzureWebsites" -PackageVersion "0.0.3"
        
        Description:

        This command adds task "LastTask" after all existing tasks in task group "Azure"

        .EXAMPLE
        Add-PoshDevOpsTask -TaskGroup "Azure" -Name "FirstTask" -PackageId "DeployNupkgToAzureWebsites" -First

        Description:

        This command adds task "FirstTask" before all existing tasks in task group "Azure"

        .EXAMPLE
        Add-PoshDevOpsTask -TaskGroup "Azure" -Name "AfterSecondTask" -PackageId "DeployNupkgToAzureWebsites" -After "SecondTask"

        Description:

        This command adds task "AfterSecondTask" after the existing task "SecondTask" in task group "Azure"

        .EXAMPLE
        Add-PoshDevOpsTask -TaskGroup "Azure" -Name "BeforeSecondTask" -PackageId "DeployNupkgToAzureWebsites" -Before "SecondTask"

        Description:

        This command adds task "BeforeSecondTask" before the existing task "SecondTask" in task group "Azure"

    #>

        
        if([string]::IsNullOrWhiteSpace($PackageVersion)){
            $PackageVersion = Get-LatestPackageVersion -Source $PackageSource -Id $PackageId
Write-Debug "using greatest available package version : $PackageVersion"
        }
                
        if($First.IsPresent){
        
            $TaskIndex = 0
        
        }
        elseif('add-TaskAfter' -eq $PSCmdlet.ParameterSetName){
            
            $TaskGroup = TaskGroupStorage\Get-TaskGroup -Name $TaskGroupName -ProjectRootDirPath $ProjectRootDirPath
            $indexOfAfter = Get-IndexOfKeyInOrderedDictionary -Key $After -OrderedDictionary $TaskGroup.Tasks
            # ensure task with key $After exists
            if($indexOfAfter -lt 0){
                throw "A task with name $After could not be found."
            }
            $TaskIndex = $indexOfAfter + 1
        
        }
        elseif('add-TaskBefore' -eq $PSCmdlet.ParameterSetName){        
        
            $TaskGroup = TaskGroupStorage\Get-TaskGroup -Name $TaskGroupName -ProjectRootDirPath $ProjectRootDirPath
            $indexOfBefore = Get-IndexOfKeyInOrderedDictionary -Key $Before -OrderedDictionary $TaskGroup.Tasks
            # ensure task with key $Before exists
            if($indexOfBefore -lt 0){
                throw "A task with name $Before could not be found."
            }
            $TaskIndex = $indexOfBefore
        
        }
        else{
        
            $TaskGroup = TaskGroupStorage\Get-TaskGroup -Name $TaskGroupName -ProjectRootDirPath $ProjectRootDirPath
            $TaskIndex = $TaskGroup.Tasks.Count  
        }

        TaskGroupStorage\Add-Task `
            -TaskGroupName $TaskGroupName `
            -Name $Name `
            -PackageId $PackageId `
            -PackageVersion $PackageVersion `
            -Index $TaskIndex `
            -Force:$Force `
            -ProjectRootDirPath $ProjectRootDirPath
}

function Set-PoshDevOpsTaskParameter(

[string]
[ValidateNotNullOrEmpty()]
[Parameter(
    Mandatory=$true)]
$TaskGroupName,

[string]
[ValidateNotNullOrEmpty()]
[Parameter(
    Mandatory=$true)]
$TaskName,

[string]
[ValidateNotNullOrEmpty()]
[Parameter(
    Mandatory=$true)]
$Name,

[object]
[Parameter(
    Mandatory=$true)]
$Value,

[switch]
$Force,

[string]
[ValidateScript({Test-Path $_ -PathType Container})]
[Parameter(
    ValueFromPipelineByPropertyName=$true)]
$ProjectRootDirPath = '.'){
    <#
        .SYNOPSIS
        Sets configurable parameters of a task
        
        .EXAMPLE
        Set-PoshDevOpsTaskParameters -TaskGroupName Build -TaskName GitClone -Name GitParameters -Value Status -Force
        
        Description:

        This command sets the parameter "GitParameters" to "Status" for a task "GitClone" in task group "Build"
    #>

    TaskGroupStorage\Set-TaskParameter `
        -TaskGroupName $TaskGroupName `
        -TaskName $TaskName `
        -Name $Name `
        -Value $Value `
        -Force:$Force
}

function Remove-PoshDevOpsTask(

[string]
[ValidateNotNullOrEmpty()]
[Parameter(
    Mandatory=$true)]
$TaskGroupName,

[string]
[ValidateNotNullOrEmpty()]
[Parameter(
    Mandatory=$true)]
$Name,

[switch]$Force,

[string]
[ValidateScript({Test-Path $_ -PathType Container})]
[Parameter(
    ValueFromPipelineByPropertyName=$true)]
$ProjectRootDirPath = '.'){

    $confirmationPromptQuery = "Are you sure you want to delete the task with name $Name`?"
    $confirmationPromptCaption = 'Confirm task removal'

    if($Force.IsPresent -or $PSCmdlet.ShouldContinue($confirmationPromptQuery,$confirmationPromptCaption)){

        TaskGroupStorage\Remove-Task -TaskGroupName $TaskGroupName -Name $Name -ProjectRootDirPath $ProjectRootDirPath

    }

}

function New-PoshDevOpsTaskGroup(

[string]
[ValidateNotNullOrEmpty()]
[Parameter(
    Mandatory=$true,
    ValueFromPipelineByPropertyName=$true)]
$Name,

[switch]
$Force,

[string]
[ValidateScript({Test-Path $_ -PathType Container})]
[Parameter(
    ValueFromPipelineByPropertyName=$true)]
$ProjectRootDirPath = '.'){
    
    $TaskGroup = @{Name=$Name;Tasks=[ordered]@{}}

    TaskGroupStorage\Add-TaskGroup -Value $TaskGroup -Force:$Force -ProjectRootDirPath $ProjectRootDirPath
}

function Update-PoshDevOpsPackage(

[CmdletBinding(
    DefaultParameterSetName="Update-All")]

[string]
[ValidateNotNullOrEmpty()]
[Parameter(
    Mandatory=$true)]
$TaskGroupName,

[string[]]
[ValidateCount( 1, [Int]::MaxValue)]
[Parameter(
    Mandatory=$true,
    ValueFromPipelineByPropertyName=$true,
    ParameterSetName="Update-Single")]
[Parameter(
    Mandatory=$true,
    ValueFromPipelineByPropertyName=$true,
    ParameterSetName="Update-Multiple")]
$Id,

[string]
[Parameter(
    Mandatory=$true,
    ValueFromPipelineByPropertyName=$true,
    ParameterSetName="Update-Single")]
$Version,

[switch]
[Parameter(
    ParameterSetName="Update-All")]
$All,

[string[]]
[ValidateCount( 1, [Int]::MaxValue)]
[ValidateNotNullOrEmpty()]
[Parameter(
    ValueFromPipelineByPropertyName=$true)]
$Source = $DefaultPackageSources,

[String]
[ValidateScript({Test-Path $_ -PathType Container})]
[Parameter(
    ValueFromPipelineByPropertyName=$true)]
$ProjectRootDirPath='.'){

    $TaskGroup = TaskGroupStorage\Get-TaskGroup -Name $TaskGroupName -ProjectRootDirPath $ProjectRootDirPath

    # build up list of package updates
    $packageUpdates = @{}
    If('Update-Multiple' -eq $PSCmdlet.ParameterSetName){

        foreach($packageId in $Id){

            $packageUpdates.Add($packageId,(Get-LatestPackageVersion -Source $Source -Id $packageId))

        }
    }
    ElseIf('Update-Single' -eq $PSCmdlet.ParameterSetName){
        
        if($Id.Length -ne 1){
            throw "Updating to an explicit package version is only allowed when updating a single package"
        }

        $packageUpdates.Add($Id,$Version)
    }
    Else{        
        
        foreach($task in $taskGroup.Tasks.Values){

            $packageUpdates.Add($task.PackageId,(Get-LatestPackageVersion -Source $Source -Id $task.PackageId))
        
        }
    }

    foreach($task in $taskGroup.Tasks.Values){

        $updatedPackageVersion = $packageUpdates.($task.PackageId)

        if($null -ne $updatedPackageVersion){

            Uninstall-PoshDevOpsPackageIfExists -Id $task.PackageId -Version $task.PackageVersion -ProjectRootDirPath $ProjectRootDirPath

Write-Debug `
@"
Updating task "$($task.Name)" package "$($task.PackageId)"
from version "$($task.PackageVersion)"
to version "$($updatedPackageVersion)"
"@
            TaskGroupStorage\Update-TaskPackageVersion `
                -TaskGroupName $TaskGroupName `
                -TaskName $task.Name `
                -PackageVersion $updatedPackageVersion `
                -ProjectRootDirPath $ProjectRootDirPath
        }
    }
}

function Invoke-PoshDevOpsTaskGroup(

[string]
[ValidateNotNullOrEmpty()]
[Parameter(
    Mandatory=$true)]
$Name,

[Hashtable]
[Parameter(
    ValueFromPipeline=$true,
    ValueFromPipelineByPropertyName=$true)]
$Parameters,

[string[]]
[ValidateCount( 1, [Int]::MaxValue)]
[Parameter(
    ValueFromPipelineByPropertyName=$true)]
$PackageSource = $DefaultPackageSources,

[String]
[ValidateScript({Test-Path $_ -PathType Container})]
[Parameter(
    ValueFromPipelineByPropertyName=$true)]
$ProjectRootDirPath='.'){
    
    $TaskGroup = TaskGroupStorage\Get-TaskGroup -Name $Name -ProjectRootDirPath $ProjectRootDirPath

    if($TaskGroup){        

        foreach($task in $TaskGroup.Tasks.Values){
                    
            if($Parameters.($task.Name)){

                if($task.Parameters){

Write-Debug "Adding union of passed parameters and archived parameters to pipeline. Passed parameters will override archived parameters"
                
                    $taskParameters = Get-UnionOfHashtables -Source1 $Parameters.($task.Name) -Source2 $task.Parameters

                }
                else{

Write-Debug "Adding passed parameters to pipeline"

                    $taskParameters = $Parameters.($task.Name)
            
                }

            }
            elseif($task.Parameters){

Write-Debug "Adding archived parameters to pipeline"    
                $taskParameters = $task.Parameters

            }
            else{
                
                $taskParameters = @{}
            
            }

Write-Debug "Adding automatic parameters to pipeline"
            
            $taskParameters.PoshDevOpsProjectRootDirPath = (Resolve-Path $ProjectRootDirPath)
            $taskParameters.PoshDevOpsTaskName = $task.Name

Write-Debug "Ensuring task module package installed"
            Install-PoshDevOpsPackage -Id $task.PackageId -Version $task.PackageVersion -Source $PackageSource

            $moduleDirPath = "$ProjectRootDirPath\.PoshDevOps\Packages\$($task.PackageId).$($task.PackageVersion)\tools\$($task.PackageId)"
Write-Debug "Importing module located at: $moduleDirPath"
            Import-Module $moduleDirPath -Force

Write-Debug `
@"
Invoking task $($task.Name) with parameters: 
$($taskParameters|Out-String)
"@
            # Parameters must be PSCustomObject so [Parameter(ValueFromPipelineByPropertyName = $true)] works
            [PSCustomObject]$taskParameters.Clone() | Invoke-PoshDevOpsTask

        }
    }
    else{

throw "TaskGroup.psd1 not found at: $taskGroupFilePath"

    }
}

Export-ModuleMember -Function Invoke-PoshDevOpsTaskGroup
Export-ModuleMember -Function New-PoshDevOpsTaskGroup
Export-ModuleMember -Function Remove-PoshDevOpsTaskGroup
Export-ModuleMember -Function Update-PoshDevOpsPackage
Export-ModuleMember -Function Add-PoshDevOpsTask
Export-ModuleMember -Function Set-PoshDevOpsTaskParameter
Export-ModuleMember -Function Remove-PoshDevOpsTask
Export-ModuleMember -Function Get-PoshDevOpsTaskGroup
tools\PoshDevOps\PoshDevOpsPackageManager\nuget.exe
 
tools\PoshDevOps\PoshDevOpsPackageManager\PoshDevOpsPackageManager.psm1
Import-Module "$PSScriptRoot\SemanticVersioning" -Force -Global

$DefaultPackageSources = @('https://www.myget.org/F/poshdevops')
$nugetExecutable = "$PSScriptRoot\nuget.exe"

function Install-PoshDevOpsPackage(
[string]
[ValidateNotNullOrEmpty()]
[Parameter(
    Mandatory=$true,
    ValueFromPipelineByPropertyName=$true)]
$Id,

[string]
[Parameter(
    ValueFromPipelineByPropertyName=$true)]
$Version,

[string[]]
[ValidateCount( 1, [Int]::MaxValue)]
[ValidateNotNullOrEmpty()]
[Parameter(
    ValueFromPipelineByPropertyName=$true)]
$Source = $DefaultPackageSources,

[string]
[ValidateScript({Test-Path $_ -PathType Container})]
[Parameter(
    ValueFromPipelineByPropertyName=$true)]
$ProjectRootDirPath='.'){

    $taskGroupDirPath = Resolve-Path "$ProjectRootDirPath\.PoshDevOps"
    $packagesDirPath = "$taskGroupDirPath\Packages"

    if([string]::IsNullOrWhiteSpace($Version)){

        $Version = Get-LatestPackageVersion -Source $Source -Id $Id

Write-Debug "using greatest available package version : $Version"
    
    }

    $initialOFS = $OFS
    
    try{

        $OFS = ';'        
        $nugetParameters = @('install',$Id,'-Source',($Source|Out-String),'-OutputDirectory',$packagesDirPath,'-Version',$Version,'-NonInteractive')

Write-Debug `
@"
Invoking nuget:
& $nugetExecutable $($nugetParameters|Out-String)
"@
        & $nugetExecutable $nugetParameters

        # handle errors
        if ($LastExitCode -ne 0) {
            throw $Error
        }
    
    }
    Finally{
        $OFS = $initialOFS
    }

}

function Uninstall-PoshDevOpsPackageIfExists(
[string]
[ValidateNotNullOrEmpty()]
[Parameter(
    Mandatory=$true,
    ValueFromPipelineByPropertyName=$true)]
$Id,

[string]
[ValidateNotNullOrEmpty()]
[Parameter(
    Mandatory=$true,
    ValueFromPipelineByPropertyName=$true)]
$Version,

[string]
[ValidateScript({Test-Path $_ -PathType Container})]
[Parameter(
    ValueFromPipelineByPropertyName=$true)]
$ProjectRootDirPath='.'){

    $taskGroupDirPath = Resolve-Path "$ProjectRootDirPath\.PoshDevOps"
    $packagesDirPath = "$taskGroupDirPath\Packages"

    $packageInstallationDir = "$packagesDirPath\$($Id).$($Version)"


    If(Test-Path $packageInstallationDir){
Write-Debug `
@"
Removing package at:
$packageInstallationDir
"@
        Remove-Item $packageInstallationDir -Recurse -Force -UseTransaction  
    }
    Else{
Write-Debug `
@"
No package to remove at:
$packageInstallationDir
"@
    }

}

function Get-LatestPackageVersion(

[string[]]
[Parameter(
    Mandatory=$true)]
$Source = $defaultPackageSources,

[string]
[ValidateNotNullOrEmpty()]
[Parameter(
    Mandatory=$true)]
$Id){
    
    $versions = @()

    foreach($packageSource in $Source){
        $uri = "$packageSource/api/v2/package-versions/$Id"
Write-Debug "Attempting to fetch package versions:` uri: $uri "
        $versions = $versions + (Invoke-RestMethod -Uri $uri)
Write-Debug "response from $uri was: ` $versions"
    }
    if(!$versions -or ($versions.Count -lt 1)){
throw "no versions of $Id could be located.` searched: $Source"
    }

Write-Output ([Array](Get-SortedSemanticVersions -InputArray $versions -Descending))[0]
}

Export-ModuleMember -Variable DefaultPackageSources
Export-ModuleMember -Function Install-PoshDevOpsPackage
Export-ModuleMember -Function Uninstall-PoshDevOpsPackageIfExists
Export-ModuleMember -Function Get-LatestPackageVersion
tools\PoshDevOps\PoshDevOpsPackageManager\SemanticVersioning\SemanticVersioning.psm1
function ConvertTo-SemanticVersionObject(
    [string]
    $SemanticVersionString){

    <#
        .SYNOPSIS
        creates an object representing a v1.0 & v2.0 semantic version (see: http://semver.org/)
    #>

    $semanticVersionRegex = "(?<Major>\d+)\.(?<Minor>\d+)\.(?<Patch>\d+)(?:-(?<PreRelease>[0-9A-Za-z-.]*))?(?:\+(?<Build>[0-9A-Za-z-.]*))?"

    $semanticVersionString -match $semanticVersionRegex |Out-Null
    $Matches.Remove(0)
    $Matches.Major = [int]$Matches.Major
    $Matches.Minor = [int]$Matches.Minor
    $Matches.Patch = [int]$Matches.Patch

    If($Matches.PreRelease){
        $preReleaseIdentifiers = $Matches.PreRelease.Split('.')|%{if($_ -as [long]){[long]$_}else{[string]$_}}
        $Matches.PreRelease = @{Identifiers=[object[]]$preReleaseIdentifiers}
    }

    $Matches.Clone() | Write-Output
}

function Compare-SemanticVersions(
    
    <#
        .SYNOPSIS
        compares v1.0 & v2.0 semantic versions (see: http://semver.org/)
    #>

    [string]
    $XSemVerString,
    
    [string]
    $YSemVerString){

    $XSemVer = ConvertTo-SemanticVersionObject -SemanticVersionString $XSemVerString
    $YSemVer = ConvertTo-SemanticVersionObject -SemanticVersionString $YSemVerString

    If($XSemVer.Major -ne $YSemVer.Major){
        return $XSemVer.Major - $YSemVer.Major
    }
    ElseIf($XSemVer.Minor -ne $YSemVer.Minor){
        return $XSemVer.Minor - $YSemVer.Minor
    }
    ElseIf($XSemVer.Patch -ne $YSemVer.Patch){
        return $XSemVer.Patch - $YSemVer.Patch
    }

    # per spec: "When major, minor, and patch are equal, a pre-release version has lower precedence than a normal version"
    If(!$XSemVer.PreRelease -and $YSemVer.PreRelease){
        return 1
    }
    ElseIf(!$XSemVer.PreRelease -and !$YSemVer.PreRelease){
        return 0
    }
    ElseIf($XSemVer.PreRelease -and !$YSemVer.PreRelease){
        return -1
    }

    For($i = 0;$i -lt [Math]::Min($XSemVer.PreRelease.Identifiers.Count,$YSemVer.PreRelease.Identifiers.Count);$i++){
        $XIdentifier = $XSemVer.PreRelease.Identifiers[$i]
        $YIdentifier = $YSemVer.PreRelease.Identifiers[$i]
        
        #if x and y numeric
        If(($XIdentifier -is [long]) -and ($YIdentifier -is [long])){
            
            #per spec: "identifiers consisting of only digits are compared numerically"
            $xIdentifierMinusYIdentifier = $XIdentifier - $YIdentifier
            If($xIdentifierMinusYIdentifier -ne 0){
                return $xIdentifierMinusYIdentifier
            }
        }
        #if x or[exclusive] y is numeric
        ElseIf(($XIdentifier -is [long]) -xor ($YIdentifier -is [long])){
        
            #per spec: "Numeric identifiers always have lower precedence than non-numeric identifiers"
            If($XIdentifier -isnot [long]){
                return 1
            }
            Else{
                return -1
            }
        }
        #if x and y both textual
        Else{

            #per spec: "identifiers with letters or hyphens are compared lexically in ASCII sort order"
            If($XIdentifier -gt $YIdentifier){
                return 1
            }
            ElseIf($XIdentifier -lt $YIdentifier){
                return -1
            }
        }
    }

    #per spec: "A larger set of pre-release fields has a higher precedence than a smaller set, if all of the preceding identifiers are equal"
    return $XSemVer.PreRelease.Identifiers.Count - $YSemVer.PreRelease.Identifiers.Count
}

function Get-SortedSemanticVersions(
[string[]]
$InputArray,
[switch]
$Descending){

    <#
        .SYNOPSIS
        sorts v1.0 & v2.0 semantic versions (see: http://semver.org/)
    #>
 
    $counter = 0 
    $compareResultFactor = 1
    if($Descending.IsPresent){
    $compareResultFactor = -1
    }
 
    # $unsorted is the first index of the unsorted region 
    for ($unsorted = 1; $unsorted -lt $InputArray.Count; $unsorted++) 
    { 
        # Next item in the unsorted region 
        $nextItem = $InputArray[$unsorted] 
     
        # Index of insertion in the sorted region 
        $location = $unsorted 
     
        while (($location -gt 0) -and ` 
            (($compareResultFactor *(Compare-SemanticVersions -X $InputArray[$location - 1] -Y $nextItem)) -gt 0)) 
        { 
            $counter++ 
            # Shift to the right 
            $InputArray[$location] = $InputArray[$location - 1] 
            $location-- 
        } 
     
        # Insert $nextItem into the sorted region 
        $InputArray[$location] = $nextItem
    } 

    Write-Output $InputArray
}
tools\PoshDevOps\TaskGroupStorage\Pson\Pson.psm1
Set-Alias ConvertFrom-Pson Invoke-Expression -Description "Convert variable from PSON"


Function ConvertTo-Pson(
[Parameter(
    ValueFromPipeline=$true)]
$InputObject, 
[Int]
$Depth = 9, 
[Int]
$Layers = 1,
[Switch]
$Strict) {
<#
    .LINK http://stackoverflow.com/questions/15139552/save-hash-table-in-powershell-object-notation-pson
#>

    $Format = $Null
    $Quote = If ($Depth -le 0) {""} Else {""""}
    $Space = If ($Layers -le 0) {""} Else {" "}

    If ($InputObject -eq $Null) {"`$Null"} Else {
        
        $Type = "[" + $InputObject.GetType().Name + "]"

        $PSON = If ($InputObject -is [Array]) {
            
            $Format = "@(", ",$Space", ")"
            
            If ($Depth -gt 1) {

                For ($i = 0; $i -lt $InputObject.Count; $i++) {

                    ConvertTo-PSON $InputObject[$i] ($Depth - 1) ($Layers - 1) -Strict:$Strict

                }
            
            }

        } ElseIf ($InputObject -is [Xml]) {

            $Type = "[Xml]"
            $String = New-Object System.IO.StringWriter
            $InputObject.Save($String)
            $Xml = "'" + ([String]$String).Replace("`'", "&apos;") + "'"
            If ($Layers -le 0) {
            
                ($Xml -Replace "\r\n\s*", "") -Replace "\s+", " "

            } ElseIf ($Layers -eq 1) {

                $Xml
            
            } Else {
            
                $Xml.Replace("`r`n", "`r`n`t")
            
            }

            $String.Dispose()

        } ElseIf ($InputObject -is [DateTime]) {

            "$Quote$($InputObject.ToString('s'))$Quote"
        
        } ElseIf ($InputObject -is [String]) {

            0..11 | ForEach {$InputObject = $InputObject.Replace([String]"```'""`0`a`b`f`n`r`t`v`$"[$_], ('`' + '`''"0abfnrtv$'[$_]))}; "$Quote$InputObject$Quote"
        
        } ElseIf ($InputObject -is [Boolean]) {

            "`$$InputObject"
        
        } ElseIf ($InputObject -is [Char]) {
            
            If ($Strict) {[Int]$InputObject} Else {"$Quote$InputObject$Quote"}

        } ElseIf ($InputObject -is [ValueType]) {

            $InputObject

        } ElseIf ($InputObject -as [Hashtable]){

            if($InputObject -is [System.Collections.Specialized.OrderedDictionary]){              
                $Type = "[Ordered]"  
            }
            
            $Format = "@{", ";$Space", "}"
            
            If ($Depth -gt 1){

                $InputObject.GetEnumerator() | ForEach {"$Quote$($_.Name)$Quote" + "$Space=$Space" + (ConvertTo-PSON $_.Value ($Depth - 1) ($Layers - 1) -Strict:$Strict)}
            
            }
        } ElseIf ($InputObject -is [Object]) {

            $Format = "@{", ";$Space", "}"

            If ($Depth -gt 1) {

                $InputObject.PSObject.Properties | ForEach {$_.Name + "$Space=$Space" + (ConvertTo-PSON $_.Value ($Depth - 1) ($Layers - 1) -Strict:$Strict)}
            
            }
        
        } Else {

            $InputObject
        
        }

        If ($Format) {

            $PSON = $Format[0] + (&{

                If (($Layers -le 1) -or ($PSON.Count -le 0)) {

                    $PSON -Join $Format[1]
                
                } Else {
                
                    ("`r`n" + ($PSON -Join "$($Format[1])`r`n")).Replace("`r`n", "`r`n`t") + "`r`n"
                
                }
            
            }) + $Format[2]
        
        }

        If ($Strict) {
            "$Type$PSON"
        } Else {
            "$PSON"
        }
    }
}



tools\PoshDevOps\TaskGroupStorage\TaskGroupStorage.psm1
Import-Module "$PSScriptRoot\Pson" -Force -Global
Import-Module "$PSScriptRoot\..\OrderedDictionaryExtensions" -Force -Global

function Get-TaskGroup(

[string]
[ValidateNotNullOrEmpty()]
[Parameter(
    Mandatory=$true,
    ValueFromPipelineByPropertyName=$true)]
$Name,

[string]
[ValidateScript({Test-Path $_ -PathType Container})]
[Parameter(
    ValueFromPipelineByPropertyName=$true)]
$ProjectRootDirPath = '.'){
    <#
        .SYNOPSIS
        an internal utility function that retrieves a task group from storage
    #>

    $TaskGroupFilePath = Resolve-Path "$ProjectRootDirPath\.PoshDevOps\$Name.psd1"   
    Write-Output (Get-Content $TaskGroupFilePath | Out-String | ConvertFrom-Pson)

}

function Add-TaskGroup(
[PsCustomObject]
$Value,

[switch]
$Force,

[string]
[ValidateScript({Test-Path $_ -PathType Container})]
[Parameter(
    ValueFromPipelineByPropertyName=$true)]
$ProjectRootDirPath = '.'){
    <#
        .SYNOPSIS
        an internal utility function that saves a task group to storage
    #>

    $TaskGroupFilePath = "$ProjectRootDirPath\.PoshDevOps\$($Value.Name).psd1"

    # guard against unintentionally overwriting existing task group
    if(!$Force.IsPresent -and (Test-Path $TaskGroupFilePath)){
throw `
@"
Task group "$($Value.Name)" already exists
for project "$(Resolve-Path $ProjectRootDirPath)".

Task group names must be unique.
If you want to overwrite the existing task group use the -Force parameter
"@
    }

Write-Debug `
@"
Creating task group file at:
$TaskGroupFilePath
Creating...
"@
    Start-Transaction

        New-Item -Path $TaskGroupFilePath -ItemType File -Force        
        Set-Content $TaskGroupFilePath -Value (ConvertTo-Pson -InputObject $Value -Depth 12 -Layers 12 -Strict) -Force
    
    Complete-Transaction
}



function Rename-TaskGroup(
[string]
[ValidateNotNullOrEmpty()]
$OldName,

[string]
[ValidateNotNullOrEmpty()]
$NewName,

[switch]
$Force,

[string]
[ValidateScript({Test-Path $_ -PathType Container})]
[Parameter(
    ValueFromPipelineByPropertyName=$true)]
$ProjectRootDirPath = '.'){
    <#
        .SYNOPSIS
        an internal utility function that updates the name of a task group in storage
    #>
    
    $OldTaskGroupFilePath = "$ProjectRootDirPath\.PoshDevOps\$OldName.psd1"
    $NewTaskGroupFilePath = "$ProjectRootDirPath\.PoshDevOps\$NewName.psd1"

    # guard against unintentionally overwriting existing task group
    if(!$Force.IsPresent -and (Test-Path $NewTaskGroupFilePath)){
throw `
@"
Task group "$NewName" already exists
for project "$(Resolve-Path $ProjectRootDirPath)".

Task group names must be unique.
If you want to overwrite the existing task group use the -Force parameter
"@
    }

    # fetch task group
    $TaskGroup = Get-TaskGroup -Name $OldName -ProjectRootDirPath $ProjectRootDirPath

    # update name
    $TaskGroup.Name = $NewName

    Start-Transaction
        
        #save
        mv $OldTaskGroupFilePath $NewTaskGroupFilePath -Force -UseTransaction
        sc $TaskGroupFilePath -Value (ConvertTo-Pson -InputObject $TaskGroup -Depth 12 -Layers 12 -Strict) -Force -UseTransaction
    
    Complete-Transaction
}

function Remove-TaskGroup(

[string]
[ValidateNotNullOrEmpty()]
[Parameter(
    Mandatory=$true,
    ValueFromPipelineByPropertyName=$true)]
$Name,

[string]
[ValidateScript({Test-Path $_ -PathType Container})]
[Parameter(
    ValueFromPipelineByPropertyName=$true)]
$ProjectRootDirPath = '.'){
    <#
        .SYNOPSIS
        an internal utility function that removes a task group from storage
    #>
    
    $TaskGroupFilePath = Resolve-Path "$ProjectRootDirPath\.PoshDevOps\$Name.psd1"
    
    Remove-Item -Path $TaskGroupFilePath -Force
}

function Add-Task(
[string]
[ValidateNotNullOrEmpty()]
[Parameter(
    Mandatory=$true,
    ValueFromPipelineByPropertyName=$true)]
$TaskGroupName,

[string]
[ValidateNotNullOrEmpty()]
[Parameter(
    Mandatory=$true,
    ValueFromPipelineByPropertyName=$true)]
$Name,

[string]
[ValidateNotNullOrEmpty()]
[Parameter(
    Mandatory=$true,
    ValueFromPipelineByPropertyName=$true)]
$PackageId,

[string]
[ValidateNotNullOrEmpty()]
[Parameter(
    Mandatory=$true,
    ValueFromPipelineByPropertyName=$true)]
$PackageVersion,

[int]
[ValidateScript({$_ -gt -1})]
[Parameter(
    Mandatory=$true,
    ValueFromPipelineByPropertyName=$true)]
$Index,

[switch]
$Force,

[string]
[ValidateScript({Test-Path $_ -PathType Container})]
[Parameter(
    ValueFromPipelineByPropertyName=$true)]
$ProjectRootDirPath = '.'){
    <#
        .SYNOPSIS
        an internal utility function that adds a task to a task group in storage
    #>    
    
    $TaskGroupFilePath = "$ProjectRootDirPath\.PoshDevOps\$TaskGroupName.psd1"

    # fetch task group
    $TaskGroup = Get-TaskGroup -Name $TaskGroupName -ProjectRootDirPath $ProjectRootDirPath

    # guard against unintentionally overwriting existing tasks
    if(!$Force.IsPresent -and ($TaskGroup.Tasks.$Name)){
throw `
@"
Task "$Name" already exists in task group "$TaskGroupName"
for project "$(Resolve-Path $ProjectRootDirPath)".

Task names must be unique.
If you want to overwrite the existing task use the -Force parameter
"@
    }

    # construct task object
    $Task = @{Name=$Name;PackageId=$PackageId;PackageVersion=$PackageVersion;}

    # add task to taskgroup
    $TaskGroup.Tasks.Insert($Index,$Name,$Task)

    # save
    sc $TaskGroupFilePath -Value (ConvertTo-Pson -InputObject $TaskGroup -Depth 12 -Layers 12 -Strict) -Force
}

function Remove-Task(
[string]
[ValidateNotNullOrEmpty()]
[Parameter(
    Mandatory=$true,
    ValueFromPipelineByPropertyName=$true)]
$TaskGroupName,

[string]
[ValidateNotNullOrEmpty()]
[Parameter(
    Mandatory=$true,
    ValueFromPipelineByPropertyName=$true)]
$Name,

[string]
[ValidateScript({Test-Path $_ -PathType Container})]
[Parameter(
    ValueFromPipelineByPropertyName=$true)]
$ProjectRootDirPath = '.'){
    
    $TaskGroupFilePath = "$ProjectRootDirPath\.PoshDevOps\$TaskGroupName.psd1"
    
    # fetch task group
    $TaskGroup = Get-TaskGroup -Name $TaskGroupName -ProjectRootDirPath $ProjectRootDirPath

    # remove task
    $TaskGroup.Tasks.Remove($Name)

    # save
    sc $TaskGroupFilePath -Value (ConvertTo-Pson -InputObject $TaskGroup -Depth 12 -Layers 12 -Strict) -Force
}

function Rename-Task(
[string]
[ValidateNotNullOrEmpty()]
[Parameter(
    Mandatory=$true,
    ValueFromPipelineByPropertyName=$true)]
$TaskGroupName,

[string]
[ValidateNotNullOrEmpty()]
[Parameter(
    Mandatory=$true,
    ValueFromPipelineByPropertyName=$true)]
$OldName,

[string]
[ValidateNotNullOrEmpty()]
[Parameter(
    Mandatory=$true,
    ValueFromPipelineByPropertyName=$true)]
$NewName,

[switch]
$Force,

[string]
[ValidateScript({Test-Path $_ -PathType Container})]
[Parameter(
    ValueFromPipelineByPropertyName=$true)]
$ProjectRootDirPath = '.'){
    
    $TaskGroupFilePath = "$ProjectRootDirPath\.PoshDevOps\$TaskGroupName.psd1"
    
    # fetch task group
    $TaskGroup = Get-TaskGroup -Name $TaskGroupName -ProjectRootDirPath $ProjectRootDirPath

    # fetch task
    $Task = $TaskGroup.Tasks.$OldName

    # handle task not found
    if(!$Task){
throw `
@"
Task "$TaskName" not found in task group "$TaskGroupName"
for project "$(Resolve-Path $ProjectRootDirPath)".
"@
    }

    # guard against unintentionally overwriting existing task
    if(!$Force.IsPresent -and ($TaskGroup.Tasks.$NewName)){
throw `
@"
Task "$NewName" already exists in task group "$TaskGroupName"
for project "$(Resolve-Path $ProjectRootDirPath)".

Task names must be unique.
If you want to overwrite the existing task use the -Force parameter
"@
    }

    # get task index
    $Index = Get-IndexOfKeyInOrderedDictionary -Key $OldName -OrderedDictionary $TaskGroup.Tasks

    # update name
    $Task.Name = $NewName

    # remove old record
    $TaskGroup.Tasks.Remove($OldName)

    # insert new record
    $TaskGroup.Tasks.Insert($Index,$Task.Name,$Task)

    # save
    sc $TaskGroupFilePath -Value (ConvertTo-Pson -InputObject $TaskGroup -Depth 12 -Layers 12 -Strict) -Force
}

function Update-TaskPackageVersion(
[string]
[ValidateNotNullOrEmpty()]
[Parameter(
    Mandatory=$true,
    ValueFromPipelineByPropertyName=$true)]
$TaskGroupName,

[string]
[ValidateNotNullOrEmpty()]
[Parameter(
    Mandatory=$true,
    ValueFromPipelineByPropertyName=$true)]
$TaskName,

[string]
[ValidateNotNullOrEmpty()]
[Parameter(
    Mandatory=$true,
    ValueFromPipelineByPropertyName=$true)]
$PackageVersion,

[string]
[ValidateScript({Test-Path $_ -PathType Container})]
[Parameter(
    ValueFromPipelineByPropertyName=$true)]
$ProjectRootDirPath = '.'){
    
    $TaskGroupFilePath = "$ProjectRootDirPath\.PoshDevOps\$TaskGroupName.psd1"
    
    # fetch task group
    $TaskGroup = Get-TaskGroup -Name $TaskGroupName -ProjectRootDirPath $ProjectRootDirPath

    # fetch task
    $Task = $TaskGroup.Tasks.$TaskName

    # handle task not found
    if(!$Task){
throw `
@"
Task "$TaskName" not found in task group "$TaskGroupName"
for project "$(Resolve-Path $ProjectRootDirPath)".
"@
    }

    # update task version
    $Task.PackageVersion = $PackageVersion
    
    # save
    sc $TaskGroupFilePath -Value (ConvertTo-Pson -InputObject $TaskGroup -Depth 12 -Layers 12 -Strict) -Force
}

function Set-TaskParameter(
[string]
[ValidateNotNullOrEmpty()]
[Parameter(
    Mandatory=$true,
    ValueFromPipelineByPropertyName=$true)]
$TaskGroupName,

[string]
[ValidateNotNullOrEmpty()]
[Parameter(
    Mandatory=$true,
    ValueFromPipelineByPropertyName=$true)]
$TaskName,

[string]
[ValidateNotNullOrEmpty()]
[Parameter(
    Mandatory=$true)]
$Name,

[object]
[Parameter(
    Mandatory=$true)]
$Value,

[switch]
$Force,

[string]
[ValidateScript({Test-Path $_ -PathType Container})]
[Parameter(
    ValueFromPipelineByPropertyName=$true)]
$ProjectRootDirPath = '.'){
    
    $TaskGroupFilePath = "$ProjectRootDirPath\.PoshDevOps\$TaskGroupName.psd1"
    
    # fetch task group
    $TaskGroup = Get-TaskGroup -Name $TaskGroupName -ProjectRootDirPath $ProjectRootDirPath

    # fetch task
    $Task = $TaskGroup.Tasks.$TaskName

    # handle task not found
    if(!$Task){
throw `
@"
Task "$TaskName" not found in task group "$TaskGroupName"
for project "$(Resolve-Path $ProjectRootDirPath)".
"@
    }

    # handle the case where this is the first parameter set
    If(!$Task.Parameters){
        $Task.Parameters = @{$Name=$Value}
    }
    # guard against unintentionally overwriting existing parameter value
    ElseIf(!$Force.IsPresent -and ($Task.Parameters.$Name)){
throw `
@"
A value of $($Task.Parameters.$Name) has already been set for parameter $Name in task "$TaskName" in task group "$TaskGroupName"
for project "$(Resolve-Path $ProjectRootDirPath)".

If you want to overwrite the existing parameter value use the -Force parameter
"@
    }
    Else{    
        $Task.Parameters.$Name = $Value
    }
    
    # save
    sc $TaskGroupFilePath -Value (ConvertTo-Pson -InputObject $TaskGroup -Depth 12 -Layers 12 -Strict) -Force
}

# task group operations
Export-ModuleMember -Function Get-TaskGroup
Export-ModuleMember -Function Add-TaskGroup
Export-ModuleMember -Function Rename-TaskGroup
Export-ModuleMember -Function Remove-TaskGroup

# task operations
Export-ModuleMember -Function Add-Task
Export-ModuleMember -Function Remove-Task
Export-ModuleMember -Function Rename-Task
Export-ModuleMember -Function Update-TaskPackageVersion
Export-ModuleMember -Function Set-TaskParameter
tools\PoshDevOps\Uninstall.ps1
# remove source
$installRootDirPath = "C:\Program Files\PoshDevOps"
$installDirPath = "$installRootDirPath\Modules"

# make idempotent
if(Test-Path "$installRootDirPath"){
    Remove-Item $installRootDirPath -Force -Recurse
}

# remove $PSModulePath modification
$psModulePath = [Environment]::GetEnvironmentVariable('PSModulePath','Machine')

$newPSModulePathParts = @();
$isPSModulePathModified = $false
foreach($part in $psModulePath.Split(';')){
    if($part -eq $installDirPath){
        $isPSModulePathModified = $true
    }
    else{
        $newPSModulePathParts += $part;        
    }
}

$psModulePath = $newPSModulePathParts -join ';'

if($isPSModulePathModified){
    Write-Debug "updating '$env:PSModulePath' to $psModulePath"

    # save
    [Environment]::SetEnvironmentVariable('PSModulePath',$psModulePath,'Machine')
}

Log in or click on link to see number of positives.

In cases where actual malware is found, the packages are subject to removal. Software sometimes has false positives. Moderators do not necessarily validate the safety of the underlying software, only that a package retrieves software from the official distribution point and/or validate embedded software against official distribution point (where distribution rights allow redistribution).

Chocolatey Pro provides runtime protection from possible malware.

Add to Builder Version Downloads Last Updated Status
PoshDevOps 0.0.71 396 Friday, March 27, 2015 Approved
PoshDevOps 0.0.69 392 Friday, March 27, 2015 Approved
PoshDevOps 0.0.68 416 Thursday, March 26, 2015 Approved
PoshDevOps 0.0.64 437 Thursday, March 26, 2015 Approved
PoshDevOps 0.0.63 406 Wednesday, March 25, 2015 Approved
PoshDevOps 0.0.62 379 Wednesday, March 25, 2015 Approved
PoshDevOps 0.0.42 442 Wednesday, March 25, 2015 Approved
PoshDevOps 0.0.41 392 Tuesday, March 24, 2015 Approved
PoshDevOps 0.0.40 385 Tuesday, March 24, 2015 Approved
PoshDevOps 0.0.39 392 Tuesday, March 24, 2015 Approved
PoshDevOps 0.0.38 390 Monday, March 23, 2015 Approved
PoshDevOps 0.0.37 424 Monday, March 23, 2015 Approved
PoshDevOps 0.0.36 411 Sunday, March 22, 2015 Approved
PoshDevOps 0.0.35 415 Sunday, March 22, 2015 Approved
PoshDevOps 0.0.34 393 Saturday, March 21, 2015 Approved
PoshDevOps 0.0.33 456 Saturday, March 21, 2015 Approved
PoshDevOps 0.0.32 353 Saturday, March 21, 2015 Approved
PoshDevOps 0.0.31 401 Saturday, March 21, 2015 Approved
PoshDevOps 0.0.30 401 Saturday, March 21, 2015 Approved
PoshDevOps 0.0.28 413 Saturday, March 21, 2015 Approved
PoshDevOps 0.0.27 457 Saturday, March 21, 2015 Approved
PoshDevOps 0.0.13 507 Friday, March 20, 2015 Approved
PoshDevOps 0.0.12 394 Friday, March 20, 2015 Approved
PoshDevOps 0.0.6 411 Wednesday, March 18, 2015 Approved
PoshDevOps 0.0.4 357 Wednesday, March 18, 2015 Approved
PoshDevOps 0.0.2 363 Monday, March 30, 2015 Approved

This package has no dependencies.

Discussion for the PoshDevOps Package

Ground Rules:

  • This discussion is only about PoshDevOps and the PoshDevOps package. If you have feedback for Chocolatey, please contact the Google Group.
  • This discussion will carry over multiple versions. If you have a comment about a particular version, please note that in your comments.
  • The maintainers of this Chocolatey Package will be notified about new comments that are posted to this Disqus thread, however, it is NOT a guarantee that you will get a response. If you do not hear back from the maintainers after posting a message below, please follow up by using the link on the left side of this page or follow this link to contact maintainers. If you still hear nothing back, please follow the package triage process.
  • Tell us what you love about the package or PoshDevOps, or tell us what needs improvement.
  • Share your experiences with the package, or extra configuration or gotchas that you've found.
  • If you use a url, the comment will be flagged for moderation until you've been whitelisted. Disqus moderated comments are approved on a weekly schedule if not sooner. It could take between 1-5 days for your comment to show up.
comments powered by Disqus