Skip to content

Commit

Permalink
Package pandoc
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpdp7 committed Mar 9, 2024
1 parent f2020ed commit 9bf52c5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
23 changes: 23 additions & 0 deletions repo/pandoc.ubpkg.sky
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
gh = github_repo("jgm/pandoc")

release = gh.latest_release()
version_str = release.name().removeprefix("v")

(os_str, arch_str) = {
("macos", "aarch64"): ("macOS", "arm64"),
("macos", "x86_64"): ("macOS", "amd64"),
("linux", "x86_64"): ("linux", "amd64"),
("linux", "aarch64"): ("linux", "arm64"),
("windows", "x86_64"): ("windows", "x86_64"),
}[(os, arch)]

archive_format = {
"linux": "tar.gz",
"macos": "zip",
"windows": "zip",
}[os]


asset = release.get_asset_url("pandoc-{version_str}-{os_str}-{arch_str}.{archive_format}".format(version_str=version_str, os_str=os_str, arch_str=arch_str, archive_format=archive_format))

install_binary(extract_from_url(asset, "pandoc-{version}/bin/pandoc".format(version=version_str)), "pandoc")
2 changes: 1 addition & 1 deletion src/github.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fn repo_methods(builder: &mut MethodsBuilder) {
let last_version = versions
.iter()
.filter(|v| {
regex::Regex::new(r"^v[0-9]+\.[0-9]+\.[0-9]+$")
regex::Regex::new(r"^v?[0-9]+(\.[0-9]+)*$")
.unwrap()
.is_match(v)
})
Expand Down

0 comments on commit 9bf52c5

Please sign in to comment.