Skip to content

Commit

Permalink
feat: luarocks/rocks.nvim support
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcjkb committed May 23, 2024
1 parent 9ef21b2 commit 7c18977
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/luarocks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Push to Luarocks

on:
push:
tags:
- '*'
release:
types:
- created
pull_request:
workflow_dispatch:

jobs:
luarocks-upload:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Required to count the commits
- name: Get Version
run: echo "LUAROCKS_VERSION=$(git describe --abbrev=0 --tags)" >> $GITHUB_ENV
- name: LuaRocks Upload
uses: nvim-neorocks/luarocks-tag-release@v5
env:
LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }}
with:
version: ${{ env.LUAROCKS_VERSION }}
dependencies: |
telescope.nvim
template: .github/workflows/rockspec.template
33 changes: 33 additions & 0 deletions .github/workflows/rockspec.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
local git_ref = '$git_ref'
local modrev = '$modrev'
local specrev = '$specrev'

local repo_url = '$repo_url'

rockspec_format = '3.0'
package = '$package'
version = modrev ..'-'.. specrev

description = {
summary = '$summary',
labels = $labels,
homepage = '$homepage',
$license
}

source = {
url = repo_url .. '/archive/' .. git_ref .. '.zip',
dir = '$repo_name-' .. '$archive_dir_suffix',
}

build = {
type = 'make',
build_pass = false,
install_variables = {
INST_PREFIX='$(PREFIX)',
INST_BINDIR='$(BINDIR)',
INST_LIBDIR='$(LIBDIR)',
INST_LUADIR='$(LUADIR)',
INST_CONFDIR='$(CONFDIR)',
},
}
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,9 @@ clangdhappy:

clean:
$(RM) build

install:
mkdir -p $(INST_LUADIR)
mkdir -p $(INST_LIBDIR)
cp -r lua/* $(INST_LUADIR)
cp -r build/* $(INST_LIBDIR)
5 changes: 5 additions & 0 deletions lua/fzf_lib.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
local ffi = require "ffi"

local library_path = (function()
local libfzf_path = package.searchpath("libfzf", package.cpath)
if libfzf_path then
-- package has been installed with luarocks
return library_path
end
local dirname = string.sub(debug.getinfo(1).source, 2, #"/fzf_lib.lua" * -1)
if package.config:sub(1, 1) == "\\" then
return dirname .. "../build/libfzf.dll"
Expand Down
43 changes: 43 additions & 0 deletions telescope-fzf-native.nvim-scm-1.rockspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
local MODREV, SPECREV = 'scm', '-1'
rockspec_format = '3.0'
package = 'telescope-fzf-native.nvim'
version = MODREV .. SPECREV

description = {
summary = 'FZF sorter for telescope written in c',
detailed = [[
fzf-native is a c port of fzf.
It only covers the algorithm and implements few functions to support calculating the score.
]],
labels = { 'neovim', 'plugin', },
homepage = 'https://github.com/nvim-telescope/telescope-fzf-native.nvim',
license = 'MIT',
}

dependencies = {
'lua == 5.1',
'telescope.nvim',
}

source = {
url = 'https://github.com/nvim-telescope/telescope-fzf-native.nvim/archive/refs/tags/' .. MODREV .. '.zip',
dir = 'telescope-fzf-native.nvim-' .. MODREV
}

if MODREV == 'scm' then
source = {
url = 'git://github.com/nvim-telescope/telescope.nvim',
}
end

build = {
type = 'make',
build_pass = false,
install_variables = {
INST_PREFIX='$(PREFIX)',
INST_BINDIR='$(BINDIR)',
INST_LIBDIR='$(LIBDIR)',
INST_LUADIR='$(LUADIR)',
INST_CONFDIR='$(CONFDIR)',
},
}

0 comments on commit 7c18977

Please sign in to comment.