Hello!
On Fri, Dec 20, 2013 at 5:19 AM, Aapo Talvensaari wrote:
> Great. I started to think about this naming conflict, and I think that we
> should have a convention in place for packages.
I'm thinking about this too, for the centralized package manager.
Maybe we can follow the github convention here, prefix the module
author's nick in the module name to install, for example,
lresty install agentzh/resty.random
When the user simply type a Lua module name without giving the author
prefix, as in
lresty install resty.random
then lresty will just prompt the user with a list of Lua modules with
the name "resty.random" from different authors, for example,
$ lresty install resty.random
I have several resty.random modules for your to choose from:
[1] bakins/resty.random
[2] agentzh/resty.random
[3] leafo/resty.random
Which one do you want to install (type a number)?
When there is only one match, lresty will just proceed without prompting.
We can also introduce a module registration mechanism, that is,
certain modules can be registered on the centralized package site.
This process has to be approved by the administrators. For registered
Lua modules, when the user simply type the module name, the registered
one will be installed without prompting even when there are other
candidates. The user can still install other unregistered modules by
explicitly specifying the author prefix, like "bakins/resty.random".
> Even without package
> management. I think that we should follow the convention you have used in
> lua-resty-core.
>
> E.g.
>
> /usr/local/openresty/lualib/resty/core.lua
> /usr/local/openresty/lualib/restycore/* (all other lib files, if any)
>
> So I propose that lua-resty-string should follow this too (this is a
> breaking change, I know, but better to to it now than later).
No. I think module names and the library name (or distribution name)
are two separate things. For the example you talk about above,
lua-resty-string is the library name, or distribution name, while
resty.random, resty.string, and etc are module names inside this
library (or distribution).
We could, however, move the resty.random module out of the
lua-resty-string library, and put it into a lua-resty-random library,
for example (and I admit it is indeed better). But having a
resty.random in a Lua library with whatever name is totally fine,
technically :)
For the package management site, we can also put some automatic code
checking hooks when the author publish his Lua code. But we should
have something running first :)
Best regards,
-agentzh