prosodyctl
changeset 10182 badc8610bfdf
parent 10176 5da519ef2d51
child 10183 2364e9533d0e
equal deleted inserted replaced
10181:e9b47fcde93c 10182:badc8610bfdf
    93 	local installer_plugin_path = prosodyctl.get_path_custom_plugins(prosody.paths.plugins)
    93 	local installer_plugin_path = prosodyctl.get_path_custom_plugins(prosody.paths.plugins)
    94 	-- I'm considering this optional flag comes first
    94 	-- I'm considering this optional flag comes first
    95 	local flag = "--tree="
    95 	local flag = "--tree="
    96 	if arg[1] and arg[1]:sub(1, #flag) == flag then
    96 	if arg[1] and arg[1]:sub(1, #flag) == flag then
    97 		local dir = arg[1]:match("=(.+)$")
    97 		local dir = arg[1]:match("=(.+)$")
    98 		print("Installing module "..arg[2].." at "..dir)
    98 		show_message("Installing module %s at %s", arg[2], dir)
    99 		os.execute("luarocks --tree='"..dir.."' --server='http://localhost/' install "..arg[2])
    99 		os.execute("luarocks --tree='"..dir.."' --server='http://localhost/' install "..arg[2])
   100 		show_module_configuration_help(arg[2]);
   100 		show_module_configuration_help(arg[2]);
   101 		return 0;
   101 		return 0;
   102 	else
   102 	else
   103 		print("Installing module "..arg[1].." at "..installer_plugin_path)
   103 		show_message("Installing module %s at %s", arg[1], installer_plugin_path)
   104 		-- I've build a local server to upload some new rockspecs, like mod_smacks'. We can replace this server by one from
   104 		-- I've build a local server to upload some new rockspecs, like mod_smacks'. We can replace this server by one from
   105 		-- prosody's, where we can oficially disbrute rocks/rockspecs for all modules
   105 		-- prosody's, where we can oficially disbrute rocks/rockspecs for all modules
   106 		os.execute("luarocks --tree='"..installer_plugin_path.."' --server='http://localhost/' install "..arg[1])
   106 		os.execute("luarocks --tree='"..installer_plugin_path.."' --server='http://localhost/' install "..arg[1])
   107 		show_module_configuration_help(arg[1]);
   107 		show_module_configuration_help(arg[1]);
   108 		return 0;
   108 		return 0;
   118 	local installer_plugin_path = prosodyctl.get_path_custom_plugins(prosody.paths.plugins)
   118 	local installer_plugin_path = prosodyctl.get_path_custom_plugins(prosody.paths.plugins)
   119 	local flag = "--tree="
   119 	local flag = "--tree="
   120 	-- I'm considering this optional flag comes first
   120 	-- I'm considering this optional flag comes first
   121 	if arg[1] and arg[1]:sub(1, #flag) == flag then
   121 	if arg[1] and arg[1]:sub(1, #flag) == flag then
   122 		local dir = arg[1]:match("=(.+)$")
   122 		local dir = arg[1]:match("=(.+)$")
   123 		print("Removing module "..arg[2].." at "..dir)
   123 		show_message("Removing module %s at %s", arg[2], dir)
   124 		os.execute("luarocks remove --tree='"..dir.."' "..arg[2])
   124 		os.execute("luarocks remove --tree='"..dir.."' "..arg[2])
   125 		return 0;
   125 		return 0;
   126 	else
   126 	else
   127 		print("Removing "..arg[1].." from "..installer_plugin_path)
   127 		show_message("Removing %s from %s", arg[1], installer_plugin_path)
   128 		os.execute("luarocks --tree='"..installer_plugin_path.."' remove "..arg[1])
   128 		os.execute("luarocks --tree='"..installer_plugin_path.."' remove "..arg[1])
   129 		print("Done!")
       
   130 		return 0;
   129 		return 0;
   131 	end
   130 	end
   132 end
   131 end
   133 
   132 
   134 function commands.list(arg)
   133 function commands.list(arg)