Comparison

prosodyctl @ 10138:e1ca0d1b5467

prosodyctl: Added the 'write_rockspec' function
author João Duarte <jvsDuarte08@gmail.com>
date Tue, 16 Jul 2019 10:08:12 -0700
parent 10137:04aea97afee9
child 10139:7aa3d8155c96
comparison
equal deleted inserted replaced
10137:04aea97afee9 10138:e1ca0d1b5467
109 print("Getting all the available modules") 109 print("Getting all the available modules")
110 os.execute("hg clone https://hg.prosody.im/prosody-modules/ downloaded_modules") 110 os.execute("hg clone https://hg.prosody.im/prosody-modules/ downloaded_modules")
111 print("Done!") 111 print("Done!")
112 return 0 112 return 0
113 end 113 end
114 end
115
116 -- Function to write rockspecs from a module at working_directory/downloaded_modules
117 -- Receives the module's name as an argument
118 -- The rockspec is saved inside its module's folder
119 function commands.write_rockspec(arg)
120 if arg[1] == "--help" then
121 show_usage([[write_rockspec]], [[Picks up a module and writes an initial rockspec]]);
122 return 1
123 end
124 print("Writing rockspec for "..arg[1])
125 os.execute("luarocks write_rockspec "..arg[1].." ./downloaded_modules/"..arg[1])
126 print("Rockspec created! Moving it into the ./downloaded_modules/"..arg[1].." folder")
127 os.execute("mv "..arg[1].."-scm-1.rockspec ./downloaded_modules/"..arg[1])
128 print("Done!")
129 return 0
114 end 130 end
115 131
116 function commands.list(arg) 132 function commands.list(arg)
117 if not arg[1] or arg[1] == "--help" then 133 if not arg[1] or arg[1] == "--help" then
118 show_usage([[list]], [[Shows installed rocks]]); 134 show_usage([[list]], [[Shows installed rocks]]);