Skip to content

Commit 7c18977

Browse files
author
Marc Jakobi
committed
feat: luarocks/rocks.nvim support
1 parent 9ef21b2 commit 7c18977

File tree

5 files changed

+117
-0
lines changed

5 files changed

+117
-0
lines changed

.github/workflows/luarocks.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Push to Luarocks
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
release:
8+
types:
9+
- created
10+
pull_request:
11+
workflow_dispatch:
12+
13+
jobs:
14+
luarocks-upload:
15+
runs-on: ubuntu-22.04
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0 # Required to count the commits
20+
- name: Get Version
21+
run: echo "LUAROCKS_VERSION=$(git describe --abbrev=0 --tags)" >> $GITHUB_ENV
22+
- name: LuaRocks Upload
23+
uses: nvim-neorocks/luarocks-tag-release@v5
24+
env:
25+
LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }}
26+
with:
27+
version: ${{ env.LUAROCKS_VERSION }}
28+
dependencies: |
29+
telescope.nvim
30+
template: .github/workflows/rockspec.template
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
local git_ref = '$git_ref'
2+
local modrev = '$modrev'
3+
local specrev = '$specrev'
4+
5+
local repo_url = '$repo_url'
6+
7+
rockspec_format = '3.0'
8+
package = '$package'
9+
version = modrev ..'-'.. specrev
10+
11+
description = {
12+
summary = '$summary',
13+
labels = $labels,
14+
homepage = '$homepage',
15+
$license
16+
}
17+
18+
source = {
19+
url = repo_url .. '/archive/' .. git_ref .. '.zip',
20+
dir = '$repo_name-' .. '$archive_dir_suffix',
21+
}
22+
23+
build = {
24+
type = 'make',
25+
build_pass = false,
26+
install_variables = {
27+
INST_PREFIX='$(PREFIX)',
28+
INST_BINDIR='$(BINDIR)',
29+
INST_LIBDIR='$(LIBDIR)',
30+
INST_LUADIR='$(LUADIR)',
31+
INST_CONFDIR='$(CONFDIR)',
32+
},
33+
}

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,9 @@ clangdhappy:
4444

4545
clean:
4646
$(RM) build
47+
48+
install:
49+
mkdir -p $(INST_LUADIR)
50+
mkdir -p $(INST_LIBDIR)
51+
cp -r lua/* $(INST_LUADIR)
52+
cp -r build/* $(INST_LIBDIR)

lua/fzf_lib.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
local ffi = require "ffi"
22

33
local library_path = (function()
4+
local libfzf_path = package.searchpath("libfzf", package.cpath)
5+
if libfzf_path then
6+
-- package has been installed with luarocks
7+
return library_path
8+
end
49
local dirname = string.sub(debug.getinfo(1).source, 2, #"/fzf_lib.lua" * -1)
510
if package.config:sub(1, 1) == "\\" then
611
return dirname .. "../build/libfzf.dll"
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
local MODREV, SPECREV = 'scm', '-1'
2+
rockspec_format = '3.0'
3+
package = 'telescope-fzf-native.nvim'
4+
version = MODREV .. SPECREV
5+
6+
description = {
7+
summary = 'FZF sorter for telescope written in c',
8+
detailed = [[
9+
fzf-native is a c port of fzf.
10+
It only covers the algorithm and implements few functions to support calculating the score.
11+
]],
12+
labels = { 'neovim', 'plugin', },
13+
homepage = 'https://github.com/nvim-telescope/telescope-fzf-native.nvim',
14+
license = 'MIT',
15+
}
16+
17+
dependencies = {
18+
'lua == 5.1',
19+
'telescope.nvim',
20+
}
21+
22+
source = {
23+
url = 'https://github.com/nvim-telescope/telescope-fzf-native.nvim/archive/refs/tags/' .. MODREV .. '.zip',
24+
dir = 'telescope-fzf-native.nvim-' .. MODREV
25+
}
26+
27+
if MODREV == 'scm' then
28+
source = {
29+
url = 'git://github.com/nvim-telescope/telescope.nvim',
30+
}
31+
end
32+
33+
build = {
34+
type = 'make',
35+
build_pass = false,
36+
install_variables = {
37+
INST_PREFIX='$(PREFIX)',
38+
INST_BINDIR='$(BINDIR)',
39+
INST_LIBDIR='$(LIBDIR)',
40+
INST_LUADIR='$(LUADIR)',
41+
INST_CONFDIR='$(CONFDIR)',
42+
},
43+
}

0 commit comments

Comments
 (0)