Downloads:
2,684
Downloads of v 0.0.76:
299
Last Update:
04 Feb 2015
Package Maintainer(s):
Software Author(s):
- Chris Dostert
Tags:
powershell posh-ci taskrunner ci continuousintegration build deployment admin- Software Specific:
- Software Site
- Package Specific:
- Package outdated?
- Package broken?
- Contact Maintainers
- Contact Site Admins
- Software Vendor?
- Report Abuse
- Download
Posh-CI
- 1
- 2
- 3
0.0.76 | Updated: 04 Feb 2015
- Software Specific:
- Software Site
- Package Specific:
- Package outdated?
- Package broken?
- Contact Maintainers
- Contact Site Admins
- Software Vendor?
- Report Abuse
- Download
Downloads:
2,684
Downloads of v 0.0.76:
299
Maintainer(s):
Software Author(s):
- Chris Dostert
Posh-CI 0.0.76
- 1
- 2
- 3
All Checks are Unknown
2 Tests in Unknown Status
Validation Testing Unknown
Verification Testing Unknown
Scan Testing Unknown
This package was approved as a trusted package on 15 Feb 2015.
This package is unlisted and hidden from package listings.
Posh-CI: The Powershell Task Runner
Installation notes:
- installs to: C:\ProgramFiles\Posh-CI
- appends C:\ProgramFiles\Posh-CI\Modules to PSModulePath environment variable
try {
. "$PSScriptRoot\Posh-CI\Uninstall.ps1"
Write-ChocolateySuccess 'Posh-CI'
} catch {
Write-ChocolateyFailure 'Posh-CI' $_.Exception.Message
throw
}
# 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 "Posh-CI requires PowerShell 3.0 or better; you have version $($Host.Version)."
return
}
# prepare install dir
$installRootDirPath = "$env:ProgramFiles\Posh-CI"
$installDirPath = "$installRootDirPath\Modules"
# handle upgrade scenario
if(Test-Path "$installRootDirPath"){
Write-Debug 'removing previous Posh-CI 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 Posh-CI installation
$psModulePath = $psModulePath + ";$installDirPath"
# save
[Environment]::SetEnvironmentVariable('PSModulePath',$psModulePath,'Machine')
# make effective in current session
$env:PSModulePath = $env:PSModulePath + ";$installDirPath"
}
function EnsureChocolateyInstalled(){
# install chocolatey
try{
Get-Command choco -ErrorAction 'Stop' | Out-Null
}
catch{
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
}
}
function Get-CIPlanDirPath(
[string][Parameter(Mandatory=$true)]$ProjectRootDirPath){
"$ProjectRootDirPath\CIPlan"
}
function Get-CIStepsDirPath(
[string][Parameter(Mandatory=$true)]$ProjectRootDirPath){
"$(Get-CIPlanDirPath $ProjectRootDirPath)\Steps"
}
function ConvertTo-CIPlanArchiveJson(
[PSCustomObject][Parameter(Mandatory=$true)]$CIPlan){
<#
.SUMMARY
an internal utility function to convert a runtime CIPlan object to a
ci plan archive formatted as a json string
#>
# construct ci plan archive from ci plan
$ciPlanArchiveSteps = @()
$CIPlan.Steps.Values | %{$ciPlanArchiveSteps += $_}
$ciPlanArchive = [PSCustomObject]@{'Steps'=$ciPlanArchiveSteps}
return ConvertTo-Json -InputObject $ciPlanArchive -Depth 6
}
function ConvertFrom-CIPlanArchiveJson(
[string]$CIPlanFileContent){
<#
.SUMMARY
an internal utility function to convert a ci plan archive formatted as a json string
into a runtime CIPlan object.
#>
$ciPlanArchive = $CIPlanFileContent -join "`n" | ConvertFrom-Json
# construct a ci plan from a ci plan archive
$ciPlanSteps = [ordered]@{}
$ciPlanArchive.Steps | %{$ciPlanSteps.Add($_.Name,$_)}
return [pscustomobject]@{'Steps'=$ciPlanSteps}
}
function Get-CIPlan(
[string][Parameter(Mandatory=$true)]$ProjectRootDirPath){
<#
.SUMMARY
an internal utility function to retrieve a CIPlan file and
instantiate a runtime CIPlan object.
#>
$ciPlanDirPath = "$ProjectRootDirPath\CIPlan"
$ciPlanFilePath = "$ciPlanDirPath\CIPlanArchive.json"
return ConvertFrom-CIPlanArchiveJson -CIPlanFileContent (Get-Content $ciPlanFilePath)
}
function Save-CIPlan(
[psobject]$CIPlan,
[string][Parameter(Mandatory=$true)]$ProjectRootDirPath){
<#
.SUMMARY
an internal utility function to save a runtime CIPlan object as
a CIPlan file.
#>
$ciPlanDirPath = "$ProjectRootDirPath\CIPlan"
$ciPlanFilePath = "$ciPlanDirPath\CIPlanArchive.json"
Set-Content $ciPlanFilePath -Value (ConvertTo-CIPlanArchiveJson -CIPlan $CIPlan)
}
function Add-CIStep(
[string][Parameter(Mandatory=$true)]$Name,
[string][Parameter(Mandatory=$true)]$ModulePath,
[string]$ProjectRootDirPath = $PWD){
$ciPlan = Get-CIPlan -ProjectRootDirPath $ProjectRootDirPath
if($ciPlan.Steps.Contains($Name)){
throw "A ci step with name $Name already exists.`n Tip: You can remove the existing step by invoking Remove-CIStep"
}
else{
# add step to plan
$ciPlan.Steps.Add($Name, [PSCustomObject]@{'Name'=$Name;'ModulePath'=$ModulePath})
Save-CIPlan -CIPlan $ciPlan -ProjectRootDirPath $ProjectRootDirPath
}
}
function Remove-CIStep(
[string][Parameter(Mandatory=$true)]$Name,
[switch]$Force,
[string]$ProjectRootDirPath = $PWD){
$confirmationPromptQuery = "Are you sure you want to delete the CI step with name $Name`?"
$confirmationPromptCaption = 'Confirm ci step removal'
if($Force.IsPresent -or $PSCmdlet.ShouldContinue($confirmationPromptQuery,$confirmationPromptCaption)){
# remove step from plan
$ciPlan = Get-CIPlan -ProjectRootDirPath $ProjectRootDirPath
$ciPlan.Steps.Remove($Name)
Save-CIPlan -CIPlan $ciPlan -ProjectRootDirPath $ProjectRootDirPath
}
}
function New-CIPlan(
[string]$ProjectRootDirPath= $PWD){
$ciPlanDirPath = Get-CIPlanDirPath $ProjectRootDirPath
if(!(Test-Path $ciPlanDirPath)){
$templatesDirPath = "$PSScriptRoot\Templates"
$CIStepsDirPath = Get-CIStepsDirPath $ProjectRootDirPath
# create a directory for the plan
New-Item -ItemType Directory -Path $ciPlanDirPath
# create a directory for the plans Steps
New-Item -ItemType Directory -Path $CIStepsDirPath
# create default files
Copy-Item -Path "$templatesDirPath\CIPlanArchive.json" $ciPlanDirPath
Copy-Item -Path "$templatesDirPath\Packages.config" $ciPlanDirPath
}
else{
throw "CIPlan directory already exists at $ciPlanDirPath. If you are trying to recreate your ci plan from scratch you must invoke Remove-CIPlan first"
}
}
function Remove-CIPlan(
[switch]$Force,
[string]$ProjectRootDirPath= $PWD){
$ciPlanDirPath = Get-CIPlanDirPath $ProjectRootDirPath
$confirmationPromptQuery = "Are you sure you want to delete the CI plan located at $CIPlanDirPath`?"
$confirmationPromptCaption = 'Confirm ci plan removal'
if($Force.IsPresent -or $PSCmdlet.ShouldContinue($confirmationPromptQuery,$confirmationPromptCaption)){
Remove-Item -Path $ciPlanDirPath -Recurse -Force
}
}
function Invoke-CIPlan(
[PSCustomObject]
[Parameter(
ValueFromPipeline=$true,
ValueFromPipelineByPropertyName=$true)]
$Variables=@{'PoshCIHello'="Hello from Posh-CI!"},
[String]
$ProjectRootDirPath='.'){
$ciPlanDirPath = Resolve-Path "$ProjectRootDirPath\CIPlan"
$ciPlanFilePath = "$ciPlanDirPath\CIPlanArchive.json"
$packagesFilePath = "$ciPlanDirPath\Packages.config"
if(Test-Path $ciPlanFilePath){
EnsureChocolateyInstalled
choco install $packagesFilePath
# add variables to session
$CIPlan = Get-CIPlan -ProjectRootDirPath $ProjectRootDirPath
foreach($step in $CIPlan.Steps.Values){
Import-Module (resolve-path $step.ModulePath) -Force
$Variables | Invoke-CIStep
}
}
else{
throw "CIPlanArchive.json not found at: $ciPlanFilePath"
}
}
Export-ModuleMember -Function Invoke-CIPlan,New-CIPlan,Remove-CIPlan,Add-CIStep,Remove-CIStep
{
"Steps":[]
}
# halt immediately on any errors which occur in this module
$ErrorActionPreference = "Stop"
function Start-CIStep(
[String]$PoshCIHello){
#define your ci step here!
Write-Host $PoshCIHello
}
Export-ModuleMember Start-CIStep
<?xml version="1.0" encoding="utf-8"?>
<packages>
</packages>
# remove source
$installRootDirPath = "C:\Program Files\Posh-CI"
$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')
}
No results available for this package. We are building up results for older packages over time so expect to see results. If this is a new package, it should have results within a day or two.
This package has no dependencies.
Ground Rules:
- This discussion is only about Posh-CI and the Posh-CI 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 Posh-CI, 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.