From ac70755ef7cd40ee9bbb153592fa564d3c02bcd2 Mon Sep 17 00:00:00 2001 From: Seth Daniel Date: Sat, 17 Sep 2022 12:13:31 -0500 Subject: feat(editorconfig-checker): use the pre-packaged ec (#434) Closes #364. --- lua/mason-registry/editorconfig-checker/init.lua | 27 +++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'lua') diff --git a/lua/mason-registry/editorconfig-checker/init.lua b/lua/mason-registry/editorconfig-checker/init.lua index f49de4f2..f9279128 100644 --- a/lua/mason-registry/editorconfig-checker/init.lua +++ b/lua/mason-registry/editorconfig-checker/init.lua @@ -1,5 +1,10 @@ local Pkg = require "mason-core.package" -local go = require "mason-core.managers.go" +local _ = require "mason-core.functional" +local platform = require "mason-core.platform" +local github = require "mason-core.managers.github" +local path = require "mason-core.path" + +local coalesce, when = _.coalesce, _.when return Pkg.new { name = "editorconfig-checker", @@ -7,8 +12,20 @@ return Pkg.new { homepage = "https://github.com/editorconfig-checker/editorconfig-checker", languages = {}, categories = { Pkg.Cat.Linter }, - install = go.packages { - "github.com/editorconfig-checker/editorconfig-checker/cmd/editorconfig-checker", - bin = { "editorconfig-checker" }, - }, + install = function(ctx) + local source = github.untargz_release_file { + repo = "editorconfig-checker/editorconfig-checker", + asset_file = coalesce( + when(platform.is.mac_arm64, "ec-darwin-arm64.tar.gz"), + when(platform.is.mac_x64, "ec-darwin-amd64.tar.gz"), + when(platform.is.linux_arm64, "ec-linux-arm64.tar.gz"), + when(platform.is.linux_x64, "ec-linux-amd64.tar.gz"), + when(platform.is.win_x86, "ec-windows-386.tar.gz"), + when(platform.is.win_x64, "ec-windows-amd64.tar.gz") + ), + } + source.with_receipt() + local prog = source.asset_file:gsub("%.tar%.gz$", "") + ctx:link_bin("editorconfig-checker", path.concat { "bin", prog }) + end, } -- cgit v1.2.3-70-g09d2