-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eae7a1a
commit fc2f448
Showing
16 changed files
with
225 additions
and
240 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,11 @@ | ||
. "${PSScriptRoot}\Config.ps1" | ||
. "${PSScriptRoot}\Register.PrivateComponents.ps1" | ||
|
||
foreach ($script in $ModuleInfo.ScriptsToExport) { | ||
. $script.FullName | ||
} | ||
Get-Item "${PSScriptRoot}\Public\*.ps1" | ForEach-Object { . $_.FullName } | ||
|
||
# Avoid to export all components in the module by `Import-Module *.psm1` | ||
# There's no contradiction with *.psd1. | ||
Export-ModuleMember ` | ||
-Function $ModuleInfo.FunctionsToExport ` | ||
-Cmdlet $ModuleInfo.CmdletsToExport ` | ||
-Variable $ModuleInfo.VariablesToExport ` | ||
-Alias $ModuleInfo.AliasesToExport | ||
-Function $local:ModuleInfo.FunctionsToExport ` | ||
-Cmdlet $local:ModuleInfo.CmdletsToExport ` | ||
-Variable $local:ModuleInfo.VariablesToExport ` | ||
-Alias $local:ModuleInfo.AliasesToExport |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
function Get-PreReleaseString{ | ||
<# | ||
.DESCRIPTION | ||
Get the pre-release string from a release note file. | ||
.INPUTS | ||
A release note file path. | ||
.OUTPUTS | ||
A string of the pre-release string. | ||
#> | ||
[OutputType([string])] | ||
param( | ||
[Parameter(Mandatory)] | ||
[string]$ReleaseNotesPath | ||
) | ||
$release_title = Get-Content $ReleaseNotesPath | Select-String -Pattern "^## " | Select-Object -First 1 | ||
if ($release_title -match 'v([\d]+\.[\d]+\.[\d]+)[\-]*(.*)'){ | ||
$pre_release_string = $Matches[2] | ||
if ($pre_release_string -match 'beta[\d+]|stable'){ | ||
$result = $pre_release_string.ToLower() | ||
if ($result -eq 'stable'){ | ||
return '' # stable version should not have pre-release string | ||
} | ||
else{ | ||
return $result | ||
} | ||
} | ||
else{ | ||
throw "[Invalid pre-release string] The pre-release string in $ReleaseNotesPath is $pre_release_string, but it should one be 'stable' or 'beta0', 'beta1' etc." | ||
} | ||
}else{ | ||
return '' | ||
} | ||
} | ||
|
||
function Assert-ReleaseVersionConsistency{ | ||
<# | ||
.DESCRIPTION | ||
Assert if the release version in the release note file is consistent with the given version. | ||
.PARAMETER Version | ||
The version. | ||
.PARAMETER ReleaseNotesPath | ||
The release note file path. | ||
.OUTPUTS | ||
None. | ||
#> | ||
param( | ||
[Parameter(Mandatory)] | ||
[string]$Version, | ||
[Parameter(Mandatory)] | ||
[string]$ReleaseNotesPath | ||
) | ||
|
||
$release_title = Get-Content $ReleaseNotesPath | Select-String -Pattern "^# " | Select-Object -First 1 | ||
if ($release_title -match 'v([\d]+\.[\d]+\.[\d]+)'){ | ||
$release_version = $Matches[1] | ||
if (!($release_version -ceq $Version)){ | ||
throw "[Imcompatible version] The newest version in $ReleaseNotesPath is $release_version, but it should be $Version." | ||
} | ||
}else{ | ||
throw "[Invalid release title] The release title in $ReleaseNotesPath is $release_title, but it should be like '# xxx v0.0.1'." | ||
} | ||
} |
Oops, something went wrong.