rktjmp / lush.nvim

Create Neovim themes with real-time feedback, export anywhere.
MIT License
1.44k stars 47 forks source link

adding rockspec #58

Closed teto closed 2 years ago

teto commented 3 years ago

so that one can install the plugin from luarocks.org

see https://github.com/lewis6991/gitsigns.nvim/pull/281 for more details.

rktjmp commented 3 years ago

So AFAIK packer is maybe the only package manager to let you use luarocks packages. Is there any plans to maybe roll rockspecs into this https://github.com/neovim/neovim/issues/14375?

And do you know what would happen if plugin-a depends lush-1.0 and plugin-b depends lush-2.0?

Can both plugins just require lush and get the correct package?

rktjmp commented 3 years ago

Can't install:

luarocks install --tree lua_modules lush.nvim
lush.nvim not found for Lua 5.1.
Checking if available for other Lua versions...
Checking for Lua 5.2...
Checking for Lua 5.3...
Checking for Lua 5.4...

Error: No results matching query were found for Lua 5.1.
luarocks --help

LuaRocks 3.1.3, the Lua package manager

NAME
        /home/soup/.asdf/installs/lua/5.1.5/luarocks/bin/luarocks - LuaRocks main command-l
ine interface

SYNOPSIS
        /home/soup/.asdf/installs/lua/5.1.5/luarocks/bin/luarocks [<flags...>] [VAR=VALUE].
.. <command> [<argument>]

...

CONFIGURATION
        Lua version: 5.1

        Configuration files:
                System  : /home/soup/.asdf/installs/lua/5.1.5/luarocks/etc/luarocks/config-5.1.lua (ok)
                User    : /home/soup/.luarocks/config-5.1.lua (not found)

        Rocks trees in use:
                /home/soup/.luarocks ("user")
                /home/soup/.asdf/installs/lua/5.1.5/luarocks ("system")

Moonscript does, not sure what the diff is between specs: https://raw.githubusercontent.com/leafo/moonscript/master/moonscript-dev-1.rockspec

teto commented 3 years ago

I will try to explain in a blogpost what my vision is (not necessarily everyone's in neovim) but to sum it up: I am fond of nix and I dont think vim-plug/packer should replace a package manager. If we want truly powerful programs we need to be able to reference external dependencies (like rust-analyzer for a rust LSP plugin, the fzf binary for a fzf plugin).

I am currently experimenting with installing lush via nix (WIP for instance, the current rockspec doesn't copy the "doc" folder which is bad) but I've uploaded it to luarocks.org (for my tests, it's at https://luarocks.org/labels/neovim) . I hope that's ok with you, eventually I will remove/transfer control to you.

Luarocks support in Packer fails for me because it relies on python

teto commented 2 years ago

I see there is a spec folder (tests I suppose ?). rockspec in format 3.0 can run tests too. How do you run the tests in this repo ?

rktjmp commented 2 years ago

busted but it requires busted and moonscript.

https://github.com/rktjmp/lush.nvim/blob/main/.github/workflows/busted.yml

rktjmp commented 2 years ago

Should be functional now, can you confirm?

teto commented 2 years ago

yes it now works for lua5.1 and 5.2 (haven't tested the other ones) so I would think of this as ready. The annoying part is for you that idealy you would have to upload a version to luarocks.org to facilitate discovery (other plugins can then reference lush.nvim as lush.nvim in their rockspec instead of specifying the full repo). I've removed my upload https://luarocks.org/modules/teto/lush.nvim from the luarocks root manifest so that your package becomes the reference.

teto commented 2 years ago

I've detailed my reasoning about this feature in https://teto.github.io/posts/2022-06-22-neovim-plugin-luarocks-2.html

rktjmp commented 2 years ago

Sorry, have been meaning to get around this.

If I merge it can you maintain it for now until I get around to making a luarocks account?

teto commented 2 years ago

sure

teto commented 2 years ago

follow up at https://github.com/rest-nvim/rest.nvim/pull/129