From 9d135137d6cfba5ab371f686285f0d634bcd9ff6 Mon Sep 17 00:00:00 2001 From: Sergey Mazurkin Date: Thu, 3 May 2018 15:08:26 +0300 Subject: [PATCH] 1.1.0 --- CHANGELOG.md | 8 +++ README.md | 3 +- tests/ModuleManifest.Tests.ps1 | 43 ---------------- .../{nuspec.Tests.ps1 => manifests.Tests.ps1} | 51 ++++++++++++++++++- ...t.Tests.ps1 => psScriptAnalyzer.Tests.ps1} | 0 xpoTools.nuspec | 13 +++-- xpoTools/classes/classes.ps1 | 1 - xpoTools/functions/Import-Xpo.ps1 | 14 +---- xpoTools/functions/Split-Xpo.ps1 | 8 ++- xpoTools/xpoTools.psd1 | 13 +++-- 10 files changed, 86 insertions(+), 68 deletions(-) delete mode 100644 tests/ModuleManifest.Tests.ps1 rename tests/{nuspec.Tests.ps1 => manifests.Tests.ps1} (52%) rename tests/{Project.Tests.ps1 => psScriptAnalyzer.Tests.ps1} (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 29d3f55..5b12c81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ All notable changes to the project [https://github.com/mazzy-ax/xpoTools](https://github.com/mazzy-ax/xpoTools) will be documented in this file. See also [https://github.com/mazzy-ax/xpoTools/releases](https://github.com/mazzy-ax/xpoTools/releases). +## [1.1.0](https://github.com/mazzy-ax/xpoTools/compare/1.0.1...1.1.0) - 2018-05-03 + +* To increase a general performance: + * moved: the generation of xpp-files is moved from `xpo-import` to `split-xpo` cmdlet + * removed: the `xpptext` property from class [xpoItem] is unused and have removed + +* Small updated for README and tests of the project meta. + ## [1.0.1](https://github.com/mazzy-ax/xpoTools/compare/1.0.0...1.0.1) - 2018-04-23 * Added object types for ax2012 in `Get-XpoType.ps1`. #1 closed. diff --git a/README.md b/README.md index 50e6a47..d3e380e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # xpoTools -![version](https://img.shields.io/badge/version-1.0.1-green.svg) ![license](https://img.shields.io/badge/license-MIT-blue.svg) +![version](https://img.shields.io/badge/version-1.1.0-green.svg) ![license](https://img.shields.io/badge/license-MIT-blue.svg) [xpoTools](https://github.com/mazzy-ax/xpoTools) is a Powershell module contains cmdlets that splits one XPO file into separate XPO files and combines a set of set of interdependent XPO files into a single XPO file. @@ -15,7 +15,6 @@ XPO file is a text file contains Microsoft Dynamics AX (Axapta) objects. See [te * include and exclude files based on a file name. For example, to exclude `DEL_` objects * filter AOT objects based on a text within XPO elements * uses Encoding parameter -* It have designed for parallel processing. See [examples/parallel-split.ps1](examples/parallel-split.ps1) folder. ## Thanks diff --git a/tests/ModuleManifest.Tests.ps1 b/tests/ModuleManifest.Tests.ps1 deleted file mode 100644 index ee1ecc7..0000000 --- a/tests/ModuleManifest.Tests.ps1 +++ /dev/null @@ -1,43 +0,0 @@ -$projectRoot = Resolve-Path $PSScriptRoot\.. -$moduleRoot = Split-Path (Resolve-Path $projectRoot\*\*.psd1) -$moduleName = Split-Path $moduleRoot -Leaf - -$script:manifest = $null - -Describe 'Nuget specification Tests' -Tag 'Meta' { - - It 'Passes Test-ModuleManifest' { - $script:manifest = Test-ModuleManifest -Path $moduleRoot\$moduleName.psd1 - $? | Should -Be $true - } - - It 'has a valid nuspec file' { - $file = Resolve-Path $projectRoot\$moduleName.nuspec - [xml]$script:nuspec = Get-Content $file - $nuspec | Should Not BeNullOrEmpty - } - - It 'has a valid id' { - $nuspec.package.metadata.id | Should Be ($moduleName) - } - - It 'nuspec and manifest descriptions are same' { - $nuspec.package.metadata.Description | Should Be ($manifest.Description) - } - - It 'nuspec and manifest release notes are same' { - $nuspecReleaseNotes = $nuspec.package.metadata.ReleaseNotes -replace '\s' - $manifestReleaseNotes = $manifest.PrivateData.PSData.ReleaseNotes -replace '\s' - - $nuspecReleaseNotes -eq $manifestReleaseNotes | Should Be $true - } - - It 'nuspec and manifest projectUrl are same' { - $nuspec.package.metadata.projectUrl | Should Be ($manifest.PrivateData.PSData.ProjectUri) - } - - It 'nuspec and manifest licenseUrl notes are same' { - $nuspec.package.metadata.licenseUrl | Should Be ($manifest.PrivateData.PSData.LicenseUri) - } - -} \ No newline at end of file diff --git a/tests/nuspec.Tests.ps1 b/tests/manifests.Tests.ps1 similarity index 52% rename from tests/nuspec.Tests.ps1 rename to tests/manifests.Tests.ps1 index a478f5c..16b1977 100644 --- a/tests/nuspec.Tests.ps1 +++ b/tests/manifests.Tests.ps1 @@ -3,10 +3,13 @@ $moduleRoot = Split-Path (Resolve-Path $projectRoot\*\*.psd1) $moduleName = Split-Path $moduleRoot -Leaf $changelog = 'CHANGELOG.md' +$readme = 'README.md' + +$script:manifest = $null Describe 'Module Manifest Tests' -Tag 'Meta' { - It 'Passes Test-ModuleManifest' { + It 'has a valid module manifest file' { $script:manifest = Test-ModuleManifest -Path $moduleRoot\$moduleName.psd1 $? | Should -Be $true } @@ -55,4 +58,50 @@ Describe 'Module Manifest Tests' -Tag 'Meta' { $manifest.Version -as [Version] | Should be ( $ChangelogVersion -as [Version] ) } +} + +Describe 'Nuget specification Tests' -Tag 'Meta' { + + It 'has a valid nuspec file' { + $file = Resolve-Path $projectRoot\$moduleName.nuspec + [xml]$script:nuspec = Get-Content $file + $nuspec | Should Not BeNullOrEmpty + } + + It 'has a valid id' { + $nuspec.package.metadata.id | Should Be ($moduleName) + } + + It 'nuspec and manifest descriptions are same' { + $nuspec.package.metadata.Description | Should Be ($manifest.Description) + } + + It 'nuspec and manifest release notes are same' { + $nuspecReleaseNotes = $nuspec.package.metadata.ReleaseNotes -replace '\s' + $manifestReleaseNotes = $manifest.PrivateData.PSData.ReleaseNotes -replace '\s' + + $nuspecReleaseNotes | Should Be $manifestReleaseNotes + } + + It 'nuspec and manifest projectUrl are same' { + $nuspec.package.metadata.projectUrl | Should Be ($manifest.PrivateData.PSData.ProjectUri) + } + + It 'nuspec and manifest licenseUrl notes are same' { + $nuspec.package.metadata.licenseUrl | Should Be ($manifest.PrivateData.PSData.LicenseUri) + } + +} + +Describe 'README.md Tests' -Tag 'Meta' { + + It "has a valid shields.io/badge/version in the $readme file" { + Get-Content -Path $projectRoot\README.md | + Where-Object { $_ -match '\!\[version\]\(https://img\.shields\.io/badge/version-(?(\d+\.){1,3}\d+)-green\.svg\)' } | + Select-Object -First 1 | Should Not BeNullOrEmpty + + $ReadmeVersion = $matches.Version + $ReadmeVersion | Should Be $manifest.Version + } + } \ No newline at end of file diff --git a/tests/Project.Tests.ps1 b/tests/psScriptAnalyzer.Tests.ps1 similarity index 100% rename from tests/Project.Tests.ps1 rename to tests/psScriptAnalyzer.Tests.ps1 diff --git a/xpoTools.nuspec b/xpoTools.nuspec index 6a8578f..a1c0603 100644 --- a/xpoTools.nuspec +++ b/xpoTools.nuspec @@ -2,17 +2,24 @@ xpoTools - 1.0.1 + 1.1.0 Sergey Mazurkin https://github.com/mazzy-ax/xpoTools/blob/master/LICENSE https://github.com/mazzy-ax/xpoTools false Powershell cmdlets to split and to merge XPO files contains AOT objects of Microsoft Dynamics AX (Axapta) 3.0, 4.0, 2009, 2012 +## 1.1.0 + +To increase a general performance: + +* moved: the generation of xpp-files is moved from xpo-import to split-xpo cmdlet +* removed: the xpptext property from class [xpoItem] is unused and have removed + ## 1.0.1 -* Added object types for ax2012 in `Get-XpoType.ps1`. See #1 -* Fixed couple bugs and type in `Select-FileName.ps1`, `parallel-split.ps1` and `Import-Xpo.ps1` +* Added object types for ax2012 in Get-XpoType.ps1. See #1 +* Fixed couple bugs and type in Select-FileName.ps1, parallel-split.ps1 and Import-Xpo.ps1 * Fixed readme.md xpo split merge Axapta Microsoft Dynamics AX diff --git a/xpoTools/classes/classes.ps1 b/xpoTools/classes/classes.ps1 index 63a9f6a..cdcabcd 100644 --- a/xpoTools/classes/classes.ps1 +++ b/xpoTools/classes/classes.ps1 @@ -47,7 +47,6 @@ class xpoItem { } [xpoNode[]]$Node - [string[]]$xppText [xpoNode[]]$Group [xpoNode[]]$GroupNode diff --git a/xpoTools/functions/Import-Xpo.ps1 b/xpoTools/functions/Import-Xpo.ps1 index 54fca78..34c59e7 100644 --- a/xpoTools/functions/Import-Xpo.ps1 +++ b/xpoTools/functions/Import-Xpo.ps1 @@ -30,7 +30,7 @@ function Import-Xpo { $Texts = Get-Content $xpoFile.FullName -Delimiter '***Element: ' -Encoding $Encoding - if ( $Texts.Length -gt 2 -and $Texts[-1] -match 'END\s+$' ) { + if ( $Texts -and $Texts.Length -gt 2 -and $Texts[-1] -match 'END\s+$' ) { $FileHeader = $Texts[0] $Items = $Texts | @@ -48,18 +48,6 @@ function Import-Xpo { Write-Progress -Activity $funcName -Completed - # TODO [performance]: is it need parallel threads for next sentense? - - $Items | Where-Object { $_ -and $_.Type.Tag -EQ 'CLS' } | ForEach-Object { - Write-Verbose "$funcName converts xpo to xpp $_" - $_.xppText = $_.Text | Select-Source | Select-xppClass - } - - $Items | Where-Object { $_ -and $_.Type.Tag -EQ 'JOB' } | ForEach-Object { - Write-Verbose "$funcName converts xpo to xpp $_" - $_.xppText = $_.Text | Select-Source | Select-Object -First 1 -ExpandProperty Text | Select-TextLine - } - $Nodes = $Items | Where-Object { $_ -and $_.Type.Tag -EQ 'PRN' } | ForEach-Object { Write-Verbose "$funcName collects nodes for the project $_" $_.GroupNode = $_ | select-ProjectGroup | select-ProjectNode diff --git a/xpoTools/functions/Split-Xpo.ps1 b/xpoTools/functions/Split-Xpo.ps1 index 4426eee..3589dc8 100644 --- a/xpoTools/functions/Split-Xpo.ps1 +++ b/xpoTools/functions/Split-Xpo.ps1 @@ -59,9 +59,13 @@ function Split-Xpo { $Item = $_ - if ( $xpp -and $Item.xppText ) { + if ( $xpp -and $Item.Type.Tag -eq 'CLS' ) { $Ext = '.xpp' - $s = $Item.xppText + $s = $Item.Text | Select-Source | Select-xppClass + } + elseif( $xpp -and $Item.Type.Tag -eq 'JOB' ) { + $Ext = '.xpp' + $s = $Item.Text | Select-Source | Select-Object -First 1 -ExpandProperty Text | Select-TextLine } else { $Ext = '.xpo' diff --git a/xpoTools/xpoTools.psd1 b/xpoTools/xpoTools.psd1 index 36d38d2..d4e9af8 100644 --- a/xpoTools/xpoTools.psd1 +++ b/xpoTools/xpoTools.psd1 @@ -7,7 +7,7 @@ RootModule = 'xpoTools.psm1' # Version number of this module. -ModuleVersion = '1.0.1' +ModuleVersion = '1.1.0' # Supported PSEditions # CompatiblePSEditions = @() @@ -103,10 +103,17 @@ PrivateData = @{ # ReleaseNotes of this module ReleaseNotes = @' +## 1.1.0 + +To increase a general performance: + +* moved: the generation of xpp-files is moved from xpo-import to split-xpo cmdlet +* removed: the xpptext property from class [xpoItem] is unused and have removed + ## 1.0.1 -* Added object types for ax2012 in `Get-XpoType.ps1`. See #1 -* Fixed couple bugs and type in `Select-FileName.ps1`, `parallel-split.ps1` and `Import-Xpo.ps1` +* Added object types for ax2012 in Get-XpoType.ps1. See #1 +* Fixed couple bugs and type in Select-FileName.ps1, parallel-split.ps1 and Import-Xpo.ps1 * Fixed readme.md '@