> On 29 Dec 2017, at 10:35, Cyril Ferlicot D. <[email protected]> wrote: > > Hi, > > In order to improve the usage of Pharo and the git integration there is > some discussions around Metacello in order to be able to: > > - Load a private git project from Metacello API > - Load a project hosted on a private server from Metacello API > - Load a project hosted on a private server with non default ssh port > from Metacello API > - Depend on a private git project in a baseline > - Depend on a project hosted on a private server in a baseline > - Depend on a project hosted on a private server with non default ssh > port in a baseline > > To achieve this, Metacello needs to be able to manage urls like: > > - '[email protected]:Projet/Bazard.git' > - 'ssh://[email protected]:3456/Projet/Bazard.git' > > and many others. > > Dale wants to use Zinc to manage urls's in Pharo. > > It works great for this url: > > 'ssh://[email protected]:3456/Projet/Bazard.git' asUrl > > It gives an instance of ZnUrl of the ssh scheme, gitlab.ferlicot.fr as > host, 3456 as port, git as username and #('Project' 'Bazard.git') as > segments. > > Now the problem is that it does not work well for this url: > > '[email protected]:Projet/Bazard.git' asUrl
ZnUrl fromString: '[email protected]/Projet/Bazard.git' defaultScheme: #http. ZnUrl fromString: '[email protected]/Projet/Bazard.git' defaultScheme: #ssh. URI/URL are put in classes or types based on their scheme. If there is no explicit scheme in the URI/URL itself, you have to supply a default one. That being said, the general syntax supported by ZnUrl is approximately scheme://username:password@host:port/segments?query#fragment The colon right after the host is reserved for a port, a path has to start with a / (unless you are using relative URL's, but then you need a parent context). This is why I changed your example, to make it work. There literally exist hundreds of schemes, some with very weird syntax. That is indeed the prerogative of a scheme, to define its own special syntax. However, the straightforward approach of the ZnUrl parser cannot recognise those. The question then becomes: how to provide an extension mechanism for exotic schemes ? Although the question has come up a couple of times, it has never been very urgent. I know that some people have programmed around this limitation, maybe they could tell us what they did. > It gives an instance of ZnUrl with #('[email protected]:Projet' > 'Bazard.git') as segments. > > What do you think guys about this issue? Could the flexibility of ZnUrls > be improved in order to be able to use it? Should Metacello use another way? > > To see the full discussions: > - Github issue: https://github.com/Metacello/metacello/issues/474 > - Metacello group discussion: > https://groups.google.com/forum/#!topic/metacello/QbpngL6Jhg8 > > Have a nice day :) > > -- > Cyril Ferlicot > https://ferlicot.fr > > http://www.synectique.eu > 2 rue Jacques Prévert 01, > 59650 Villeneuve d'ascq France >
