mirror of
https://github.com/bjc/prosody.git
synced 2025-03-31 11:47:40 +03:00
prosody.loader: Allow loading modules under 'prosody' namespace (#1223)
Actually `hg mv`-ing all the files is disruptive, basically breaking everything from rebasing all my WIP draft commits to the package building. So instead, what if we didn't and instead rewrote package names as they are `require()`-d? Debian packages produced by the Prosody are already installed into this structure so much will Just Work if all require calls are updated.
This commit is contained in:
parent
9dd7ce434d
commit
d33f55156b
3 changed files with 19 additions and 2 deletions
|
@ -42,6 +42,10 @@ install-bin: prosody.install prosodyctl.install
|
|||
$(INSTALL_EXEC) ./prosody.install $(BIN)/prosody
|
||||
$(INSTALL_EXEC) ./prosodyctl.install $(BIN)/prosodyctl
|
||||
|
||||
install-loader:
|
||||
$(MKDIR) $(SOURCE)
|
||||
$(INSTALL_DATA) loader.lua $(SOURCE)
|
||||
|
||||
install-core:
|
||||
$(MKDIR) $(SOURCE)
|
||||
$(MKDIR) $(SOURCE)/core
|
||||
|
@ -89,7 +93,7 @@ install-meta:
|
|||
install-data:
|
||||
$(MKDIR_PRIVATE) $(DATA)
|
||||
|
||||
install: install-util install-net install-core install-plugins install-bin install-etc install-man install-meta install-data
|
||||
install: install-util install-net install-core install-plugins install-bin install-etc install-man install-meta install-data install-loader
|
||||
|
||||
clean:
|
||||
rm -f prosody.install
|
||||
|
|
9
loader.lua
Normal file
9
loader.lua
Normal file
|
@ -0,0 +1,9 @@
|
|||
for i = #package.searchers, 1, -1 do
|
||||
local search = package.searchers[i];
|
||||
table.insert(package.searchers, i, function(module_name)
|
||||
local lib = module_name:match("^prosody%.(.*)$");
|
||||
if lib then
|
||||
return search(lib);
|
||||
end
|
||||
end)
|
||||
end
|
6
makefile
6
makefile
|
@ -44,6 +44,10 @@ install-bin: prosody.install prosodyctl.install
|
|||
$(INSTALL_EXEC) ./prosody.install $(BIN)/prosody
|
||||
$(INSTALL_EXEC) ./prosodyctl.install $(BIN)/prosodyctl
|
||||
|
||||
install-loader:
|
||||
$(MKDIR) $(SOURCE)
|
||||
$(INSTALL_DATA) loader.lua $(SOURCE)
|
||||
|
||||
install-core:
|
||||
$(MKDIR) $(SOURCE)
|
||||
$(MKDIR) $(SOURCE)/core
|
||||
|
@ -91,7 +95,7 @@ install-meta:
|
|||
install-data:
|
||||
$(MKDIR_PRIVATE) $(DATA)
|
||||
|
||||
install: install-util install-net install-core install-plugins install-bin install-etc install-man install-meta install-data
|
||||
install: install-util install-net install-core install-plugins install-bin install-etc install-man install-meta install-data install-loader
|
||||
|
||||
clean:
|
||||
rm -f prosody.install
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue