Skip to content

Commit a1d1e2f

Browse files
committed
Adding functionallity.
1 parent e6dc3ce commit a1d1e2f

9 files changed

+145
-51
lines changed

PSAppVeyor/Classes/AppVeyorConfiguration.ps1

Whitespace-only changes.

PSAppVeyor/PSAppVeyor.psd1

322 Bytes
Binary file not shown.

PSAppVeyor/Public/Get-AppVeyorProjectSetting.1.ps1

Lines changed: 0 additions & 41 deletions
This file was deleted.

PSAppVeyor/Public/Remove-AppVeyorProject.ps1

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,20 @@ Function Remove-AppVeyorProject {
2121
'Slug'
2222
)]
2323
[String]
24-
$ProjectName
24+
$ProjectName,
25+
26+
[Parameter()]
27+
[Switch]
28+
$BuildCacheOnly
2529
)
2630

2731
Process {
28-
Invoke-AppVeyorApi -Method 'DELETE' -RestMethod "projects/${AccountName}/${ProjectName}"
32+
$restMethod = "projects/${AccountName}/${ProjectName}"
33+
34+
if ($BuildCacheOnly.IsPresent) {
35+
$restMethod += '/buildcache'
36+
}
37+
38+
Invoke-AppVeyorApi -Method 'DELETE' -RestMethod $restMethod
2939
}
3040
}
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
Function Start-AppVeyorProjectBuild {
2+
3+
[CmdletBinding()]
4+
[OutputType(
5+
[AppVeyorBuild]
6+
)]
7+
8+
Param (
9+
[Parameter(
10+
Mandatory = $true,
11+
ValueFromPipelineByPropertyName = $true
12+
)]
13+
[String]
14+
$AccountName,
15+
16+
[Parameter(
17+
Mandatory = $true,
18+
ValueFromPipelineByPropertyName = $true
19+
)]
20+
[Alias(
21+
'Slug'
22+
)]
23+
[String]
24+
$ProjectName,
25+
26+
[Parameter(
27+
Mandatory = $true,
28+
ParameterSetName = 'LatestBuild',
29+
ValueFromPipelineByPropertyName = $true
30+
)]
31+
[Parameter(
32+
Mandatory = $true,
33+
ParameterSetName = 'CommitId',
34+
ValueFromPipelineByPropertyName = $true
35+
)]
36+
[String]
37+
$Branch,
38+
39+
[Parameter(
40+
ParameterSetName = 'LatestBuild'
41+
)]
42+
[HashTable]
43+
$EnvironmentVariable = $null,
44+
45+
[Parameter(
46+
ParameterSetName = 'CommitId'
47+
)]
48+
[String]
49+
$CommitId,
50+
51+
[Parameter(
52+
ParameterSetName = 'GitHubPullRequest'
53+
)]
54+
[Int]
55+
$GitHubPullRequestId
56+
)
57+
58+
Process {
59+
$body = @{
60+
'accountName' = $AccountName
61+
'projectSlug' = $ProjectName
62+
}
63+
64+
switch ($PSCmdlet.ParameterSetName) {
65+
'LatestBuild' {
66+
$body.Add('branch', $Branch)
67+
68+
if (-null -ne $EnvironmentVariable) {
69+
$body.Add('environmentVariables', $EnvironmentVariable)
70+
}
71+
}
72+
73+
'CommitId' {
74+
$body.Add('branch', $Branch)
75+
$body.Add('commitId', $CommitId)
76+
}
77+
78+
'GitHubPullRequest' {
79+
$body.Add('pullRequestId', $GitHubPullRequestId)
80+
}
81+
}
82+
83+
[AppVeyorBuild]::new(
84+
(Invoke-AppVeyorApi -Method 'POST' -RestMethod 'builds' -Body (ConvertTo-Json -InputObject $body))
85+
)
86+
}
87+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
Function Stop-AppVeyorProjectBuild {
2+
3+
[CmdletBinding()]
4+
[OutputType(
5+
[Void]
6+
)]
7+
8+
Param (
9+
[Parameter(
10+
Mandatory = $true,
11+
ValueFromPipelineByPropertyName = $true
12+
)]
13+
[String]
14+
$AccountName,
15+
16+
[Parameter(
17+
Mandatory = $true,
18+
ValueFromPipelineByPropertyName = $true
19+
)]
20+
[String]
21+
$ProjectName,
22+
23+
[Parameter(
24+
Mandatory = $true,
25+
ValueFromPipelineByPropertyName = $true
26+
)]
27+
[Int]
28+
$BuildId
29+
)
30+
31+
Process {
32+
Invoke-AppVeyorApi -Method 'DELETE' -RestMethod "builds/${AccountName}/${ProjectName}/${BuildId}"
33+
}
34+
}

PSAppVeyor/Public/Update-AppVeyorProjectBuildNumber.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
Function Update-AppVeyorProjectBuildNumber {
22

33
[CmdletBinding()]
4-
[OutputType()]
4+
[OutputType(
5+
[Void]
6+
)]
57

68
Param (
79
[Parameter(

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@ PS GitHub:\> Get-Command -Module PSAppVeyor
1212
1313
CommandType Name Version Source
1414
----------- ---- ------- ------
15-
Function Get-AppVeyorBuild 0.1.2 PSAppVeyor
16-
Function Get-AppVeyorProject 0.1.2 PSAppVeyor
17-
Function Get-AppVeyorProjectSetting 0.1.2 PSAppVeyor
18-
Function New-AppVeyorProject 0.1.2 PSAppVeyor
19-
Function Remove-AppVeyorProject 0.1.2 PSAppVeyor
20-
Function Set-AppVeyorApiToken 0.1.2 PSAppVeyor
21-
Function Update-AppVeyorProjectBuildNumber 0.1.2 PSAppVeyor
15+
Function Get-AppVeyorBuild 0.1.3 PSAppVeyor
16+
Function Get-AppVeyorProject 0.1.3 PSAppVeyor
17+
Function Get-AppVeyorProjectSetting 0.1.3 PSAppVeyor
18+
Function New-AppVeyorProject 0.1.3 PSAppVeyor
19+
Function Remove-AppVeyorProject 0.1.3 PSAppVeyor
20+
Function Set-AppVeyorApiToken 0.1.3 PSAppVeyor
21+
Function Start-AppVeyorProjectBuild 0.1.3 PSAppVeyor
22+
Function Stop-AppVeyorProjectBuild 0.1.3 PSAppVeyor
23+
Function Update-AppVeyorProjectBuildNumber 0.1.3 PSAppVeyor
2224
```
2325

2426
I havent had a whole lot of time to put into this, but I will keep adding functionality.

0 commit comments

Comments
 (0)