< Back
Get-BuildEnvironment
Post
NAME Get-BuildEnvironment
SYNOPSIS
Get normalized build system and project details
SYNTAX
Get-BuildEnvironment [[-Path] <Object>] [[-BuildOutput] <String>] [[-GitPath] <String>] [[-As] <String>]
[<CommonParameters>]
DESCRIPTION
Get normalized build system and project details
Returns the following details:
ProjectPath via Get-BuildVariable
BranchName via Get-BuildVariable
CommitMessage via Get-BuildVariable
CommitHash via Get-BuildVariable
BuildNumber via Get-BuildVariable
ProjectName via Get-ProjectName
PSModuleManifest via Get-PSModuleManifest
ModulePath via Split-Path on PSModuleManifest
BuildOutput via BuildOutput parameter
PARAMETERS
-Path <Object>
Path to project root. Defaults to the current working path
Required? false
Position? 1
Default value $PWD.Path
Accept pipeline input? false
Accept wildcard characters? false
-BuildOutput <String>
Specify a path to use for build output. Defaults to '$ProjectPath\\BuildOutput'
You may use build variables produced in this same call. Refer to them as variables, with a literal (escaped) $
Examples:
-BuildOutput '$ProjectPath\\BuildOutput'
-BuildOutput 'C:\\Build'
-BuildOutput 'C:\\Builds\\$ProjectName'
Required? false
Position? 2
Default value $ProjectPath\\BuildOutput
Accept pipeline input? false
Accept wildcard characters? false
-GitPath <String>
Path to git. Defaults to git (i.e. git is in $ENV:PATH)
Required? false
Position? 3
Default value
Accept pipeline input? false
Accept wildcard characters? false
-As <String>
Required? false
Position? 4
Default value object
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
NOTES
We assume you are in the project root, for several of the fallback options
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Get-BuildEnvironment
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Get-BuildEnvironment -Path C:\\sc\\PSDepend -BuildOutput 'C:\\Builds\\$ProjectName'
# Get BuildEnvironment pointing at C:\\sc\\PSDepend
# Assuming ProjectName evaluates to PSDepend, BuildOutput will be set to C:\\Builds\\PSDepend
RELATED LINKS
https://github.com/RamblingCookieMonster/BuildHelpers
Get-BuildVariable
Set-BuildEnvironment
Get-ProjectName
about_BuildHelpers
SYNOPSIS
Get normalized build system and project details
SYNTAX
Get-BuildEnvironment [[-Path] <Object>] [[-BuildOutput] <String>] [[-GitPath] <String>] [[-As] <String>]
[<CommonParameters>]
DESCRIPTION
Get normalized build system and project details
Returns the following details:
ProjectPath via Get-BuildVariable
BranchName via Get-BuildVariable
CommitMessage via Get-BuildVariable
CommitHash via Get-BuildVariable
BuildNumber via Get-BuildVariable
ProjectName via Get-ProjectName
PSModuleManifest via Get-PSModuleManifest
ModulePath via Split-Path on PSModuleManifest
BuildOutput via BuildOutput parameter
PARAMETERS
-Path <Object>
Path to project root. Defaults to the current working path
Required? false
Position? 1
Default value $PWD.Path
Accept pipeline input? false
Accept wildcard characters? false
-BuildOutput <String>
Specify a path to use for build output. Defaults to '$ProjectPath\\BuildOutput'
You may use build variables produced in this same call. Refer to them as variables, with a literal (escaped) $
Examples:
-BuildOutput '$ProjectPath\\BuildOutput'
-BuildOutput 'C:\\Build'
-BuildOutput 'C:\\Builds\\$ProjectName'
Required? false
Position? 2
Default value $ProjectPath\\BuildOutput
Accept pipeline input? false
Accept wildcard characters? false
-GitPath <String>
Path to git. Defaults to git (i.e. git is in $ENV:PATH)
Required? false
Position? 3
Default value
Accept pipeline input? false
Accept wildcard characters? false
-As <String>
Required? false
Position? 4
Default value object
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
NOTES
We assume you are in the project root, for several of the fallback options
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Get-BuildEnvironment
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Get-BuildEnvironment -Path C:\\sc\\PSDepend -BuildOutput 'C:\\Builds\\$ProjectName'
# Get BuildEnvironment pointing at C:\\sc\\PSDepend
# Assuming ProjectName evaluates to PSDepend, BuildOutput will be set to C:\\Builds\\PSDepend
RELATED LINKS
https://github.com/RamblingCookieMonster/BuildHelpers
Get-BuildVariable
Set-BuildEnvironment
Get-ProjectName
about_BuildHelpers