Skip to content

Commit

Permalink
Merge pull request #30 from desdic/v0.10
Browse files Browse the repository at this point in the history
fix: Remove deprecated functions after release of neovim 0.10.0
  • Loading branch information
desdic committed May 18, 2024
2 parents d6a0e01 + 142006e commit e7a8f7d
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 46 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ jobs:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
- os: ubuntu-24.04
url: https://github.com/neovim/neovim/releases/download/nightly/nvim-linux64.tar.gz
manager: sudo apt-get
packages: -y make lua-check
- os: ubuntu-20.04
url: https://github.com/neovim/neovim/releases/download/v0.9.5/nvim-linux64.tar.gz
- os: ubuntu-24.04
url: https://github.com/neovim/neovim/releases/download/v0.10.0/nvim-linux64.tar.gz
manager: sudo apt-get
packages: -y make lua-check
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- run: date +%F > todays-date
- name: Restore from todays cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: _neovim
key: ${{ runner.os }}-${{ matrix.url }}-${{ hashFiles('todays-date') }}
Expand Down
8 changes: 4 additions & 4 deletions lua/greyjoy/_extensions/cargo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ local ok, greyjoy = pcall(require, "greyjoy")
if not ok then
vim.notify(
"This plugin requires greyjoy.nvim (https://github.com/desdic/greyjoy.nvim)",
vim.lsp.log_levels.ERROR,
vim.log.levels.ERROR,
{ title = "Plugin error" }
)
return
end

local health = vim.health or require("health")
local health = vim.health

local M = {}

Expand Down Expand Up @@ -46,9 +46,9 @@ end

M.health = function()
if vim.fn.executable("cargo") == 1 then
health.report_ok("`cargo`: Ok")
health.ok("`cargo`: Ok")
else
health.report_error("`cargo` requires cargo to be installed")
health.error("`cargo` requires cargo to be installed")
end
end

Expand Down
27 changes: 18 additions & 9 deletions lua/greyjoy/_extensions/docker_compose.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ local ok, greyjoy = pcall(require, "greyjoy")
if not ok then
vim.notify(
"This plugin requires greyjoy.nvim (https://github.com/desdic/greyjoy.nvim)",
vim.lsp.log_levels.ERROR,
vim.log.levels.ERROR,
{ title = "Plugin error" }
)
return
Expand All @@ -12,13 +12,12 @@ local uok, utils = pcall(require, "greyjoy.utils")
if not uok then
vim.notify(
"This plugin requires greyjoy.nvim (https://github.com/desdic/greyjoy.nvim)",
vim.lsp.log_levels.ERROR,
{ title = "Plugin error" }
vim.log.levels.ERROR({ title = "Plugin error" })
)
return
end

local health = vim.health or require("health")
local health = vim.health

local M = {}

Expand All @@ -33,7 +32,10 @@ M.parse = function(fileinfo)
local elements = {}

local pipe = io.popen(
M.config["cmd"] .. " -f ".. filename .. " ps --filter 'status=running' --format '{{.Service}}'"
M.config["cmd"]
.. " -f "
.. filename
.. " ps --filter 'status=running' --format '{{.Service}}'"
)

if not pipe then
Expand All @@ -52,7 +54,8 @@ M.parse = function(fileinfo)
if v ~= "" then
local elem = {}
elem["name"] = "docker-compose exec " .. v
elem["command"] = { M.config["cmd"], "exec", "-it", v, M.config["shell"] }
elem["command"] =
{ M.config["cmd"], "exec", "-it", v, M.config["shell"] }
elem["path"] = filepath
elem["plugin"] = "docker_compose"

Expand All @@ -71,9 +74,11 @@ M.health = function()
local cmd = M.config["cmd"]:match("%S+")
local basename = string.gsub(cmd, "(.*/)(.*)", "%2")
if vim.fn.executable(basename) == 1 then
health.report_ok("`" .. basename .. "`: Ok")
health.ok("`" .. basename .. "`: Ok")
else
health.report_error("`docker_compose` requires " .. basename .." to be installed")
health.error(
"`docker_compose` requires " .. basename .. " to be installed"
)
end
end

Expand All @@ -93,5 +98,9 @@ end
return greyjoy.register_extension({
setup = M.setup,
health = M.health,
exports = { type = "file", files = { "docker-compose.yml" }, parse = M.parse },
exports = {
type = "file",
files = { "docker-compose.yml" },
parse = M.parse,
},
})
16 changes: 8 additions & 8 deletions lua/greyjoy/_extensions/kitchen.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local ok, greyjoy = pcall(require, "greyjoy")
if not ok then
vim.notify(
"This plugin requires greyjoy.nvim (https://github.com/desdic/greyjoy.nvim)",
vim.lsp.log_levels.ERROR,
vim.log.levels.ERROR,
{ title = "Plugin error" }
)
return
Expand All @@ -13,16 +13,16 @@ local uok, utils = pcall(require, "greyjoy.utils")
if not uok then
vim.notify(
"This plugin requires greyjoy.nvim (https://github.com/desdic/greyjoy.nvim)",
vim.lsp.log_levels.ERROR,
vim.log.levels.ERROR,
{ title = "Plugin error" }
)
return
end

local health = vim.health or require("health")
local health = vim.health

local M = {}
local uv = vim.loop or vim.uv
local uv = vim.uv

M.parse = function(fileinfo)
if type(fileinfo) ~= "table" then
Expand Down Expand Up @@ -75,16 +75,16 @@ end

M.health = function()
if vim.fn.executable("kitchen") == 1 then
health.report_ok("`kitchen`: Ok")
health.ok("`kitchen`: Ok")
else
health.report_error(
health.error(
"`kitchen` requires kitchen (cinc-workstation/chefdk) to be installed"
)
end
if vim.fn.executable("awk") == 1 then
health.report_ok("`awk`: Ok")
health.ok("`awk`: Ok")
else
health.report_error("`makefile` requires awk to be installed")
health.error("`makefile` requires awk to be installed")
end
end

Expand Down
12 changes: 6 additions & 6 deletions lua/greyjoy/_extensions/makefile.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ local ok, greyjoy = pcall(require, "greyjoy")
if not ok then
vim.notify(
"This plugin requires greyjoy.nvim (https://github.com/desdic/greyjoy.nvim)",
vim.lsp.log_levels.ERROR,
vim.log.levels.ERROR,
{ title = "Plugin error" }
)
return
end

local health = vim.health or require("health")
local health = vim.health

local M = {}

Expand Down Expand Up @@ -63,14 +63,14 @@ end

M.health = function()
if vim.fn.executable("make") == 1 then
health.report_ok("`make`: Ok")
health.ok("`make`: Ok")
else
health.report_error("`makefile` requires make to be installed")
health.error("`makefile` requires make to be installed")
end
if vim.fn.executable("awk") == 1 then
health.report_ok("`awk`: Ok")
health.ok("`awk`: Ok")
else
health.report_error("`makefile` requires awk to be installed")
health.error("`makefile` requires awk to be installed")
end
end

Expand Down
16 changes: 7 additions & 9 deletions lua/greyjoy/health.lua
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
local health = vim.health or require("health")
local health = vim.health
local extension_module = require("greyjoy._extensions")
local extension_info = require("greyjoy").extensions

local M = {}

M.check = function()
health.report_start("Checking for optional plugins")
health.start("Checking for optional plugins")

local ok, _ = pcall(require, "toggleterm")
if not ok then
health.report_warn("`toggleterm` not installed")
health.warn("`toggleterm` not installed")
else
health.report_ok("`toggleterm` installed")
health.ok("`toggleterm` installed")
end

health.report_start("===== Installed extensions =====")
health.start("===== Installed extensions =====")

local installed = {}
for extension_name, _ in pairs(extension_info) do
Expand All @@ -24,13 +24,11 @@ M.check = function()

for _, installed_ext in ipairs(installed) do
local extension_healthcheck = extension_module._health[installed_ext]
health.report_start(
string.format("Greyjoy Extension: `%s`", installed_ext)
)
health.start(string.format("Greyjoy Extension: `%s`", installed_ext))
if extension_healthcheck then
extension_healthcheck()
else
health.report_info("No healthcheck provided")
health.info("No healthcheck provided")
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lua/greyjoy/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ greyjoy.run = function(arg)
local filename = vim.fs.basename(fullname)
local filepath = vim.fs.dirname(fullname)
local pluginname = arg or ""
local uv = vim.loop or vim.uv
local uv = vim.uv

filepath = utils.if_nil(filepath, "")
if filepath == "" then
Expand Down
2 changes: 1 addition & 1 deletion lua/tests/automated/makefile_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ local eq = assert.are.same
describe("makefile extension", function()
it("runs make", function()
local makefile = require("greyjoy._extensions.makefile")
local uv = vim.loop or vim.uv
local uv = vim.uv

eq(makefile.exports, utils.if_nil(makefile.exports, false))
eq("file", utils.if_nil(makefile.exports.type, false))
Expand Down
3 changes: 1 addition & 2 deletions lua/tests/automated/utils_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ local eq = assert.are.same

describe("utils", function()
it("file exists", function()
local uv = vim.loop or vim.uv
local thisfile = uv.cwd() .. "/lua/tests/automated/utils_spec.lua"
local thisfile = vim.uv.cwd() .. "/lua/tests/automated/utils_spec.lua"

eq(true, utils.file_exists(thisfile))
eq(false, utils.file_exists(thisfile .. ".bak"))
Expand Down
2 changes: 1 addition & 1 deletion lua/tests/automated/vscode_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local eq = assert.are.same

describe("makefile extension", function()
it("runs make", function()
local uv = vim.loop or vim.uv
local uv = vim.uv
local vstasks = require("greyjoy._extensions.vscode_tasks")

eq(vstasks.exports, utils.if_nil(vstasks.exports, false))
Expand Down

0 comments on commit e7a8f7d

Please sign in to comment.