Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: TaskTearDown #317

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Splaxi
Copy link
Contributor

@Splaxi Splaxi commented Apr 14, 2022

Convert parameter names into pascal

Description

Convert parameter names into pascal

Related Issue

#308

Motivation and Context

How Has This Been Tested?

ps>Get-Help TaskTearDown -Full

NAME
    TaskTearDown

SYNOPSIS
    Adds a scriptblock to the build that will be executed after each task


SYNTAX
    TaskTearDown [-TearDown] <ScriptBlock> [<CommonParameters>]


DESCRIPTION
    This function will accept a scriptblock that will be executed after each task in the
    build script.

    The scriptblock accepts an optional parameter which describes the Task being torn
    down.


PARAMETERS
    -TearDown <ScriptBlock>
        A scriptblock to execute

        Required?                    true
        Position?                    1
        Default value
        Accept pipeline input?       false
        Accept wildcard characters?  false

    <CommonParameters>
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer, PipelineVariable, and OutVariable. For more information, see
        about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).

INPUTS

OUTPUTS

    -------------------------- EXAMPLE 1 --------------------------

    PS C:\>A sample build script is shown below:

    Task default -Depends Test

    Task Test -Depends Compile, Clean {
    }

    Task Compile -Depends Clean {
    }

    Task Clean {
    }

    TaskTearDown {
        "Running 'TaskTearDown' for task $context.Peek().currentTaskName"
    }

    The script above produces the following output:

    Executing task, Clean...
    Running 'TaskTearDown' for task Clean
    Executing task, Compile...
    Running 'TaskTearDown' for task Compile
    Executing task, Test...
    Running 'TaskTearDown' for task Test

    Build Succeeded




    -------------------------- EXAMPLE 2 --------------------------

    PS C:\>A sample build script demonstrating access to the task context is shown below:

    Task default -Depends Test

    Task Test -Depends Compile, Clean {
    }

    Task Compile -Depends Clean {
    }

    Task Clean {
    }

    TaskTearDown {
        param($task)

        if ($task.Success) {
            "Running 'TaskTearDown' for task $($task.Name) - success!"
        } else {
            "Running 'TaskTearDown' for task $($task.Name) - failed:
    $($task.ErrorMessage)"
        }
    }

    The script above produces the following output:

    Executing task, Clean...
    Running 'TaskTearDown' for task Clean - success!
    Executing task, Compile...
    Running 'TaskTearDown' for task Compile - success!
    Executing task, Test...
    Running 'TaskTearDown' for task Test - success!

    Build Succeeded





RELATED LINKS
    Assert
    Exec
    FormatTaskName
    Framework
    Get-PSakeScriptTasks
    Include
    Invoke-psake
    Properties
    Task
    TaskSetup

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant