Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ test:
lint:
luacheck lua/

gen_nvimhelp:
stylua:
stylua --color always --check lua/

gen_nvimhelp: ./scripts/gen_nvimhelp.lua
nvim --headless --noplugin -u test/minimal_init.vim -c "luafile ./scripts/gen_nvimhelp.lua" -c 'qa'

testfile:
nvim --headless --noplugin -u test/minimal_init.vim -c "PlenaryBustedDirectory test/auto/$(file)_spec.lua { minimal_init = './test/minimal_init.vim' }"

gen_luarock:
gen_luarock: ./scripts/gen_rockspec.lua
nvim --headless --noplugin -u test/minimal_init.vim -c "luafile ./scripts/gen_rockspec.lua" -c 'qa'

43 changes: 43 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
description = "SQLite/LuaJIT binding for lua and neovim";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system}.pkgs;
in {

devShells = {

default = pkgs.mkShell {

# you will also need a neovim with plenary-nvim installed to run the
# tests
buildInputs = with pkgs; [
luarocks
lua51Packages.luacheck
stylua
];

shellHook = ''
export LIBSQLITE=${pkgs.sqlite.out}/lib/libsqlite3.so
'';
};
};
});
}
5 changes: 4 additions & 1 deletion lua/sqlite/defs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ local clib = (function()
error [[ sqlite.lua: vim.g.sql_clib_path is deprecated. Use vim.g.sqlite_clib_path instead. ]]
end
path = vim.g.sqlite_clib_path
else
end

if not path then
path, _ = luv.os_getenv "LIBSQLITE"
end


local clib_path = path
or (function() --- try to find libsqlite. Macos support only.
local os = luv.os_uname()
Expand Down
2 changes: 1 addition & 1 deletion lua/sqlite/examples/bookmarks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ function entries:inc(id)
local row = entries:where { id = id }
entries:update {
where = { id = id },
set = { count = row.count + 1 }
set = { count = row.count + 1 },
}
ts:insert(id)
ts:trim(id)
Expand Down
8 changes: 7 additions & 1 deletion scripts/gen_rockspec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@ build = {
type = "builtin",
modules = %s
}

test = {
type = "command",
command = "make test"
}
test_dependencies = {
"plenary.nvim"
}
]]):format(version, ins(description), version, dependencies, ins(modules))

local file_handle = io.open(("%s/sqlite-%s-0.rockspec"):format(cwd, version), "w")
Expand Down
38 changes: 38 additions & 0 deletions sqlite-master-0.rockspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
rockspec_format = "3.0"
package = 'sqlite'
version = 'master-0'
description = {
detailed = "",
homepage = "https://github.com/tami5/sqlite.lua",
labels = { "sqlite3", "binding", "luajit", "database" },
license = "MIT",
summary = "SQLite/LuaJIT binding and a highly opinionated wrapper for storing, retrieving, caching, and persisting [SQLite] databases"
}
source = {
url = 'git://github.com/tami5/sqlite.lua.git',
tag = "master"
}
dependencies = {
"luv"
}
build = {
type = "builtin",
modules = {
["lua.sqlite.db.lua"] = "lua/sqlite/db.lua",
["lua.sqlite.defs.lua"] = "lua/sqlite/defs.lua",
["lua.sqlite.helpers.lua"] = "lua/sqlite/helpers.lua",
["lua.sqlite.init.lua"] = "lua/sqlite/init.lua",
["lua.sqlite.json.lua"] = "lua/sqlite/json.lua",
["lua.sqlite.tbl.cache.lua"] = "lua/sqlite/tbl/cache.lua",
["lua.sqlite.tbl.extend.lua"] = "lua/sqlite/tbl/extend.lua",
["lua.sqlite.tbl.lua"] = "lua/sqlite/tbl.lua",
["lua.sqlite.utils.lua"] = "lua/sqlite/utils.lua"
}
}
test = {
type = "command",
command = "make test"
}
test_dependencies = {
"plenary.nvim"
}