aboutsummaryrefslogtreecommitdiffstats
path: root/lua/mason-registry/index/crystalline/init.lua
blob: 34128fdf3f2088713f87b669f47d01f04d5f402c (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-musl.gz")
                ),
                out_file = "crystalline",
            })
            .with_receipt()
        std.chmod("+x", { "crystalline" })
        ctx:link_bin("crystalline", "crystalline")
    end,
}