aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/installers/solargraph.lua
blob: c227c2b3a499f665a8e4ca19d98a4198e0d5e838 (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
local installer = require('nvim-lsp-installer.installer')

local root_dir = installer.get_server_root_path('ruby')

local install_cmd = [[
wget -O solargraph.tar $(curl -s https://api.github.com/repos/castwide/solargraph/tags | grep 'tarball_url' | cut -d\" -f4 | head -n1);
rm -rf solargraph;
mkdir solargraph;
tar -xzf solargraph.tar -C solargraph --strip-components 1;
rm solargraph.tar;
cd solargraph;

bundle install --without development --path vendor/bundle;

echo '#!/usr/bin/env bash' > solargraph;
echo 'cd "$(dirname "$0")" || exit' >> solargraph;
echo 'bundle exec solargraph $*' >> solargraph;

chmod +x solargraph;
]]

return installer.Installer:new {
    name = "solargraph",
    root_dir = root_dir,
    install_cmd = install_cmd,
    pre_install = function ()
        if vim.fn.executable('bundle') ~= 1 then
            error("bundle not installed")
        end
    end,
    default_options = {
        cmd = { root_dir .. '/solargraph/solargraph', 'stdio' },
    }
}