Skip to content
This repository has been archived by the owner on Mar 9, 2021. It is now read-only.

Commit

Permalink
Updated psake
Browse files Browse the repository at this point in the history
  • Loading branch information
erik-kallen committed Oct 5, 2014
1 parent e57b442 commit 9e6dbc4
Show file tree
Hide file tree
Showing 2 changed files with 284 additions and 114 deletions.
28 changes: 15 additions & 13 deletions build/psake.ps1
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Helper script for those who want to run psake without importing the module.
# Example:
# Example run from PowerShell:
# .\psake.ps1 "default.ps1" "BuildHelloWord" "4.0"

# Must match parameter definitions for psake.psm1/invoke-psake
# otherwise named parameter binding fails
param(
[Parameter(Position=0,Mandatory=0)]
[string]$buildFile = 'default.ps1',
[string]$buildFile,
[Parameter(Position=1,Mandatory=0)]
[string[]]$taskList = @(),
[Parameter(Position=2,Mandatory=0)]
Expand All @@ -18,17 +18,20 @@ param(
[Parameter(Position=5, Mandatory=0)]
[System.Collections.Hashtable]$properties = @{},
[Parameter(Position=6, Mandatory=0)]
[switch]$nologo = $false,
[alias("init")]
[scriptblock]$initialization = {},
[Parameter(Position=7, Mandatory=0)]
[switch]$help = $false,
[switch]$nologo = $false,
[Parameter(Position=8, Mandatory=0)]
[string]$scriptPath = $(Split-Path -parent $MyInvocation.MyCommand.path)
[switch]$help = $false,
[Parameter(Position=9, Mandatory=0)]
[string]$scriptPath
)

$currentThread = [System.Threading.Thread]::CurrentThread
$invariantCulture = [System.Globalization.CultureInfo]::InvariantCulture
$currentThread.CurrentCulture = $invariantCulture
$currentThread.CurrentUICulture = $invariantCulture
# setting $scriptPath here, not as default argument, to support calling as "powershell -File psake.ps1"
if (!$scriptPath) {
$scriptPath = $(Split-Path -parent $MyInvocation.MyCommand.path)
}

# '[p]sake' is the same as 'psake' but $Error is not polluted
remove-module [p]sake
Expand All @@ -38,12 +41,11 @@ if ($help) {
return
}

if (-not(test-path $buildFile)) {
if ($buildPath -and (-not(test-path $buildFile))) {
$absoluteBuildFile = (join-path $scriptPath $buildFile)
if (test-path $absoluteBuildFile) {
if (test-path $absoluteBuildFile) {
$buildFile = $absoluteBuildFile
}
}

invoke-psake $buildFile $taskList $framework $docs $parameters $properties $nologo
exit $LastExitCode
Invoke-psake $buildFile $taskList $framework $docs $parameters $properties $initialization $nologo
Loading

0 comments on commit 9e6dbc4

Please sign in to comment.