Skip to content

Commit

Permalink
fix(taplo): rename files to match upstream (#613)
Browse files Browse the repository at this point in the history
Co-authored-by: William Boman <william@redwill.se>
  • Loading branch information
ishigoemon and williamboman committed Nov 1, 2022
1 parent f466ced commit f01129e
Showing 1 changed file with 33 additions and 21 deletions.
54 changes: 33 additions & 21 deletions lua/mason-registry/taplo/init.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
local Pkg = require "mason-core.package"
local cargo = require "mason-core.managers.cargo"
local github = require "mason-core.managers.github"
local _ = require "mason-core.functional"
local platform = require "mason-core.platform"
local std = require "mason-core.managers.std"

local coalesce, when = _.coalesce, _.when

Expand All @@ -15,25 +15,37 @@ return Pkg.new {
---@async
---@param ctx InstallContext
install = function(ctx)
local asset_file = coalesce(
when(platform.is.mac, "taplo-full-x86_64-apple-darwin-gnu.tar.gz"),
when(platform.is.linux_x64, "taplo-full-x86_64-unknown-linux-gnu.tar.gz")
)
if asset_file then
github
.untargz_release_file({
repo = "tamasfe/taplo",
asset_file = asset_file,
})
.with_receipt()
ctx:link_bin("taplo", "taplo")
else
cargo
.install("taplo-cli", {
features = "lsp,toml-test",
bin = { "taplo" },
})
.with_receipt()
end
platform.when {
unix = function()
github
.gunzip_release_file({
repo = "tamasfe/taplo",
asset_file = coalesce(
when(platform.is.mac_arm64, "taplo-full-darwin-aarch64.gz"),
when(platform.is.mac_x64, "taplo-full-darwin-x86_64.gz"),
when(platform.is.linux_x64, "taplo-full-linux-x86_64.gz"),
when(platform.is.linux_x86, "taplo-full-linux-x86.gz"),
when(platform.is.linux_arm64, "taplo-full-linux-aarch64.gz")
),
out_file = "taplo",
})
.with_receipt()
std.chmod("+x", { "taplo" })
ctx:link_bin("taplo", "taplo")
end,
win = function()
github
.unzip_release_file({
repo = "tamasfe/taplo",
asset_file = coalesce(
when(platform.is.win_x64, "taplo-full-windows-x86_64.zip"),
when(platform.is.win_x86, "taplo-full-windows-x86.zip")
),
out_file = "taplo.zip",
})
.with_receipt()
ctx:link_bin("taplo", "taplo.exe")
end,
}
end,
}

0 comments on commit f01129e

Please sign in to comment.