aboutsummaryrefslogtreecommitdiffstats
path: root/lua/mason-registry/index/twigcs/init.lua
blob: 942c0192de55c7f4fc91af9bfcda875a6d1f2061 (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
32
33
34
35
36
local Pkg = require "mason-core.package"
local _ = require "mason-core.functional"
local github = require "mason-core.managers.github"
local platform = require "mason-core.platform"
local std = require "mason-core.managers.std"

return Pkg.new {
    name = "twigcs",
    desc = _.dedent [[
        The missing checkstyle for twig! Twigcs aims to be what phpcs is to php. It checks your codebase for violations
        on coding standards.
    ]],
    homepage = "https://github.com/friendsoftwig/twigcs",
    languages = { Pkg.Lang.Twig },
    categories = { Pkg.Cat.Linter },
    ---@async
    ---@param ctx InstallContext
    install = function(ctx)
        github
            .download_release_file({
                repo = "friendsoftwig/twigcs",
                asset_file = "twigcs.phar",
                out_file = platform.is.win and "twigcs.phar" or "twigcs",
            })
            .with_receipt()
        platform.when {
            unix = function()
                std.chmod("+x", { "twigcs" })
                ctx:link_bin("twigcs", "twigcs")
            end,
            win = function()
                ctx:link_bin("twigcs", ctx:write_php_exec_wrapper("twigcs", "twigcs.phar"))
            end,
        }
    end,
}