Skip to content

Commit 418bcf3

Browse files
committed
!deploy v0.1.9 release
## 0.1.9 - 2019-08-26 * Renamed `Copy-DynamicParameters` to `Copy-Parameters` for correctness and cleaned up approach for building the ParameterDictionary. * Updated Dockerfile to not run the Build task again since it should only run after module has been built. * Updated `azure-pipelines.yml` to break out Docker tasks
1 parent 014d422 commit 418bcf3

File tree

9 files changed

+116
-155
lines changed

9 files changed

+116
-155
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
* [PSProfile - ChangeLog](#psprofile---changelog)
2+
* [0.1.9 - 2019-08-26](#019---2019-08-26)
23
* [0.1.8 - 2019-08-26](#018---2019-08-26)
34
* [0.1.7 - 2019-08-25](#017---2019-08-25)
45
* [0.1.6 - 2019-08-24](#016---2019-08-24)
@@ -13,6 +14,12 @@
1314

1415
# PSProfile - ChangeLog
1516

17+
## 0.1.9 - 2019-08-26
18+
19+
* Renamed `Copy-DynamicParameters` to `Copy-Parameters` for correctness and cleaned up approach for building the ParameterDictionary.
20+
* Updated Dockerfile to not run the Build task again since it should only run after module has been built.
21+
* Updated `azure-pipelines.yml` to break out Docker tasks
22+
1623
## 0.1.8 - 2019-08-26
1724

1825
* Fixed issue with `$PSProfile.ModulesToImport` where an empty string was added to the array, resulting in a Warning during profile load about the module failing to import.

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ RUN apt-get update && apt-get install -y git
33

44
FROM base as src
55
LABEL maintainer="nferrell"
6-
LABEL description="PSProfile container for Ubuntu 16.04"
6+
LABEL description="Ubuntu 16.04 for PowerShell module testing in CI"
77
LABEL vendor="scrthq"
88
SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $VerbosePreference = 'Continue'; $ProgressPreference = 'SilentlyContinue';"]
99
COPY [".", "/PSProfile/"]
1010
WORKDIR /PSProfile
11-
ENTRYPOINT [ "pwsh", "-command", ". ./build.ps1 -Task Build,Test" ]
11+
ENTRYPOINT [ "pwsh", "-command", ". ./build.ps1 -Task Test" ]

PSProfile/PSProfile.Aliases.ps1

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
@{
2-
'Load-PSProfile' = 'Import-PSProfile'
3-
'Refresh-PSProfile' = 'Update-PSProfileConfig'
4-
'Creds' = 'Get-MyCreds'
5-
'Save-Prompt' = 'Add-PSProfilePrompt'
6-
'Get-Prompt' = 'Get-PSProfilePrompt'
7-
'Edit-Prompt' = 'Edit-PSProfilePrompt'
8-
'Set-Prompt' = 'Switch-PSProfilePrompt'
9-
'Switch-Prompt' = 'Switch-PSProfilePrompt'
10-
'Remove-Prompt' = 'Remove-PSProfilePrompt'
2+
'Load-PSProfile' = 'Import-PSProfile'
3+
'Refresh-PSProfile' = 'Update-PSProfileConfig'
4+
'Creds' = 'Get-MyCreds'
5+
'Save-Prompt' = 'Add-PSProfilePrompt'
6+
'Get-Prompt' = 'Get-PSProfilePrompt'
7+
'Edit-Prompt' = 'Edit-PSProfilePrompt'
8+
'Set-Prompt' = 'Switch-PSProfilePrompt'
9+
'Switch-Prompt' = 'Switch-PSProfilePrompt'
10+
'Remove-Prompt' = 'Remove-PSProfilePrompt'
11+
'Copy-DynamicParameters' = 'Copy-Parameters'
1112
}

PSProfile/PSProfile.psd1

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

1414
# Version number of this module.
15-
ModuleVersion = '0.1.8'
15+
ModuleVersion = '0.1.9'
1616

1717
# Supported PSEditions
1818
CompatiblePSEditions = @('Desktop','Core')

PSProfile/Plugins/PSProfile.PowerTools.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ function Start-BuildScript {
750750
else {
751751
Join-Path $bldFolder "build.ps1"
752752
}
753-
Copy-DynamicParameters -File $bldFile -ExcludeParameter Project,Task,Engine,NoExit,NoRestore
753+
Copy-Parameters -From $bldFile -Exclude Project,Task,Engine,NoExit,NoRestore
754754
}
755755
Process {
756756
if (-not $PSBoundParameters.ContainsKey('Project')) {

PSProfile/Public/Helpers/Copy-DynamicParameters.ps1

Lines changed: 0 additions & 134 deletions
This file was deleted.
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
function Copy-Parameters {
2+
<#
3+
.SYNOPSIS
4+
Copies parameters from a file or function and returns a RuntimeDefinedParameterDictionary with the copied parameters. Used in DynamicParam blocks.
5+
6+
.DESCRIPTION
7+
Copies parameters from a file or function and returns a RuntimeDefinedParameterDictionary with the copied parameters. Used in DynamicParam blocks.
8+
9+
.PARAMETER From
10+
The file or function to copy parameters from.
11+
12+
.PARAMETER Exclude
13+
The parameter or list of parameters to exclude from replicating into the returned Dictionary.
14+
15+
.EXAMPLE
16+
function Start-Build {
17+
[CmdletBinding()]
18+
Param ()
19+
DynamicParam {
20+
Copy-Parameters -From ".\build.ps1"
21+
}
22+
Process {
23+
#Function logic
24+
}
25+
}
26+
27+
Replicates the parameters from the build.ps1 script into the Start-Build function.
28+
#>
29+
[OutputType('System.Management.Automation.RuntimeDefinedParameterDictionary')]
30+
[CmdletBinding()]
31+
Param (
32+
[Parameter(Mandatory,Position = 0)]
33+
[Alias('File','Function')]
34+
[String]
35+
$From,
36+
[Parameter()]
37+
[String[]]
38+
$Exclude = @()
39+
)
40+
try {
41+
$targetCmd = $ExecutionContext.InvokeCommand.GetCommand($From, (Get-Command $From).CommandType, $PSBoundParameters)
42+
$params = @($targetCmd.Parameters.GetEnumerator() | Where-Object { $_.Key -notin $Exclude })
43+
if ($params.Length -gt 0) {
44+
$paramDictionary = [System.Management.Automation.RuntimeDefinedParameterDictionary]::new()
45+
foreach ($param in $params) {
46+
try {
47+
$param = $param.Value
48+
if (-not $MyInvocation.MyCommand.Parameters.ContainsKey($param.Name)) {
49+
$dynParam = [System.Management.Automation.RuntimeDefinedParameter]::new(
50+
$param.Name,
51+
$param.ParameterType,
52+
$param.Attributes
53+
)
54+
$paramDictionary.Add($param.Name, $dynParam)
55+
}
56+
}
57+
catch {
58+
$Global:Error.Remove($Global:Error[0])
59+
}
60+
}
61+
return $paramDictionary
62+
}
63+
}
64+
catch {
65+
$Global:Error.Remove($Global:Error[0])
66+
}
67+
}
68+
69+
Register-ArgumentCompleter -CommandName Copy-Parameters -ParameterName Exclude -ScriptBlock {
70+
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)
71+
$set = if (-not [String]::IsNullOrEmpty($fakeBoundParameter.From)) {
72+
([System.Management.Automation.Language.Parser]::ParseInput(
73+
(Get-Command $fakeBoundParameter.From).Definition, [ref]$null, [ref]$null
74+
)).ParamBlock.Parameters.Name.VariablePath.UserPath
75+
}
76+
else {
77+
@()
78+
}
79+
$set | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
80+
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
81+
}
82+
}

PSProfile/en-US/about_PSProfile_Helpers.help.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ LONG DESCRIPTION
1515
`Get-PSProfileArguments`.
1616

1717
COMMANDS
18-
* `Copy-DynamicParameters`
18+
* `Copy-Parameters`
1919
Copies parameters from a file or function and returns a
20-
RuntimeDefinedParameterDictionary with the parameters
21-
replicated. Used in DynamicParam blocks.
20+
RuntimeDefinedParameterDictionary with the copied parameters.
21+
Used in DynamicParam blocks.
2222

2323
* `Get-LastCommandDuration`
2424
Gets the duration last command as a timestamp string for

azure-pipelines.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,18 @@ phases:
147147
artifactName: BuildOutput
148148
downloadPath: '$(Build.SourcesDirectory)'
149149

150-
- powershell: |
151-
docker build . -t psprofile-img -f ./Dockerfile
152-
docker run --name psprofile psprofile-img:latest
153-
docker cp psprofile:/PSProfile/BuildOutput/TestResults.xml BuildOutput/TestResults_Docker.xml
154-
docker rm psprofile
150+
- powershell: docker build . -t module-img -f ./Dockerfile
151+
displayName: Build container image
152+
153+
- powershell: docker run --name module module-img:latest
155154
displayName: Test Module in Container
156155

156+
- powershell: docker cp module:/PSProfile/BuildOutput/TestResults.xml BuildOutput/TestResults_Docker.xml
157+
displayName: Copy container test results
158+
159+
- powershell: docker rm module
160+
displayName: Clean up container
161+
157162
- task: PublishTestResults@2
158163
displayName: 'Publish Test Results **/Test*.xml'
159164
inputs:

0 commit comments

Comments
 (0)