aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/servers/verible/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/nvim-lsp-installer/servers/verible/init.lua')
-rw-r--r--lua/nvim-lsp-installer/servers/verible/init.lua99
1 files changed, 46 insertions, 53 deletions
diff --git a/lua/nvim-lsp-installer/servers/verible/init.lua b/lua/nvim-lsp-installer/servers/verible/init.lua
index ea55531f..396fc6be 100644
--- a/lua/nvim-lsp-installer/servers/verible/init.lua
+++ b/lua/nvim-lsp-installer/servers/verible/init.lua
@@ -1,11 +1,9 @@
local server = require "nvim-lsp-installer.server"
local process = require "nvim-lsp-installer.process"
local platform = require "nvim-lsp-installer.platform"
-local installers = require "nvim-lsp-installer.installers"
-local std = require "nvim-lsp-installer.installers.std"
-local context = require "nvim-lsp-installer.installers.context"
local Data = require "nvim-lsp-installer.data"
local path = require "nvim-lsp-installer.path"
+local github = require "nvim-lsp-installer.core.managers.github"
local coalesce, when = Data.coalesce, Data.when
@@ -15,57 +13,52 @@ return function(name, root_dir)
root_dir = root_dir,
homepage = "https://chipsalliance.github.io/verible/",
languages = { "systemverilog", "verilog" },
- installer = {
- context.use_os_distribution(),
- context.capture(function(ctx)
- return context.use_github_release_file("chipsalliance/verible", function(version)
- if ctx.os_distribution.id == "ubuntu" then
- local target_file = when(
- platform.arch == "x64",
- coalesce(
- when(
- ctx.os_distribution.version.major == 16,
- "verible-%s-Ubuntu-16.04-xenial-x86_64.tar.gz"
- ),
- when(
- ctx.os_distribution.version.major == 18,
- "verible-%s-Ubuntu-18.04-bionic-x86_64.tar.gz"
- ),
- when(
- ctx.os_distribution.version.major == 20,
- "verible-%s-Ubuntu-20.04-focal-x86_64.tar.gz"
- ),
- when(
- ctx.os_distribution.version.major == 22,
- "verible-%s-Ubuntu-22.04-jammy-x86_64.tar.gz"
+ async = true,
+ ---@param ctx InstallContext
+ installer = function(ctx)
+ local repo = "chipsalliance/verible"
+ platform.when {
+ linux = function()
+ local os_dist = platform.os_distribution()
+ local source = github.untarxz_release_file {
+ repo = repo,
+ asset_file = function(release)
+ if os_dist.id == "ubuntu" then
+ local target_file = when(
+ platform.arch == "x64",
+ coalesce(
+ when(
+ os_dist.version.major == 16,
+ "verible-%s-Ubuntu-16.04-xenial-x86_64.tar.gz"
+ ),
+ when(
+ os_dist.version.major == 18,
+ "verible-%s-Ubuntu-18.04-bionic-x86_64.tar.gz"
+ ),
+ when(os_dist.version.major == 20, "verible-%s-Ubuntu-20.04-focal-x86_64.tar.gz"),
+ when(os_dist.version.major == 22, "verible-%s-Ubuntu-22.04-jammy-x86_64.tar.gz")
+ )
)
- )
- )
- return target_file and target_file:format(version)
- else
- local target_file = coalesce(
- when(platform.is_win and platform.arch == "x64", "verible-%s-win64.zip")
- )
- return target_file and target_file:format(version)
- end
- end)
- end),
- context.capture(function(ctx)
- return installers.pipe {
- installers.when {
- unix = std.untargz_remote(ctx.github_release_file),
- win = std.unzip_remote(ctx.github_release_file),
- },
- std.rename(
- ("verible-%s%s"):format(ctx.requested_server_version, platform.is_win and "-win64" or ""),
- "verible"
- ),
- }
- end),
- context.receipt(function(receipt, ctx)
- receipt:with_primary_source(receipt.github_release_file(ctx))
- end),
- },
+ return target_file and target_file:format(release)
+ end
+ end,
+ }
+ source.with_receipt()
+ ctx.fs:rename(("verible-%s"):format(source.release), "verible")
+ end,
+ win = function()
+ local source = github.unzip_release_file {
+ repo = repo,
+ asset_file = function(release)
+ local target_file = coalesce(when(platform.arch == "x64", "verible-%s-win64.zip"))
+ return target_file and target_file:format(release)
+ end,
+ }
+ source.with_receipt()
+ ctx.fs:rename(("verible-%s-win64"):format(source.release), "verible")
+ end,
+ }
+ end,
default_options = {
cmd_env = {
PATH = process.extend_path {