support 'legacy' buildscripts (job -safe) #203
-
|
We've got a bunch of pretty legacy scripts what utilize the Thinking of something like this: ib-legacy-hack.psm1 And then use it like this: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
I am glad to know that safe jobs/tasks are used not just by me. legacy.build.ps1 task IWork {
'I am working.'
}
task IFail {
throw 'I failed.'
}
task Something (job IWork), (job IFail -Safe), {
'Something is working.'
}ib-legacy-hack.psm1 function job {
param(
[string]$name,
[switch]$safe
)
if ($safe) {
"?$name"
}
else {
$name
}
}Test-1.ps1 Import-Module $PSScriptRoot\ib-legacy-hack.psm1
Invoke-Build -File $PSScriptRoot\legacy.build.ps1 -Task SomethingOutput: |
Beta Was this translation helpful? Give feedback.
I am glad to know that safe jobs/tasks are used not just by me.
I think you are thinking correctly. Your idea with a few tweaks:
legacy.build.ps1
task IWork { 'I am working.' } task IFail { throw 'I failed.' } task Something (job IWork), (job IFail -Safe), { 'Something is working.' }ib-legacy-hack.psm1
Test-1.ps1
Output: