Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Plaster/Plaster.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# PSData hashtable with additional module metadata used by PowerShell.
PrivateData = @{
PSData = @{
Prerelease = 'alpha1'
# Prerelease = ''

# Tags applied to this module. These help with module discovery in online galleries.
Tags = @('Plaster', 'CodeGenerator', 'Scaffold', 'Template', 'JSON', 'PowerShell7')
Expand Down
45 changes: 24 additions & 21 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ param(
param($Command, $Parameter, $WordToComplete, $CommandAst, $FakeBoundParams)
try {
Get-PSakeScriptTasks -BuildFile './psakeFile.ps1' -ErrorAction 'Stop' |
Where-Object { $_.Name -like "$WordToComplete*" } |
Select-Object -ExpandProperty 'Name'
}
catch {
Where-Object { $_.Name -like "$WordToComplete*" } |
Select-Object -ExpandProperty 'Name'
} catch {
@()
}
})]
Expand Down Expand Up @@ -59,10 +58,10 @@ if ($Bootstrap) {
Select-Object -First 1

$powerShellGetModuleParameters = @{
Name = 'PowerShellGet'
Name = 'PowerShellGet'
MinimumVersion = '2.0.0'
MaximumVersion = '2.99.99'
Force = $true
Force = $true
}

if (-not $powerShellGetModule) {
Expand All @@ -77,30 +76,28 @@ if ($Bootstrap) {

# Try-import-first pattern
$psDependParameters = @{
Path = $PSScriptRoot
Recurse = $False
Path = $PSScriptRoot
Recurse = $False
WarningAction = 'SilentlyContinue'
Import = $True
Force = $True
ErrorAction = 'Stop'
Import = $True
Force = $True
ErrorAction = 'Stop'
}

$importSucceeded = $false
try {
Invoke-PSDepend @psDependParameters
$importSucceeded = $true
Write-Verbose 'Successfully imported existing modules.' -Verbose
}
catch {
} catch {
Write-Verbose "Could not import all required modules: $_" -Verbose
Write-Verbose 'Attempting to install missing or outdated dependencies...' -Verbose
}

if (-not $importSucceeded) {
try {
Invoke-PSDepend @psDependParameters -Install
}
catch {
} catch {
Write-Error "Failed to install and import required dependencies: $_"
Write-Error 'This may be due to locked module files. Please restart the build environment or clear module locks.'
if ($_.Exception.InnerException) {
Expand All @@ -109,20 +106,26 @@ if ($Bootstrap) {
throw
}
}
}
else {
} else {
if (-not (Get-Module -Name 'PSDepend' -ListAvailable)) {
throw 'Missing dependencies. Please run with the "-Bootstrap" flag to install dependencies.'
}
Invoke-PSDepend -Path $PSScriptRoot -Recurse $False -WarningAction 'SilentlyContinue' -Import -Force
}

if ($PSCmdlet.ParameterSetName -eq 'Help') {
Get-PSakeScriptTasks -buildFile $psakeFile |
Get-PSakeScriptTasks -BuildFile $psakeFile |
Format-Table -Property Name, Description, Alias, DependsOn
}
else {
} else {
Set-BuildEnvironment -Force
Invoke-psake -buildFile $psakeFile -taskList $Task -nologo
$invokepsakeSplat = @{
BuildFile = $psakeFile
TaskList = $Task
NoLogo = $true
}
if ($Env:GITHUB_ACTIONS) {
$invokepsakeSplat['OutputFormat'] = 'GitHubActions'
}
Invoke-Psake @invokepsakeSplat
exit ([int](-not $psake.build_success))
}
4 changes: 2 additions & 2 deletions requirements.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
}
}
'psake' = @{
Version = '4.9.1'
Version = '5.0.0'
}
'BuildHelpers' = @{
Version = '2.0.16'
Expand All @@ -23,4 +23,4 @@
'PSScriptAnalyzer' = @{
Version = '1.24.0'
}
}
}
Loading