From 2c08bb2b7ca5bacc570f774af88593043048e850 Mon Sep 17 00:00:00 2001 From: Kevin Marquette Date: Tue, 17 Jul 2018 12:15:47 -0700 Subject: [PATCH] LDX-825 add better module name handling --- BuildTasks/InvokeBuildInit.ps1 | 18 ++++++++++++++++++ Module.build.ps1 | 2 +- Tests/Project/Help.Tests.ps1 | 2 +- Tests/Project/Module.Tests.ps1 | 3 ++- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/BuildTasks/InvokeBuildInit.ps1 b/BuildTasks/InvokeBuildInit.ps1 index 1972500..d0fcb36 100644 --- a/BuildTasks/InvokeBuildInit.ps1 +++ b/BuildTasks/InvokeBuildInit.ps1 @@ -1,9 +1,27 @@ +Write-Verbose "Initializing build variables" + $Script:DocsPath = Join-Path -Path $BuildRoot -ChildPath 'Docs' +Write-Verbose " DocsPath [$DocsPath]" + $Script:Output = Join-Path -Path $BuildRoot -ChildPath 'Output' +Write-Verbose " Output [$Output]" + $Script:Source = Join-Path -Path $BuildRoot -ChildPath $ModuleName +Write-Verbose " Source [$Source]" + $Script:Destination = Join-Path -Path $Output -ChildPath $ModuleName +Write-Verbose " Destination [$Destination]" + $Script:ManifestPath = Join-Path -Path $Destination -ChildPath "$ModuleName.psd1" +Write-Verbose " ManifestPath [$ManifestPath]" + $Script:ModulePath = Join-Path -Path $Destination -ChildPath "$ModuleName.psm1" +Write-Verbose " ModulePath [$ModulePath]" + $Script:Folders = 'Classes', 'Includes', 'Internal', 'Private', 'Public', 'Resources' +Write-Verbose " Folders [$Folders]" + $Script:TestFile = "$BuildRoot\Output\TestResults_PS$PSVersion`_$TimeStamp.xml" +Write-Verbose " TestFile [$TestFile]" + function taskx($Name, $Parameters) { task $Name @Parameters -Source $MyInvocation } diff --git a/Module.build.ps1 b/Module.build.ps1 index ab022b4..69905a5 100644 --- a/Module.build.ps1 +++ b/Module.build.ps1 @@ -1,4 +1,4 @@ -$Script:ModuleName = Split-Path -Leaf $PSScriptRoot +$Script:ModuleName = Get-ChildItem .\*\*.psm1 | Select-object -ExpandProperty BaseName $Script:CodeCoveragePercent = 0.0 # 0 to 1 . $psscriptroot\BuildTasks\InvokeBuildInit.ps1 diff --git a/Tests/Project/Help.Tests.ps1 b/Tests/Project/Help.Tests.ps1 index 84428f7..4465f53 100644 --- a/Tests/Project/Help.Tests.ps1 +++ b/Tests/Project/Help.Tests.ps1 @@ -1,5 +1,5 @@ $Script:ModuleRoot = Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent -$Script:ModuleName = Split-Path -Path $ModuleRoot -Leaf +$Script:ModuleName = $Script:ModuleName = Get-ChildItem $ModuleRoot\*\*.psm1 | Select-object -ExpandProperty BaseName Describe "Public commands have comment-based or external help" -Tags 'Build' { $functions = Get-Command -Module $ModuleName diff --git a/Tests/Project/Module.Tests.ps1 b/Tests/Project/Module.Tests.ps1 index 0cd02e7..f652dc4 100644 --- a/Tests/Project/Module.Tests.ps1 +++ b/Tests/Project/Module.Tests.ps1 @@ -1,5 +1,6 @@ $Script:ModuleRoot = Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent -$Script:ModuleName = Split-Path -Path $ModuleRoot -Leaf +$Script:ModuleName = $Script:ModuleName = Get-ChildItem $ModuleRoot\*\*.psm1 | Select-object -ExpandProperty BaseName + $Script:SourceRoot = Join-Path -Path $ModuleRoot -ChildPath $ModuleName Describe "All commands pass PSScriptAnalyzer rules" -Tag 'Build' {