@@ -27,6 +27,7 @@ public class SyntaxChangelogGenerator
27
27
public void Analyze ( String rootDirectory )
28
28
{
29
29
var srcDirs = Path . Combine ( rootDirectory , @"src\" ) ;
30
+ var toolsCommonDirs = Path . Combine ( rootDirectory , @"tools\Tools.Common" ) ;
30
31
var manifestFiles = Directory . EnumerateFiles ( srcDirs , "*.psd1" , SearchOption . AllDirectories )
31
32
. Where ( file =>
32
33
! Path . GetDirectoryName ( file )
@@ -43,13 +44,13 @@ public void Analyze(String rootDirectory)
43
44
var executingPath = Path . GetDirectoryName ( new Uri ( Assembly . GetExecutingAssembly ( ) . Location ) . AbsolutePath ) ;
44
45
Directory . SetCurrentDirectory ( executingPath ) ;
45
46
var newModuleMetadata = MetadataLoader . GetModuleMetadata ( moduleName ) ;
46
- var filePath = Path . Combine ( executingPath , "SerializedCmdlets" , $ "{ moduleName } .json") ;
47
+ var filePath = Path . Combine ( toolsCommonDirs , "SerializedCmdlets" , $ "{ moduleName } .json") ;
47
48
if ( ! File . Exists ( filePath ) ) continue ;
48
49
var oldModuleMetadata = ModuleMetadata . DeserializeCmdlets ( filePath ) ;
49
- CmdletLoader . ModuleMetadata = newModuleMetadata ;
50
+ CmdletLoader . ModuleMetadata = oldModuleMetadata ;
50
51
CompareModuleMetedata ( oldModuleMetadata , newModuleMetadata , moduleName ) ;
51
52
}
52
- var markDownPath = Path . Combine ( rootDirectory , "documentation/SyntaxChangeLog/SyntaxChangeLog.md" ) ;
53
+ var markDownPath = Path . Combine ( rootDirectory , @ "documentation/SyntaxChangeLog/SyntaxChangeLog.md") ;
53
54
GenerateMarkdown ( markDownPath ) ;
54
55
Console . WriteLine ( "Cmdlets Differences written to {0}" , markDownPath ) ;
55
56
}
@@ -410,25 +411,26 @@ public void GenerateMarkdown(string filePath)
410
411
{
411
412
if ( diffInfo [ i ] . Type == ChangeType . CmdletAdd )
412
413
{
413
- if ( diffInfo [ i ] . Type == diffInfo [ i - 1 ] . Type ) {
414
+ if ( i != 0 && diffInfo [ i ] . Type == diffInfo [ i - 1 ] . Type ) {
414
415
sb . AppendFormat ( ", `{0}`" , diffInfo [ i ] . CmdletName ) ;
415
- if ( i + 1 == diffInfo . Count || diffInfo [ i ] . Type != diffInfo [ i + 1 ] . Type ) {
416
- sb . AppendFormat ( "\n " ) ;
417
- }
418
416
} else {
419
417
sb . AppendFormat ( "* Added cmdlet `{0}`" , diffInfo [ i ] . CmdletName ) ;
420
418
}
419
+ if ( i + 1 == diffInfo . Count || diffInfo [ i ] . Type != diffInfo [ i + 1 ] . Type ) {
420
+ sb . AppendFormat ( "\n " ) ;
421
+ }
421
422
}
422
423
else if ( diffInfo [ i ] . Type == ChangeType . CmdletRemove )
423
424
{
424
- if ( diffInfo [ i ] . Type == diffInfo [ i - 1 ] . Type ) {
425
+ if ( i != 0 && diffInfo [ i ] . Type == diffInfo [ i - 1 ] . Type ) {
425
426
sb . AppendFormat ( ", `{0}`" , diffInfo [ i ] . CmdletName ) ;
426
- if ( i + 1 == diffInfo . Count || diffInfo [ i ] . Type != diffInfo [ i + 1 ] . Type ) {
427
- sb . AppendFormat ( "\n " ) ;
428
- }
427
+
429
428
} else {
430
429
sb . AppendFormat ( "* Removed cmdlet `{0}`" , diffInfo [ i ] . CmdletName ) ;
431
430
}
431
+ if ( i + 1 == diffInfo . Count || diffInfo [ i ] . Type != diffInfo [ i + 1 ] . Type ) {
432
+ sb . AppendFormat ( "\n " ) ;
433
+ }
432
434
}
433
435
else
434
436
{
@@ -518,7 +520,7 @@ private string GetDescription_ParameterTypeChange(CmdletDiffInformation info)
518
520
}
519
521
private string GetDescription_ParameterAttributeChange ( CmdletDiffInformation info )
520
522
{
521
- return $ "Parameter `-{ info . ParameterName } ` ValidateNotNullOrEmpty changed from { info . Before [ 0 ] } to { info . After [ 0 ] } ";
523
+ return $ "Parameter `-{ info . ParameterName } ` ValidateNotNullOrEmpty changed from ` { info . Before [ 0 ] } ` to ` { info . After [ 0 ] } ` ";
522
524
}
523
525
524
526
private string GetDescription_OutputTypeChange ( CmdletDiffInformation info )
@@ -540,6 +542,7 @@ public string GetDescription(CmdletDiffInformation info)
540
542
mapper . Add ( ChangeType . ParameterAliasRemove , GetDescription_ParameterAliasRemove ) ;
541
543
mapper . Add ( ChangeType . ParameterTypeChange , GetDescription_ParameterTypeChange ) ;
542
544
mapper . Add ( ChangeType . OutputTypeChange , GetDescription_OutputTypeChange ) ;
545
+ mapper . Add ( ChangeType . ParameterAttributeChange , GetDescription_ParameterAttributeChange ) ;
543
546
544
547
if ( mapper . ContainsKey ( info . Type ) )
545
548
{
0 commit comments