summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <daniel.silverstone@codethink.co.uk>2014-03-10 12:41:44 +0000
committerDaniel Silverstone <daniel.silverstone@codethink.co.uk>2014-03-11 14:02:42 +0000
commitab1c0b22b57fc96782d9dd3498b36be04ac6f328 (patch)
tree8031a63eef6111ff90e120afcb5b3ffa82b4fc27
parent1b141c8359c690756b0f9612fd6ccfc7ca5e9f99 (diff)
downloadgitano-ab1c0b22b57fc96782d9dd3498b36be04ac6f328.tar.gz
Add support for a GITANO_PLUGIN_PATH in install-lua-bin
The binary installer `install-lua-bin` needs to update all of the files ending in `.in` to be ready for installation. This patch ensures that we support a tag for loading plugins which the various `.in` files can then use to ensure they load plugins at an appropriate point. Signed-off-by: Daniel Silverstone <daniel.silverstone@codethink.co.uk>
-rw-r--r--Makefile8
-rw-r--r--utils/install-lua-bin14
2 files changed, 19 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 775f5cc..359b817 100644
--- a/Makefile
+++ b/Makefile
@@ -6,6 +6,7 @@ LUA_VER := 5.1
LUA := /usr/bin/lua$(LUA_VER)
PREFIX ?= /usr/local
INST_ROOT := $(PREFIX)
+SYSCONF_DIR ?= /etc
# Internal stuff
LUA_MOD_PATH := $(INST_ROOT)/share/lua/$(LUA_VER)
@@ -19,6 +20,7 @@ SHARE_INST_PATH := $(DESTDIR)$(SHARE_PATH)
SKEL_INST_PATH := $(SHARE_INST_PATH)/skel
MAN_PATH := $(INST_ROOT)/share/man
MAN_INST_PATH := $(DESTDIR)$(MAN_PATH)
+PLUGIN_PATH := $(SYSCONF_DIR)/gitano/plugins:$(INST_ROOT)/lib/gitano/plugins
LIB_BINS := gitano-auth gitano-post-receive-hook gitano-update-hook \
gitano-update-ssh gitano-pre-receive-hook gitano-smart-http.cgi \
@@ -59,6 +61,8 @@ SKEL_FILES := gitano-admin/rules/selfchecks.lace \
MAN1S := gitano-setup.1
+PLUGINS :=
+
MOD_DIRS := gitano
MOD_FILES := $(patsubst %,%.lua,$(subst .,/,$(MODS)))
SRC_MOD_FILES := $(patsubst %,lib/%,$(MOD_FILES))
@@ -77,14 +81,14 @@ GEN_BIN := utils/install-lua-bin
RUN_GEN_BIN := $(LUA) $(GEN_BIN) $(LUA)
define GEN_LOCAL_BIN
-$(RUN_GEN_BIN) $(shell pwd) $(shell pwd)/bin $(shell pwd)/lib $1 $2
+$(RUN_GEN_BIN) $(shell pwd) $(shell pwd)/bin $(shell pwd)/lib $(shell pwd)/plugins $1 $2
chmod 755 $2
endef
define GEN_INSTALL_BIN
-$(RUN_GEN_BIN) $(SHARE_PATH) $(LIB_BIN_PATH) $(LUA_MOD_PATH) $1 $2
+$(RUN_GEN_BIN) $(SHARE_PATH) $(LIB_BIN_PATH) $(LUA_MOD_PATH) $(PLUGIN_PATH) $1 $2
chmod 755 $2
endef
diff --git a/utils/install-lua-bin b/utils/install-lua-bin
index 4d7322c..3353a34 100644
--- a/utils/install-lua-bin
+++ b/utils/install-lua-bin
@@ -1,6 +1,6 @@
-- Run this explicitly through -*- Lua -*-
-local lua_bin, inst_share_path, inst_bin_path, inst_mod_path, input_name, output_name = ...
+local lua_bin, inst_share_path, inst_bin_path, inst_mod_path, inst_plugin_path, input_name, output_name = ...
local input_fh = assert(io.open(input_name, "r"))
local output_fh = assert(io.open(output_name, "w"))
@@ -20,6 +20,16 @@ for path_elem in package.path:gmatch("([^;]+)") do
end
end
+do
+ -- transform the plugin path from colon separated to a table
+ -- for interpolation
+ local path = {}
+ for entry in string.gfind(inst_plugin_path, "([^:]+)") do
+ path[#path+1] = ("%q"):format(entry)
+ end
+ inst_plugin_path = ("{%s}"):format(table.concat(path, ", "))
+end
+
while line do
local token = line:match("^%-%- @@(.+)$")
if token then
@@ -38,6 +48,8 @@ while line do
output_fh:write(("gitano.config.lib_bin_path(%q)\n"):format(inst_bin_path))
elseif token == "GITANO_SHARE_PATH" then
output_fh:write(("gitano.config.share_path(%q)\n"):format(inst_share_path))
+ elseif token == "GITANO_PLUGIN_PATH" then
+ output_fh:write(("gitano.plugins.load_plugins %s\n"):format(inst_plugin_path))
else
output_fh:write("-- Unknown token: " .. token .. "\n")
end