From fb8566919f6b268b31a9a6af87d72e9d48ae6e75 Mon Sep 17 00:00:00 2001 From: KevinMarquette Date: Sun, 12 Feb 2017 00:21:59 -0800 Subject: [PATCH] Added auto discovery fo files to monitor. --- Chronometer/Public/Get-Chronometer.ps1 | 19 +++++++++++++++---- psake.ps1 | 4 ++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Chronometer/Public/Get-Chronometer.ps1 b/Chronometer/Public/Get-Chronometer.ps1 index cc9d977..7848fb0 100644 --- a/Chronometer/Public/Get-Chronometer.ps1 +++ b/Chronometer/Public/Get-Chronometer.ps1 @@ -13,7 +13,7 @@ function Get-Chronometer param( # Script file to measure execution times on [Parameter(Position=0)] - [string[]] + [object[]] $Path, # Line numbers within the script file to measure @@ -21,12 +21,23 @@ function Get-Chronometer $LineNumber = $null, # The script to start the scrupt or execute other commands - [Parameter(Position=1)] + [Parameter(Position=0)] [alias('Script','CommandScript')] [scriptblock] - $ScriptBlock + $ScriptBlock + ) + if($Path -eq $null) + { + $Path = Get-ChildItem -Recurse -Include *.psm1,*.ps1 -File + } + + if($Path.FullName) + { + $Path = $Path.FullName + } + $Chronometer = [Chronometer]::New() Write-Verbose "Setting breapoints" @@ -36,7 +47,7 @@ function Get-Chronometer { Write-Verbose "Executing Script" [ScriptProfiler]::Start() - [void] $ScriptBlock.Invoke() + [void] $ScriptBlock.Invoke($Path) Write-Verbose "Clearing Breapoints" $Chronometer.ClearBreakpoint() diff --git a/psake.ps1 b/psake.ps1 index 0082ca1..05e1628 100644 --- a/psake.ps1 +++ b/psake.ps1 @@ -52,6 +52,10 @@ Task Test -Depends UnitTests { # In Appveyor? Upload our tests! #Abstract this into a function? If($ENV:BHBuildSystem -eq 'AppVeyor') { + [xml]$content = Get-Content "$ProjectRoot\$TestFile" + $content.'test-results'.'test-suite'.type = "Powershell" + $content.Save("$ProjectRoot\$TestFile") + "Uploading $ProjectRoot\$TestFile to AppVeyor" "JobID: $env:APPVEYOR_JOB_ID" (New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path "$ProjectRoot\$TestFile"))