Skip to content

Commit 676852a

Browse files
committed
Merge branch 'release/1.1.0'
2 parents b25bc6d + 71808e9 commit 676852a

8 files changed

+356
-7
lines changed

.gitignore

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Created by https://www.gitignore.io/
2+
3+
### NuGet Packages ###
4+
*.nupkg
5+
# The packages folder can be ignored because of Package Restore
6+
**/packages/*
7+
8+
### VisualStudioCode ###
9+
.vscode
10+
11+
### Pester Test Result ###
12+
TestResult.xml

README.markdown

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
Welcome to the psake-contrib project.
22
=====================================
33

4+
[![Join the chat at https://gitter.im/psake/psake-contrib](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/psake/psake-contrib?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
5+
46
psake-contrib is a repository for scripts, modules and functions that are useful for running a build with [psake](http://github.com/JamesKovacs/psake).
57

68

Run-Tests.ps1

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Import-Module Pester
2+
3+
Invoke-Pester tests\** -OutputFile TestResult.xml -OutputFormat NUnitXml
4+
5+
$appVeyorJobId = $env:APPVEYOR_JOB_ID
6+
if ($appVeyorJobId) {
7+
$url = "https://ci.appveyor.com/api/testresults/nunit/$appVeyorJobId"
8+
9+
$wc = New-Object 'System.Net.WebClient'
10+
$wc.UploadFile($url, (Resolve-Path '.\TestResult.xml'));
11+
12+
"Uploaded test results to AppVeyor."
13+
}

appveyor.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# psake-contrib
2+
3+
version: 1.0.0-build-{build}
4+
5+
branches:
6+
except:
7+
- gh-pages
8+
9+
os: Visual Studio 2015
10+
11+
install:
12+
- cinst pester
13+
14+
build: false
15+
16+
test_script:
17+
- ps: . .\Run-Tests.ps1

build.cmd

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@echo off
2+
3+
NuGet.exe install Pester -OutputDirectory packages -ExcludeVersion -Verbosity quiet
4+
5+
set pester=.\packages\Pester\tools\Pester.psm1
6+
7+
powershell -NoProfile -ExecutionPolicy Bypass -Command "Import-Module '%pester%'; Invoke-Pester tests\**;"
8+
goto :eof

nuget/psake-contrib.nuspec

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
33
<metadata>
44
<id>psake-contrib</id>
5-
<version>1.0.0</version>
5+
<version>1.1.0</version>
66
<authors>James Kovacs,James Crowley,Rafal Klys,Artur Dorochowicz,Scott Banwart,Ales Roubicek,C-J Berg,Pepa Stefan</authors>
77
<projectUrl>https://github.com/psake/psake-contrib</projectUrl>
88
<requireLicenseAcceptance>false</requireLicenseAcceptance>
@@ -14,4 +14,4 @@
1414
<files>
1515
<file src="..\*.psm1" target="tools\" />
1616
</files>
17-
</package>
17+
</package>

teamcity.psm1

+48-5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,30 @@ if ($env:TEAMCITY_VERSION) {
1515
}
1616
}
1717

18+
function TeamCity-Message([string]$text, [string]$status = 'NORMAL', [string]$errorDetails) {
19+
$messageAttributes = @{ text=$text; status=$status }
20+
21+
if ($errorDetails) {
22+
$messageAttributes.errorDetails = $errorDetails
23+
}
24+
25+
TeamCity-WriteServiceMessage 'message' $messageAttributes
26+
}
27+
28+
function TeamCity-BlockOpened([string]$name, [string]$description) {
29+
$messageAttributes = @{ name=$name }
30+
31+
if ($description) {
32+
$messageAttributes.description = $description
33+
}
34+
35+
TeamCity-WriteServiceMessage 'blockOpened' $messageAttributes
36+
}
37+
38+
function TeamCity-BlockClosed([string]$name) {
39+
TeamCity-WriteServiceMessage 'blockClosed' @{ name=$name }
40+
}
41+
1842
function TeamCity-TestSuiteStarted([string]$name) {
1943
TeamCity-WriteServiceMessage 'testSuiteStarted' @{ name=$name }
2044
}
@@ -112,18 +136,36 @@ function TeamCity-ReportBuildFinish([string]$message) {
112136
TeamCity-WriteServiceMessage 'progressFinish' $message
113137
}
114138

115-
function TeamCity-ReportBuildStatus([string]$status, [string]$text='') {
116-
TeamCity-WriteServiceMessage 'buildStatus' @{ status=$status; text=$text }
139+
function TeamCity-ReportBuildStatus([string]$status=$null, [string]$text='') {
140+
$messageAttributes = @{ text=$text }
141+
142+
if (![string]::IsNullOrEmpty($status)) {
143+
$messageAttributes.status=$status
144+
}
145+
146+
TeamCity-WriteServiceMessage 'buildStatus' $messageAttributes
117147
}
118148

119149
function TeamCity-SetBuildNumber([string]$buildNumber) {
120150
TeamCity-WriteServiceMessage 'buildNumber' $buildNumber
121151
}
122152

153+
function TeamCity-SetParameter([string]$name, [string]$value) {
154+
TeamCity-WriteServiceMessage 'setParameter' @{ name=$name; value=$value }
155+
}
156+
123157
function TeamCity-SetBuildStatistic([string]$key, [string]$value) {
124158
TeamCity-WriteServiceMessage 'buildStatisticValue' @{ key=$key; value=$value }
125159
}
126160

161+
function TeamCity-EnableServiceMessages() {
162+
TeamCity-WriteServiceMessage 'enableServiceMessages'
163+
}
164+
165+
function TeamCity-DisableServiceMessages() {
166+
TeamCity-WriteServiceMessage 'disableServiceMessages'
167+
}
168+
127169
function TeamCity-CreateInfoDocument([string]$buildNumber='', [boolean]$status=$true, [string[]]$statusText=$null, [System.Collections.IDictionary]$statistics=$null) {
128170
$doc=New-Object xml;
129171
$buildEl=$doc.CreateElement('build');
@@ -198,9 +240,10 @@ function TeamCity-WriteServiceMessage([string]$messageName, $messageAttributesHa
198240
if ($messageAttributesHashOrSingleValue -is [hashtable]) {
199241
$messageAttributesString = ($messageAttributesHashOrSingleValue.GetEnumerator() |
200242
%{ "{0}='{1}'" -f $_.Key, (escape $_.Value) }) -join ' '
201-
} else {
202-
$messageAttributesString = ("'{0}'" -f (escape $messageAttributesHashOrSingleValue))
243+
$messageAttributesString = " $messageAttributesString"
244+
} elseif ($messageAttributesHashOrSingleValue) {
245+
$messageAttributesString = (" '{0}'" -f (escape $messageAttributesHashOrSingleValue))
203246
}
204247

205-
Write-Output "##teamcity[$messageName $messageAttributesString]"
248+
Write-Output "##teamcity[$messageName$messageAttributesString]"
206249
}

0 commit comments

Comments
 (0)