Comparison

util/prosodyctl.lua @ 11134:3e3f22043552

util.prosodyctl: Move hardcoded luarocks server into prosodyctl To be replaced with config option in future commit
author Kim Alvefur <zash@zash.se>
date Mon, 05 Oct 2020 21:24:07 +0200
parent 11133:624eafed3343
child 11136:d0d3e25b7300
comparison
equal deleted inserted replaced
11133:624eafed3343 11134:3e3f22043552
225 end 225 end
226 end 226 end
227 227
228 local render_cli = interpolation.new("%b{}", function (s) return "'"..s:gsub("'","'\\''").."'" end) 228 local render_cli = interpolation.new("%b{}", function (s) return "'"..s:gsub("'","'\\''").."'" end)
229 229
230 local function call_luarocks(operation, mod) 230 local function call_luarocks(operation, mod, server)
231 local dir = get_path_custom_plugins(prosody.paths.plugins); 231 local dir = get_path_custom_plugins(prosody.paths.plugins);
232 if operation == "install" then 232 if operation == "install" then
233 show_message("Installing %s at %s", mod, dir); 233 show_message("Installing %s at %s", mod, dir);
234 elseif operation == "remove" then 234 elseif operation == "remove" then
235 show_message("Removing %s from %s", mod, dir); 235 show_message("Removing %s from %s", mod, dir);
236 end 236 end
237 if operation == "list" then 237 if operation == "list" then
238 os.execute(render_cli("luarocks list --tree={dir}", {dir = dir})); 238 os.execute(render_cli("luarocks list --tree={dir}", {dir = dir}));
239 else 239 else
240 os.execute(render_cli("luarocks {op} --tree={dir} {server&--server={server}} {mod}", { 240 os.execute(render_cli("luarocks {op} --tree={dir} {server&--server={server}} {mod}", {
241 dir = dir; op = operation; mod = mod; server = "http://localhost/"; 241 dir = dir; op = operation; mod = mod; server = server;
242 })); 242 }));
243 end 243 end
244 if operation == "install" then 244 if operation == "install" then
245 show_module_configuration_help(mod); 245 show_module_configuration_help(mod);
246 end 246 end