~prokop/lua-pebble

Lua package manager

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~prokop/lua-pebble
read/write
git@git.sr.ht:~prokop/lua-pebble

You can also use your local clone with git send-email.

#Pebble

Lua pebble can fetch and cache dependencies from the internet on demand.


Compatible with lua 5.4 or luajit on Linux.

#Usage

require('pebble') -- init pebble

-- load a file from github using its pebble string
local fun = require('gh!luafun/luafun!fun.lua')

-- use the library as usual
print(fun.range(100):map(function(x) return x^2 end):reduce(fun.op.add, 0))
$ lua example.lua
pebble: fetching https://github.com/luafun/luafun.git
338350.0

#Install

install pebble.lua /usr/share/lua/common/

#Uninstall

rm /usr/share/lua/common/pebble.lua

#Details

Pebble hooks into the require function. When it detects you trying to require some library using a pebble string, it checks to see if it is found inside ~/.cache/luapebble. If it is there or if it is too old, it refetches the dependency. Then it loads the library and returns it.

#Config

You can define a global PEBBLE table to alter pebble behaviour. The default values are:

PEBBLE = {
    max_age_seconds = 60*60*24*7, -- Older than this gets refetched (week)
    quiet = false, -- Dont print to stdout
    verbose = false, -- Echo commands before executing
}
Do not follow this link