Skip to content

Instantly share code, notes, and snippets.

@martin9700
Last active October 12, 2015 01:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save martin9700/4e5ff4f7e20e03b52ad9 to your computer and use it in GitHub Desktop.
Save martin9700/4e5ff4f7e20e03b52ad9 to your computer and use it in GitHub Desktop.
$Manifest = Invoke-Expression -Command (Get-Content $OutManifest -Raw)
$LastChange = (Get-ChildItem $OutManifest).CreationTime
$ChangedFiles = ($Files | Where LastWriteTime -gt $LastChange).Count
$PercentChange = 100 - ((($Files.Count - $ChangedFiles) / $Files.Count) * 100)
$Version = ([version]$Manifest["ModuleVersion"]) | Select Major,Minor,Build,Revision
If ($PercentChange -ge 50)
{
$Version.Major ++
$Version.Minor = 0
$Version.Build = 0
$Version.Revision = 0
}
ElseIf ($PercentChange -ge 25)
{
$Version.Minor ++
$Version.Build = 0
$Version.Revision = 0
}
ElseIf ($PercentChagne -ge 10)
{
$Version.Build ++
$Version.Revision = 0
}
ElseIf ($PercentChange -gt 0)
{
$Version.Revision ++
}
$Manifest["ModuleVersion"] = "$($Version.Major).$($Version.Minor).$($Version.Build).$($Version.Revision)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment