diff options
author | Jo?o Duarte <jvsDuarte08@gmail.com> | 2019-07-24 04:24:29 -0700 |
---|---|---|
committer | Jo?o Duarte <jvsDuarte08@gmail.com> | 2019-07-24 04:24:29 -0700 |
commit | cb27e192f3fbadda2652dfa8ebd0ec38bdaf1631 (patch) | |
tree | a5b14eb70ceb579c03b152131c18f59b6728ce94 | |
parent | aa7360c3691a2779254eca84871959cb271b13cc (diff) | |
download | prosody-cb27e192f3fbadda2652dfa8ebd0ec38bdaf1631.tar.gz prosody-cb27e192f3fbadda2652dfa8ebd0ec38bdaf1631.zip |
prosodyctl: Removed the development commands magic, get_modules and write_rockspec
-rwxr-xr-x | prosodyctl | 82 |
1 files changed, 0 insertions, 82 deletions
@@ -85,88 +85,6 @@ local prosodyctl_timeout = (configmanager.get("*", "prosodyctl_timeout") or 5) * local commands = {}; local command = table.remove(arg, 1); -function commands.magic(arg) - --print("Getting all the available modules") - --os.execute("hg clone https://hg.prosody.im/prosody-modules/ downloaded_modules") - local i, popen = 0, io.popen - local flag = "mod_" - os.execute("mkdir repository") - local pfile = popen('ls -a "'..arg[1]..'"') - for filename in pfile:lines() do - i = i + 1 - if filename:sub(1, #flag) == flag then - local file = io.open("repository/"..filename.."-scm-1.rockspec", "w") - file:write('package = "'..filename..'"', '\n') - file:write('version = "scm-1"', '\n') - file:write('source = {', '\n') - file:write('\turl = "hg+https://hg.prosody.im/prosody-modules",', '\n') - file:write('\tdir = "prosody-modules"', '\n') - file:write('}', '\n') - file:write('description = {', '\n') - file:write('\thomepage = "https://prosody.im/",', '\n') - file:write('\tlicense = "MIT"', '\n') - file:write('}', '\n') - file:write('dependencies = {', '\n') - file:write('\t"lua >= 5.1"', '\n') - file:write('}', '\n') - file:write('build = {', '\n') - file:write('\ttype = "builtin",', '\n') - file:write('\tmodules = {', '\n') - file:write('\t\t["'..filename..'.'..filename..'"] = "'..filename..'/'..filename..'.lua"', '\n') - file:write('\t}', '\n') - file:write('}', '\n') - file:close() - end - end - pfile:close() - os.execute("cd repository/ && luarocks-admin make_manifest ./ && chmod -R 644 ./*") -end - --- This function receives no arguments. It clones all the plugins from prosody's plugin repository -function commands.get_modules(arg) - if arg[1] == "--help" then - show_usage([[get_modules]], [[Downloads all available modules]]); - return 1; - end - if os.execute '[ -e "./downloaded_modules" ]' then - print("The modules have already been imported") - print("Do you want to re-import?(Y/N)") - local answer = io.read() - if answer == "Y" then - print("Deleting previous imports") - os.execute("rm -rf downloaded_modules") - print("Downloading plugins") - os.execute("hg clone https://hg.prosody.im/prosody-modules/ downloaded_modules") - print("Done!") - return 0; - else - print("We keep what we have then!") - return 0; - end - else - print("Getting all the available modules") - os.execute("hg clone https://hg.prosody.im/prosody-modules/ downloaded_modules") - print("Done!") - return 0; - end -end - --- Function to write rockspecs from a module at working_directory/downloaded_modules --- Receives the module's name as an argument --- The rockspec is saved inside its module's folder -function commands.write_rockspec(arg) - if arg[1] == "--help" then - show_usage([[write_rockspec]], [[Picks up a module and writes an initial rockspec]]); - return 1; - end - print("Writing rockspec for "..arg[1]) - os.execute("luarocks write_rockspec "..arg[1].." ./downloaded_modules/"..arg[1]) - print("Rockspec created! Moving it into the ./downloaded_modules/"..arg[1].." folder") - os.execute("mv "..arg[1].."-scm-1.rockspec ./downloaded_modules/"..arg[1]) - print("Done!") - return 0; -end - -- Command to install a rockspec with local sources -- The module is installed at the plugins folder function commands.make(arg) |