Software / code / prosody
Comparison
prosodyctl @ 10154:ad081451291f
prosodyctl: Created a temporary function, that automatically sets up a repo with rockspecs for prosody modules
| author | João Duarte <jvsDuarte08@gmail.com> |
|---|---|
| date | Tue, 23 Jul 2019 13:27:19 -0700 |
| parent | 10153:a88fd34246bd |
| child | 10155:ebe39918d430 |
comparison
equal
deleted
inserted
replaced
| 10153:a88fd34246bd | 10154:ad081451291f |
|---|---|
| 82 | 82 |
| 83 local prosodyctl_timeout = (configmanager.get("*", "prosodyctl_timeout") or 5) * 2; | 83 local prosodyctl_timeout = (configmanager.get("*", "prosodyctl_timeout") or 5) * 2; |
| 84 ----------------------- | 84 ----------------------- |
| 85 local commands = {}; | 85 local commands = {}; |
| 86 local command = table.remove(arg, 1); | 86 local command = table.remove(arg, 1); |
| 87 | |
| 88 function commands.magic(arg) | |
| 89 --print("Getting all the available modules") | |
| 90 --os.execute("hg clone https://hg.prosody.im/prosody-modules/ downloaded_modules") | |
| 91 local i, popen = 0, io.popen | |
| 92 local flag = "mod_" | |
| 93 os.execute("mkdir repository") | |
| 94 local pfile = popen('ls -a "'..arg[1]..'"') | |
| 95 for filename in pfile:lines() do | |
| 96 i = i + 1 | |
| 97 if filename:sub(1, #flag) == flag then | |
| 98 local file = io.open("repository/"..filename.."-scm-1.rockspec", "w") | |
| 99 file:write('package = "'..filename..'"', '\n') | |
| 100 file:write('version = "scm-1"', '\n') | |
| 101 file:write('source = {', '\n') | |
| 102 file:write('\turl = "hg+https://hg.prosody.im/prosody-modules",', '\n') | |
| 103 file:write('\tdir = "prosody-modules"', '\n') | |
| 104 file:write('}', '\n') | |
| 105 file:write('description = {', '\n') | |
| 106 file:write('\thomepage = "https://prosody.im/",', '\n') | |
| 107 file:write('\tlicense = "MIT"', '\n') | |
| 108 file:write('}', '\n') | |
| 109 file:write('dependencies = {', '\n') | |
| 110 file:write('\t"lua >= 5.1"', '\n') | |
| 111 file:write('}', '\n') | |
| 112 file:write('build = {', '\n') | |
| 113 file:write('\ttype = "builtin",', '\n') | |
| 114 file:write('\tmodules = {', '\n') | |
| 115 file:write('\t\t["'..filename..'.'..filename..'"] = "'..filename..'/'..filename..'.lua"', '\n') | |
| 116 file:write('\t}', '\n') | |
| 117 file:write('}', '\n') | |
| 118 file:close() | |
| 119 end | |
| 120 end | |
| 121 pfile:close() | |
| 122 os.execute("cd repository/ && luarocks-admin make_manifest ./ && chmod -R 644 ./*") | |
| 123 end | |
| 87 | 124 |
| 88 -- This function receives no arguments. It clones all the plugins from prosody's plugin repository | 125 -- This function receives no arguments. It clones all the plugins from prosody's plugin repository |
| 89 function commands.get_modules(arg) | 126 function commands.get_modules(arg) |
| 90 if arg[1] == "--help" then | 127 if arg[1] == "--help" then |
| 91 show_usage([[get_modules]], [[Downloads all available modules]]); | 128 show_usage([[get_modules]], [[Downloads all available modules]]); |