Skip to content

Commit

Permalink
Merge pull request #2409 from TheCakeIsNaOH/mkdocs-material
Browse files Browse the repository at this point in the history
  • Loading branch information
AdmiringWorm authored Jan 22, 2024
2 parents 53c9be1 + 0c0d1cd commit 4f601ed
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions automatic/mkdocs-material/update.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,24 @@ function global:au_GetLatest {

$download_page = Invoke-WebRequest -UseBasicParsing -Uri "https://github.com/squidfunk/mkdocs-material/raw/${version}/requirements.txt"
if ($download_page.content -match "mkdocs>=(\d+\.[\d\.]+)") {
$dependencyVersion = $matches[1]
$dependencyVersion = $matches[1]
} elseif ($download_page.content -match "mkdocs~=(\d+\.[\d\.]+)") {
# Case for compatible version syntax.
$minimumVersion = $matches[1]
[int]$majorVersion = $minimumVersion -split "\." | Select-Object -First 1
$minimumVersionParts = ($minimumVersion -split "\.").count
if ($minimumVersionParts -eq 2) {
$nextMajorVersion = $majorVersion + 1
$dependencyVersion = "[$minimumVersion,$nextMajorVersion.0.0)"
} elseif ($minimumVersionParts -eq 3) {
[int]$minorVersion = $minimumVersion -split "\." | Select-Object -First 1 -Skip 1
$nextMinorVersion = $minorVersion + 1
$dependencyVersion = "[$minimumVersion,$majorVersion.$nextMinorVersion.0)"
} else {
throw "Invalid number of minimum version parts '$minimumVersionParts'"
}
} else {
throw "Mkdocs dependency version was not found"
throw "Mkdocs dependency version was not found"
}

return @{ Version = $version; MkDocsDep = $dependencyVersion }
Expand Down

0 comments on commit 4f601ed

Please sign in to comment.