Software / code / prosody
Comparison
prosodyctl @ 10150:baded8cd7da3
prosodyctl: Corrected the outputs from the install command
| author | João Duarte <jvsDuarte08@gmail.com> |
|---|---|
| date | Tue, 23 Jul 2019 08:36:06 -0700 |
| parent | 10149:0a24d886734a |
| child | 10151:e58034955002 |
comparison
equal
deleted
inserted
replaced
| 10149:0a24d886734a | 10150:baded8cd7da3 |
|---|---|
| 163 end | 163 end |
| 164 end | 164 end |
| 165 | 165 |
| 166 function commands.install(arg) | 166 function commands.install(arg) |
| 167 if arg[1] == "--help" then | 167 if arg[1] == "--help" then |
| 168 show_usage([[make]], [[Installs a rockspec/rock from a specified server]]); | 168 show_usage([[make]], [[Installs a prosody/luarocks plugin]]); |
| 169 return 1; | 169 return 1; |
| 170 end | 170 end |
| 171 -- Need to think about the case with many flags | 171 -- Need to think about the case with many flags |
| 172 local flag = "--tree=" | 172 local flag = "--tree=" |
| 173 -- I'm considering the flag is the first, but there can be many flags | 173 -- I'm considering the flag is the first, but there can be many flags |
| 174 if arg[1] and arg[1]:sub(1, #flag) == flag then | 174 if arg[1] and arg[1]:sub(1, #flag) == flag then |
| 175 local dir = arg[1]:match("=(.+)$") | 175 local dir = arg[1]:match("=(.+)$") |
| 176 print("Installing module "..arg[2].." at "..dir..", from luarocks repo") | 176 print("Installing module "..arg[2].." at "..dir) |
| 177 -- These extra double brackets allow us to correctly process names with spaces | 177 -- These extra double brackets allow us to correctly process names with spaces |
| 178 os.execute("luarocks install --tree='"..dir.."' "..arg[2]) | 178 os.execute("luarocks install --tree='"..dir.."' "..arg[2]) |
| 179 return 0; | 179 return 0; |
| 180 else | 180 else |
| 181 print("Installing module "..arg[1].." locally, from luarocks repo") | 181 print("Installing module "..arg[1].." at "..prosody.paths.plugins) |
| 182 os.execute("luarocks --tree='"..prosody.paths.plugins.."' install "..arg[1]) | 182 os.execute("luarocks --tree='"..prosody.paths.plugins.."' install "..arg[1]) |
| 183 return 0; | 183 return 0; |
| 184 end | 184 end |
| 185 end | 185 end |
| 186 | 186 |