aboutsummaryrefslogtreecommitdiffstats
path: root/lua/mason-registry/crystalline/init.lua
blob: 10966976ac2f2b4d608256a90f64d3ac24e4b940 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
local Pkg = require "mason-core.package"
local platform = require "mason-core.platform"
local _ = require "mason-core.functional"
local github = require "mason-core.managers.github"
local std = require "mason-core.managers.std"

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

return Pkg.new {
    name = "crystalline",
    desc = [[A Language Server Protocol implementation for Crystal. 🔮]],
    homepage = "https://github.com/elbywan/crystalline",
    languages = { Pkg.Lang.Crystal },
    categories = { Pkg.Cat.LSP },
    ---@async
    ---@param ctx InstallContext
    install = function(ctx)
        github
            .gunzip_release_file({
                repo = "elbywan/crystalline",
                asset_file = coalesce(
                    when(platform.is.mac_x64, "crystalline_x86_64-apple-darwin.gz"),
                    when(platform.is.linux_x64, "crystalline_x86_64-unknown-linux-gnu.gz")
                ),
                out_file = "crystalline",
            })
            .with_receipt()
        std.chmod("+x", { "crystalline" })
        ctx:link_bin("crystalline", "crystalline")
    end,
}