aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/servers/crystalline/init.lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2022-04-21 12:09:59 +0200
committerGitHub <noreply@github.com>2022-04-21 12:09:59 +0200
commitb68fcc6bb2c770495ff8e2508c06dfdd49abcc80 (patch)
treedf7c71efb59958deb21a18eeccf3e3c43c4cd704 /lua/nvim-lsp-installer/servers/crystalline/init.lua
parentrun autogen_metadata.lua (diff)
downloadmason-b68fcc6bb2c770495ff8e2508c06dfdd49abcc80.tar
mason-b68fcc6bb2c770495ff8e2508c06dfdd49abcc80.tar.gz
mason-b68fcc6bb2c770495ff8e2508c06dfdd49abcc80.tar.bz2
mason-b68fcc6bb2c770495ff8e2508c06dfdd49abcc80.tar.lz
mason-b68fcc6bb2c770495ff8e2508c06dfdd49abcc80.tar.xz
mason-b68fcc6bb2c770495ff8e2508c06dfdd49abcc80.tar.zst
mason-b68fcc6bb2c770495ff8e2508c06dfdd49abcc80.zip
chore: refactor remaining installers to async impl (#616)
Diffstat (limited to 'lua/nvim-lsp-installer/servers/crystalline/init.lua')
-rw-r--r--lua/nvim-lsp-installer/servers/crystalline/init.lua57
1 files changed, 13 insertions, 44 deletions
diff --git a/lua/nvim-lsp-installer/servers/crystalline/init.lua b/lua/nvim-lsp-installer/servers/crystalline/init.lua
index 01c8ac24..67d61a9e 100644
--- a/lua/nvim-lsp-installer/servers/crystalline/init.lua
+++ b/lua/nvim-lsp-installer/servers/crystalline/init.lua
@@ -1,11 +1,10 @@
local server = require "nvim-lsp-installer.server"
local process = require "nvim-lsp-installer.process"
local platform = require "nvim-lsp-installer.platform"
-local std = require "nvim-lsp-installer.installers.std"
-local context = require "nvim-lsp-installer.installers.context"
-local installers = require "nvim-lsp-installer.installers"
local Data = require "nvim-lsp-installer.data"
local path = require "nvim-lsp-installer.path"
+local github = require "nvim-lsp-installer.core.managers.github"
+local std = require "nvim-lsp-installer.core.managers.std"
local coalesce, when = Data.coalesce, Data.when
@@ -15,48 +14,18 @@ return function(name, root_dir)
root_dir = root_dir,
homepage = "https://github.com/elbywan/crystalline",
languages = { "crystal" },
- installer = {
- -- Crystalline (LSP)
- installers.branch_context {
- context.use_github_release_file(
- "elbywan/crystalline",
- coalesce(
- when(platform.is_mac and platform.arch == "x64", "crystalline_x86_64-apple-darwin.gz"),
- when(platform.is_linux and platform.arch == "x64", "crystalline_x86_64-unknown-linux-gnu.gz")
- )
+ async = true,
+ installer = function()
+ github.gunzip_release_file({
+ repo = "elbywan/crystalline",
+ asset_file = coalesce(
+ when(platform.is_mac and platform.arch == "x64", "crystalline_x86_64-apple-darwin.gz"),
+ when(platform.is_linux and platform.arch == "x64", "crystalline_x86_64-unknown-linux-gnu.gz")
),
- context.capture(function(ctx)
- return std.gunzip_remote(
- ctx.github_release_file,
- platform.is_win and "crystalline.exe" or "crystalline"
- )
- end),
- std.chmod("+x", { "crystalline" }),
- context.receipt(function(receipt, ctx)
- receipt:with_primary_source(receipt.github_release_file(ctx))
- end),
- },
- -- Crystal
- installers.branch_context {
- context.use_github_release_file("crystal-lang/crystal", function(version)
- local target_file = coalesce(
- when(platform.is_mac, "crystal-%s-1-darwin-universal.tar.gz"),
- when(platform.is_linux and platform.arch == "x64", "crystal-%s-1-linux-x86_64-bundled.tar.gz")
- )
- return target_file and target_file:format(version)
- end),
- context.capture(function(ctx)
- return installers.pipe {
- std.untargz_remote(ctx.github_release_file),
- std.rename(("crystal-%s-1"):format(ctx.requested_server_version), "crystal"),
- }
- end),
- std.chmod("+x", { "crystalline" }),
- context.receipt(function(receipt, ctx)
- receipt:with_secondary_source(receipt.github_release_file(ctx))
- end),
- },
- },
+ out_file = "crystalline",
+ }).with_receipt()
+ std.chmod("+x", { "crystalline" })
+ end,
default_options = {
cmd_env = {
PATH = process.extend_path { root_dir, path.concat { root_dir, "crystal", "bin" } },