Skip to content

Commit 5e411d9

Browse files
committed
Removing dot sourcing from function scope and including back to the entire script scope
1 parent 5f5341d commit 5e411d9

File tree

1 file changed

+25
-30
lines changed

1 file changed

+25
-30
lines changed

tools/Repo-Tasks.psm1

Lines changed: 25 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -211,40 +211,35 @@ Runs all the check in tests
211211
msbuild.exe "$env:repoRoot\build.proj" /t:Test
212212
}
213213

214-
Function Init()
214+
<#
215+
We allow users to include any helper powershell scripts they would like to include in the current session
216+
Currently we support two ways to include helper powershell scripts
217+
1) psuserspreferences environment variable
218+
2) $env:USERPROFILE\psFiles directory
219+
We will include all *.ps1 files from any of the above mentioned locations
220+
#>
221+
if([System.IO.Directory]::Exists($env:psuserpreferences))
215222
{
216-
<#
217-
We allow users to include any helper powershell scripts they would like to include in the current session
218-
Currently we support two ways to include helper powershell scripts
219-
1) psuserspreferences environment variable
220-
2) $env:USERPROFILE\psFiles directory
221-
We will include all *.ps1 files from any of the above mentioned locations
222-
#>
223-
if([System.IO.Directory]::Exists($env:psuserpreferences))
224-
{
225-
$userPsFileDir = $env:psuserpreferences
226-
}
227-
elseif([System.IO.Directory]::Exists("$env:USERPROFILE\psFiles"))
228-
{
229-
$userPsFileDir = "$env:USERPROFILE\psFiles"
230-
}
223+
$userPsFileDir = $env:psuserpreferences
224+
}
225+
elseif([System.IO.Directory]::Exists("$env:USERPROFILE\psFiles"))
226+
{
227+
$userPsFileDir = "$env:USERPROFILE\psFiles"
228+
}
231229

232-
if([string]::IsNullOrEmpty($userPsFileDir) -eq $false)
233-
{
234-
Get-ChildItem $userPsFileDir | WHERE {$_.Name -like "*.ps1"} | ForEach {
235-
Write-Host "Including $_" -ForegroundColor Green
236-
. $userPsFileDir\$_
237-
}
238-
}
239-
else
240-
{
241-
Write-Host "Loading skipped. 'psuserpreferences' environment variable was not set to load user preferences." -ForegroundColor DarkYellow
242-
}
230+
if([string]::IsNullOrEmpty($userPsFileDir) -eq $false)
231+
{
232+
Get-ChildItem $userPsFileDir | WHERE {$_.Name -like "*.ps1"} | ForEach {
233+
Write-Host "Including $_" -ForegroundColor Green
234+
. $userPsFileDir\$_
235+
}
236+
}
237+
else
238+
{
239+
Write-Host "Loading skipped. 'psuserpreferences' environment variable was not set to load user preferences." -ForegroundColor DarkYellow
243240
}
244241

245242
export-modulemember -Function Set-TestEnvironment
246243
export-modulemember -Function Get-BuildScopes
247244
export-modulemember -Function Start-Build
248-
export-modulemember -Function Invoke-CheckinTests
249-
250-
Init
245+
export-modulemember -Function Invoke-CheckinTests

0 commit comments

Comments
 (0)