Skip to content

BeforeAll & AfterAll instructions #181

@superboum

Description

@superboum

Hi everyone,

I've used Psake for a few weeks now, and I'm quite surprised there is no AfterAll or BeforeAll functions. I mean, something like TaskSetup and TaskTearDown but launched only once, before and after all tasks. Here is psake grammar with BuildScriptSetup (BeforeAll) and BuildScriptTearDown (AfterAll) :

<BuildScript> ::= <Includes> 
                | <Properties>
                | <FormatTaskName> 
                | <TaskSetup> 
                | <TaskTearDown> 
                | <BuildScriptSetup> 
                | <BuildScriptTearDown> 
                | <Tasks> 
<Includes> ::= Include <StringLiteral> | <Includes>
<Properties> ::= Properties <ScriptBlock> | <Properties>
<FormatTaskName> ::= FormatTaskName <Stringliteral>
<TaskSetup> ::= TaskSetup <ScriptBlock>
<TaskTearDown> ::= TaskTearDown <ScriptBlock>
<BuildScriptSetup> ::= BuildScriptSetup <ScriptBlock>
<BuildScriptTearDown> ::= BuildScriptTearDown <ScriptBlock>
<Tasks> ::= Task <TaskParameters> | <Tasks>
<TaskParameters> ::= -Name <StringLiteral> 
            | -Action <ScriptBlock> 
            | -PreAction <ScriptBlock> 
            | -PostAction <ScriptBlock> 
            | -PreCondition <ScriptBlock>
            | -PostCondition <ScriptBlock>
            | -ContinueOnError <Boolean>
            | -Depends <TaskNames>
            | -Description <StringLiteral>
<TaskNames> ::= <StringLiteral>, | <TaskNames>              
<ScriptBlock> ::= { <PowerShellStatements> }
<Boolean> ::= $true | $false

So my questions are :

  • Is there a reason to not implement this instructions ?
  • Would you accept some potential contribution to add them ?
  • Is the prior proposition would be correct (naming, etc.) ?

For reference, a similar question has been asked on psake-users in 2012.

Here is the grammar on the doc

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions