I just pushed up new code in psake.psm1 that looks for a file called
psake-config.ps1 and dot-sources it if its found. The function is
called once when the psake.psm1 module is loaded.
function Load-Configuration
{
if (test-path ".\psake-config.ps1")
{
. .\psake-config.ps1
}
else
{
$psake.config = new-object psobject -property @{
defaultbuildfilename="default.ps1";
tasknameformat="Executing {0}";
exitcode="1";
modules=(new-object psobject -property @{ autoload=$true;
directory=".\modules" })
}
}
}
-----------------------------------------------------------------------------------------------------------------------
The contents of the psake-config.ps1 looks like the following:
-----------------------------------------------------------------------------------------------------------------------
$psake.config = new-object psobject -property @{
defaultbuildfilename="default.ps1";
tasknameformat="Executing {0}";
exitcode="1";
modules=(new-object psobject -property @{ autoload=$true;
directory=".\modules" })
}
<#
$psake.config = new-object psobject -property @{
defaultbuildfilename="default.ps1";
tasknameformat="Executing {0}";
exitcode="1";
modules=(new-object psobject -property @{
autoload=$false;
module=(new-object psobject -property @{path="c:\module1dir
\module1.ps1"}),
(new-object psobject -property @{path="c:\module1dir
\module2.ps1"})
})
}
#>
-----------------------------------------------------------------------------------------------------------------------
The commented out code above is the code you would use to explicitly
load modules instead of autoloading modules from a folder.
I think the code in Load-Configuration probably needs a try/catch in
case the code in psake-config.ps1 throws an error.
I will add help on the wiki to explain how configuration works in
detail (assuming everyone is ok with this code).