Skip to content

Commit b176b23

Browse files
authored
Release v2.4
Merge pull request #159 from lipkau/release/v2.4
2 parents 3a72a1a + 401912b commit b176b23

File tree

14 files changed

+483
-140
lines changed

14 files changed

+483
-140
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ about: Create a report to help us improve
3232
<!-- The following code snip is a recommendation. You can just paste the output here. -->
3333

3434
> ```powershell
35-
> Get-Module AtlassianPS.Configuration -ListAvailable | Select Name, Version
35+
> Get-Module ConfluencePS -ListAvailable | Select Name, Version
3636
> $PSVersionTable
3737
> ```
3838

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,20 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1111

1212
.
1313

14+
## [2.4] 2018-12-12
15+
16+
### Added
17+
18+
- Added `-Vertical` to `ConvertTo-Table` (#148, [@brianbunke])
19+
- Added support for TLS1.2 (#155, [@lipkau])
20+
21+
### Changed
22+
23+
- Changed productive module files to be compiled into single `.psm1` file (#133, [@lipkau])
24+
- Fixed `ConvertTo-Table` for empty cells (#144, [@FelixMelchert])
25+
- Changed CI/CD pipeline from AppVeyor to Azure DevOps (#150, [@lipkau])
26+
- Fixed trailing slash in ApiURi parameter (#153, [@lipkau])
27+
1428
## [2.3] 2018-03-22
1529

1630
### Added
@@ -167,6 +181,7 @@ No changelog available for version `1.0` of ConfluencePS. `1.0` was created in l
167181
[@colhal]: https://github.com/colhal
168182
[@Dejulia489]: https://github.com/Dejulia489
169183
[@ebekker]: https://github.com/ebekker
184+
[@FelixMelchert]: https://github.com/FelixMelchert
170185
[@jkknorr]: https://github.com/jkknorr
171186
[@JohnAdders]: https://github.com/JohnAdders
172187
[@kittholland]: https://github.com/kittholland

ConfluencePS.build.ps1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ task InstallDependencies {
5959

6060
# Synopsis: Get the next version for the build
6161
task GetNextVersion {
62+
$manifestVersion = [Version](Get-Metadata -Path $env:BHPSModuleManifest)
6263
try {
6364
$env:CurrentOnlineVersion = [Version](Find-Module -Name $env:BHProjectName).Version
64-
$manifestVersion = [Version](Get-Metadata -Path $env:BHPSModuleManifest)
6565
$nextOnlineVersion = Get-NextNugetPackageVersion -Name $env:BHProjectName
6666

6767
if ( ($manifestVersion.Major -gt $nextOnlineVersion.Major) -or
@@ -250,7 +250,6 @@ task Test Init, {
250250
}
251251
$testResults = Invoke-Pester @parameter
252252

253-
Write-Host (Get-Childitem $env:BHProjectPath)
254253
Assert-True ($testResults.FailedCount -eq 0) "$($testResults.FailedCount) Pester test(s) failed."
255254
}
256255
catch {

ConfluencePS/ConfluencePS.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
RootModule = 'ConfluencePS.psm1'
1313

1414
# Version number of this module.
15-
ModuleVersion = '2.3'
15+
ModuleVersion = '2.4'
1616

1717
# ID used to uniquely identify this module
1818
GUID = '20d32089-48ef-464d-ba73-6ada240e26b3'

ConfluencePS/Private/Set-TlsLevel.ps1

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
function Set-TlsLevel {
2+
[CmdletBinding( SupportsShouldProcess = $false )]
3+
[System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseShouldProcessForStateChangingFunctions', '')]
4+
param (
5+
[Parameter(Mandatory, ParameterSetName = 'Set')]
6+
[Switch]$Tls12,
7+
8+
[Parameter(Mandatory, ParameterSetName = 'Revert')]
9+
[Switch]$Revert
10+
)
11+
12+
begin {
13+
switch ($PSCmdlet.ParameterSetName) {
14+
"Set" {
15+
$Script:OriginalTlsSettings = [Net.ServicePointManager]::SecurityProtocol
16+
17+
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
18+
}
19+
"Revert" {
20+
if ($Script:OriginalTlsSettings) {
21+
[Net.ServicePointManager]::SecurityProtocol = $Script:OriginalTlsSettings
22+
}
23+
}
24+
}
25+
}
26+
}

ConfluencePS/Public/ConvertTo-Table.ps1

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,45 +8,58 @@ function ConvertTo-Table {
88
)]
99
$Content,
1010

11-
[switch]$NoHeader
11+
[Switch]$Vertical,
12+
13+
[Switch]$NoHeader
1214
)
1315

1416
BEGIN {
1517
Write-Verbose "[$($MyInvocation.MyCommand.Name)] Function started"
1618

17-
$RowArray = New-Object System.Collections.ArrayList
19+
$sb = [System.Text.StringBuilder]::new()
1820
}
1921

2022
PROCESS {
2123
Write-Debug "[$($MyInvocation.MyCommand.Name)] ParameterSetName: $($PsCmdlet.ParameterSetName)"
2224
Write-Debug "[$($MyInvocation.MyCommand.Name)] PSBoundParameters: $($PSBoundParameters | Out-String)"
2325

24-
If ($NoHeader) {
25-
$HeaderGenerated = $true
26-
}
26+
$HeaderGenerated = $NoHeader
2727

2828
# This ForEach needed if the content wasn't piped in
2929
$Content | ForEach-Object {
30-
# First row enclosed by ||, all other rows by |
31-
If (!$HeaderGenerated) {
32-
$_.PSObject.Properties |
33-
ForEach-Object -Begin {$Header = ""} `
34-
-Process {$Header += "||$($_.Name)"} `
35-
-End {$Header += "||"}
36-
$RowArray.Add($Header) | Out-Null
37-
$HeaderGenerated = $true
30+
If ($Vertical) {
31+
If ($HeaderGenerated) {$pipe = '|'}
32+
Else {$pipe = '||'}
33+
34+
# Put an empty row between multiple tables (objects)
35+
If ($Spacer) {
36+
$null = $sb.AppendLine('')
37+
}
38+
39+
$_.PSObject.Properties | ForEach-Object {
40+
$row = ("$pipe {0} $pipe {1} |" -f $_.Name, $_.Value) -replace "\|\s\s", "| "
41+
$null = $sb.AppendLine($row)
42+
}
43+
44+
$Spacer = $true
45+
} Else {
46+
# Header row enclosed by ||
47+
If (-not $HeaderGenerated) {
48+
$null = $sb.AppendLine("|| {0} ||" -f ($_.PSObject.Properties.Name -join " || "))
49+
$HeaderGenerated = $true
50+
}
51+
52+
# All other rows enclosed by |
53+
$row = ("| " + ($_.PSObject.Properties.Value -join " | ") + " |") -replace "\|\s\s", "| "
54+
$null = $sb.AppendLine($row)
3855
}
39-
$_.PSObject.Properties |
40-
ForEach-Object -Begin {$Row = ""} `
41-
-Process {if ($($_.value)) {$Row += "|$($_.Value)"} else {$Row += "| "}} `
42-
-End {$Row += "|"}
43-
$RowArray.Add($Row) | Out-Null
4456
}
4557
}
4658

4759
END {
48-
$RowArray | Out-String
60+
# Return the array as one large, multi-line string
61+
$sb.ToString()
4962

50-
Write-Verbose "[$($MyInvocation.MyCommand.Name)] Function ened"
63+
Write-Verbose "[$($MyInvocation.MyCommand.Name)] Function ended"
5164
}
5265
}

ConfluencePS/Public/Get-Label.ps1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ function Get-Label {
6363
$InputObject = Get-Page -PageID $_page -ApiURi $apiURi -Credential $Credential
6464
}
6565
$iwParameters["Uri"] = $resourceApi -f $_page
66-
Write-debug "Hey"
6766
$output = New-Object -TypeName ConfluencePS.ContentLabelSet
6867
$output.Page = $InputObject
6968
$output.Labels += (Invoke-Method @iwParameters)

ConfluencePS/Public/Invoke-Method.ps1

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ function Invoke-Method {
5050
BEGIN {
5151
Write-Verbose "[$($MyInvocation.MyCommand.Name)] Function started"
5252

53+
Set-TlsLevel -Tls12
54+
55+
# Sanitize double slash `//`
56+
# Happens when the BaseUri is the domain name
57+
# [Uri]"http://google.com" vs [Uri]"http://google.com/foo"
58+
$URi = $URi -replace '(?<!:)\/\/', '/'
59+
5360
# pass input to local variable
5461
# this allows to use the PSBoundParameters for recursion
5562
$_headers = @{ # Set any default headers
@@ -253,6 +260,8 @@ function Invoke-Method {
253260
}
254261

255262
END {
263+
Set-TlsLevel -Revert
264+
256265
Write-Verbose "[$($MyInvocation.MyCommand.Name)] Function ended"
257266
}
258267
}

Tests/ConfluencePS.Tests.ps1

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,22 @@ Describe "General project validation" -Tag Unit {
5959
[Version](Get-Metadata -Path $env:BHManifestToTest -PropertyName ModuleVersion) | Should -Not -BeNullOrEmpty
6060
[Version](Get-Metadata -Path $env:BHManifestToTest -PropertyName ModuleVersion) | Should -BeOfType [Version]
6161
}
62+
63+
It "module is imported with default prefix" {
64+
$prefix = Get-Metadata -Path $env:BHManifestToTest -PropertyName DefaultCommandPrefix
65+
66+
Import-Module $env:BHManifestToTest -Force -ErrorAction Stop
67+
(Get-Command -Module $env:BHProjectName).Name | ForEach-Object {
68+
$_ | Should -Match "\-$prefix"
69+
}
70+
}
71+
72+
It "module is imported with custom prefix" {
73+
$prefix = "Wiki"
74+
75+
Import-Module $env:BHManifestToTest -Prefix $prefix -Force -ErrorAction Stop
76+
(Get-Command -Module $env:BHProjectName).Name | ForEach-Object {
77+
$_ | Should -Match "\-$prefix"
78+
}
79+
}
6280
}

0 commit comments

Comments
 (0)