Skip to content

Commit ac2118c

Browse files
Bugfix: Force binary rebuild
We need to rebuild the binary whenever the plugin has changed. Previously we were not doing this if the binary already existed. This MR adds an override parameter to the build() function which will force a rebuild even if the binary already exists. The README has been updated to note that this parameter should be used for Packer/Lazy, and when someone is troubleshooting. It won't be passed in to the build function during the normal setup call. Should address #55
1 parent 6cb9d28 commit ac2118c

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ return {
4040
"stevearc/dressing.nvim", -- Recommended but not required. Better UI for pickers.
4141
enabled = true,
4242
},
43-
build = function () require("gitlab.server").build() end, -- Builds the Go binary
43+
build = function () require("gitlab.server").build(true) end, -- Builds the Go binary
4444
config = function()
4545
require("gitlab").setup()
4646
end,
@@ -56,7 +56,7 @@ use {
5656
"MunifTanjim/nui.nvim",
5757
"nvim-lua/plenary.nvim"
5858
},
59-
run = function() require("gitlab.server").build() end,
59+
run = function() require("gitlab.server").build(true) end,
6060
config = function()
6161
require("gitlab").setup()
6262
end,
@@ -244,7 +244,7 @@ vim.keymap.set("n", "<leader>glp", gitlab.pipeline)
244244
This plugin uses a Golang server to reach out to Gitlab. It's possible that something is going wrong when starting that server or connecting with Gitlab. The Golang server runs outside of Neovim, and can be interacted with directly in order to troubleshoot. To start the server, check out your feature branch and run these commands:
245245

246246
```
247-
:lua require("gitlab.server").build()
247+
:lua require("gitlab.server").build(true)
248248
:lua require("gitlab.server").start(function() print("Server started") end)
249249
```
250250

lua/gitlab/server.lua

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
-- This module contains the logic responsible for building and starting
22
-- the Golang server. The Go server is responsible for making API calls
33
-- to Gitlab and returning the data
4-
local job = require("gitlab.job")
54
local state = require("gitlab.state")
65
local u = require("gitlab.utils")
76
local M = {}
@@ -43,7 +42,7 @@ end
4342

4443

4544
-- Builds the Go binary
46-
M.build = function()
45+
M.build = function(override)
4746
if not u.has_delta() then
4847
vim.notify("Please install delta to use gitlab.nvim!", vim.log.levels.ERROR)
4948
return
@@ -54,8 +53,10 @@ M.build = function()
5453
state.settings.bin_path = parent_dir
5554
state.settings.bin = parent_dir .. "/bin"
5655

57-
local binary_exists = vim.loop.fs_stat(state.settings.bin)
58-
if binary_exists ~= nil then return end
56+
if not override then
57+
local binary_exists = vim.loop.fs_stat(state.settings.bin)
58+
if binary_exists ~= nil then return end
59+
end
5960

6061
local command = string.format("cd %s && make", state.settings.bin_path)
6162
local installCode = os.execute(command .. "> /dev/null")

0 commit comments

Comments
 (0)