# HG changeset patch # User João Duarte # Date 1563296892 25200 # Node ID e1ca0d1b5467f9f621ffb83eec5a9ff8d9353500 # Parent 04aea97afee9fbf341837933e45684615c9cee73 prosodyctl: Added the 'write_rockspec' function diff -r 04aea97afee9 -r e1ca0d1b5467 prosodyctl --- a/prosodyctl Tue Jul 16 10:05:31 2019 -0700 +++ b/prosodyctl Tue Jul 16 10:08:12 2019 -0700 @@ -113,6 +113,22 @@ 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 + function commands.list(arg) if not arg[1] or arg[1] == "--help" then show_usage([[list]], [[Shows installed rocks]]);