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 |
|
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 |
93 -- I'm considering this optional flag comes first |
99 -- I'm considering this optional flag comes first |
94 local flag = "--tree=" |
100 local flag = "--tree=" |
95 if arg[1] and arg[1]:sub(1, #flag) == flag then |
101 if arg[1] and arg[1]:sub(1, #flag) == flag then |
96 local dir = arg[1]:match("=(.+)$") |
102 local dir = arg[1]:match("=(.+)$") |
97 print("Installing module "..arg[2].." at "..dir) |
103 print("Installing module "..arg[2].." at "..dir) |
98 os.execute("luarocks --tree='"..dir.."' --server='http://localhost/' install "..arg[2]) |
104 os.execute("luarocks --tree='"..dir.."' --server='http://localhost/' install "..arg[2]) |
99 show_module_configuration_help(arg[2]); |
105 show_module_configuration_help(arg[2]); |
100 return 0; |
106 return 0; |
101 else |
107 else |
102 print("Installing module "..arg[1].." at "..prosody.paths.plugins) |
108 print("Installing module "..arg[1].." at "..installer_plugin_path) |
103 -- I've build a local server to upload some new rockspecs, like mod_smacks'. We can replace this server by one from |
109 -- I've build a local server to upload some new rockspecs, like mod_smacks'. We can replace this server by one from |
104 -- prosody's, where we can oficially disbrute rocks/rockspecs for all modules |
110 -- prosody's, where we can oficially disbrute rocks/rockspecs for all modules |
105 os.execute("luarocks --tree='"..prosody.paths.plugins.."' --server='http://localhost/' install "..arg[1]) |
111 os.execute("luarocks --tree='"..installer_plugin_path.."' --server='http://localhost/' install "..arg[1]) |
106 show_module_configuration_help(arg[1]); |
112 show_module_configuration_help(arg[1]); |
107 return 0; |
113 return 0; |
108 end |
114 end |
109 end |
115 end |
110 |
116 |