Software /
code /
prosody
Comparison
prosodyctl @ 10168:f365f814d641
prosodyctl: Custom plugins paths are now retrieved by an helper function
author | João Duarte <jvsDuarte08@gmail.com> |
---|---|
date | Wed, 24 Jul 2019 11:26:29 -0700 |
parent | 10166:4d1206ac0d41 |
child | 10169:25deff8b2db4 |
comparison
equal
deleted
inserted
replaced
10167:f343ed1f02fd | 10168:f365f814d641 |
---|---|
88 function commands.install(arg) | 88 function commands.install(arg) |
89 if arg[1] == "--help" then | 89 if arg[1] == "--help" then |
90 show_usage([[make]], [[Installs a prosody/luarocks plugin]]); | 90 show_usage([[make]], [[Installs a prosody/luarocks plugin]]); |
91 return 1; | 91 return 1; |
92 end | 92 end |
93 local installer_plugin_path | 93 local installer_plugin_path = prosodyctl.get_path_custom_plugins(prosody.paths.plugins) |
94 -- I'm considering that we are using just one path to custom plugins, and it is the first in prosody.paths.plugins, for now | |
95 for path in prosody.paths.plugins:gmatch("[^;]+") do | |
96 installer_plugin_path = path | |
97 break | |
98 end | |
99 -- I'm considering this optional flag comes first | 94 -- I'm considering this optional flag comes first |
100 local flag = "--tree=" | 95 local flag = "--tree=" |
101 if arg[1] and arg[1]:sub(1, #flag) == flag then | 96 if arg[1] and arg[1]:sub(1, #flag) == flag then |
102 local dir = arg[1]:match("=(.+)$") | 97 local dir = arg[1]:match("=(.+)$") |
103 print("Installing module "..arg[2].." at "..dir) | 98 print("Installing module "..arg[2].." at "..dir) |
118 if arg[1] == "--help" then | 113 if arg[1] == "--help" then |
119 show_usage([[make]], [[Removes a module installed in the wroking directory's plugins folder]]); | 114 show_usage([[make]], [[Removes a module installed in the wroking directory's plugins folder]]); |
120 return 1; | 115 return 1; |
121 end | 116 end |
122 -- I'm considering that we are using just one path to custom plugins, and it is the first in prosody.paths.plugins, for now | 117 -- I'm considering that we are using just one path to custom plugins, and it is the first in prosody.paths.plugins, for now |
123 for path in prosody.paths.plugins:gmatch("[^;]+") do | 118 local installer_plugin_path = prosodyctl.get_path_custom_plugins(prosody.paths.plugins) |
124 installer_plugin_path = path | |
125 break | |
126 end | |
127 local flag = "--tree=" | 119 local flag = "--tree=" |
128 -- I'm considering this optional flag comes first | 120 -- I'm considering this optional flag comes first |
129 if arg[1] and arg[1]:sub(1, #flag) == flag then | 121 if arg[1] and arg[1]:sub(1, #flag) == flag then |
130 local dir = arg[1]:match("=(.+)$") | 122 local dir = arg[1]:match("=(.+)$") |
131 print("Removing module "..arg[2].." at "..dir) | 123 print("Removing module "..arg[2].." at "..dir) |
143 if arg[1] == "--help" then | 135 if arg[1] == "--help" then |
144 show_usage([[list]], [[Shows installed rocks]]); | 136 show_usage([[list]], [[Shows installed rocks]]); |
145 return 1; | 137 return 1; |
146 end | 138 end |
147 -- I'm considering that we are using just one path to custom plugins, and it is the first in prosody.paths.plugins, for now | 139 -- I'm considering that we are using just one path to custom plugins, and it is the first in prosody.paths.plugins, for now |
148 for path in prosody.paths.plugins:gmatch("[^;]+") do | 140 local installer_plugin_path = prosodyctl.get_path_custom_plugins(prosody.paths.plugins) |
149 installer_plugin_path = path | |
150 break | |
151 end | |
152 local flag = "--tree=" | 141 local flag = "--tree=" |
153 -- I'm considering this optional flag comes first | 142 -- I'm considering this optional flag comes first |
154 if arg[1] and arg[1]:sub(1, #flag) == flag then | 143 if arg[1] and arg[1]:sub(1, #flag) == flag then |
155 local dir = arg[1]:match("=(.+)$") | 144 local dir = arg[1]:match("=(.+)$") |
156 os.execute("luarocks list --tree='"..dir.."'") | 145 os.execute("luarocks list --tree='"..dir.."'") |