-
Notifications
You must be signed in to change notification settings - Fork 1
Scripts
Scripts are nothing more than plain-text files that have a .ps1
filename extension found in the .build\scripts
directory. They are meant to define script scope functions. Rather than having script parameters, use properties instead.
Example: Import a custom script .build\scripts\MyScript.ps1
.
Import-Script MyScript
A Pask extension could define its own set of scripts. In fact, Import-Script
does search and import scripts sequentially from any Pask.* package installed in the solution, any Pask.* project in the solution and finally the .build\scripts
directory. Scripts with the same name are equally imported. If the same function is defined in different scripts, it would be overridden by the latter imported.
Example: The function Get-Version is defined in a Pask extension script which is explicitly imported before actually overriding the function.
Import-Script MyScript
function script:Get-Version {
...
}
Example: Import a script explicitly from a Pask extension.
Import-Script MyScript -Package Pask.MyExtension
This script lives in .build\scripts\Pask.ps1
and it is automatically imported exposing a collection of code snippets. It is managed and updated by Pask itself and it should not be modified. Take a peek inside the script to see what you can make use of.
This script comes with Pask package and provides some testing infrastructure utilities.