Skip to content

Commit

Permalink
Amend bootstrap blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
nightroman committed Feb 17, 2024
1 parent d6539e8 commit 17ae0f5
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 13 deletions.
6 changes: 3 additions & 3 deletions Tasks/01-step-by-step-tutorial/08-bootstrap/tea.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ param(
)

# bootstrap
if ($MyInvocation.ScriptName -notlike '*Invoke-Build.ps1') {
if (!$MyInvocation.ScriptName.EndsWith('Invoke-Build.ps1')) {
$ErrorActionPreference = 1
if (!(Get-Command Invoke-Build -ErrorAction Ignore)) {
Write-Host -ForegroundColor Cyan 'Installing module InvokeBuild...'
if (!(Get-Command Invoke-Build -ErrorAction 0)) {
Write-Host 'Installing module InvokeBuild...'
Install-Module InvokeBuild -Scope CurrentUser -Force
Import-Module InvokeBuild
}
Expand Down
6 changes: 3 additions & 3 deletions Tasks/01-step-by-step-tutorial/09-Docker/tea.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ param(
)

# bootstrap
if ($MyInvocation.ScriptName -notlike '*Invoke-Build.ps1') {
if (!$MyInvocation.ScriptName.EndsWith('Invoke-Build.ps1')) {
$ErrorActionPreference = 1
if (!(Get-Command Invoke-Build -ErrorAction Ignore)) {
Write-Host -ForegroundColor Cyan 'Installing module InvokeBuild...'
if (!(Get-Command Invoke-Build -ErrorAction 0)) {
Write-Host 'Installing module InvokeBuild...'
Install-Module InvokeBuild -Scope CurrentUser -Force
Import-Module InvokeBuild
}
Expand Down
5 changes: 2 additions & 3 deletions Tasks/Direct/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ param(
)
# call the build engine with this script and return
if ($MyInvocation.ScriptName -notlike '*Invoke-Build.ps1') {
Invoke-Build $Tasks $MyInvocation.MyCommand.Path @PSBoundParameters
return
if (!$MyInvocation.ScriptName.EndsWith('Invoke-Build.ps1')) {
return Invoke-Build $Tasks $MyInvocation.MyCommand.Path @PSBoundParameters
}
# the usual build script
Expand Down
2 changes: 1 addition & 1 deletion Tasks/Direct/my.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ param(
)

# call the build engine with this script and return
if ($MyInvocation.ScriptName -notlike '*Invoke-Build.ps1') {
if (!$MyInvocation.ScriptName.EndsWith('Invoke-Build.ps1')) {
return Invoke-Build $Tasks $MyInvocation.MyCommand.Path @PSBoundParameters
}

Expand Down
5 changes: 2 additions & 3 deletions Tests/Fixed.test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -498,9 +498,8 @@ task DoNotMakeScriptParametersNamed {
param(
[Parameter()]$Tasks
)
if ($MyInvocation.ScriptName -notlike "*Invoke-Build.ps1") {
Invoke-Build -Task $Tasks -File $MyInvocation.MyCommand.Path @PSBoundParameters
return
if (!$MyInvocation.ScriptName.EndsWith('Invoke-Build.ps1')) {
return Invoke-Build $Tasks $MyInvocation.MyCommand.Path @PSBoundParameters
}
task Test {}
}
Expand Down

0 comments on commit 17ae0f5

Please sign in to comment.