Add support for 'haxelib path lib:ver' using git, hg, etc directories

This commit is contained in:
Joshua Granick
2017-05-22 11:51:14 -07:00
parent 9cf8092f40
commit 8d4b5151b5

View File

@@ -1086,16 +1086,23 @@ class Main {
continue;
v = Data.unsafe(v);
var semver = try SemVer.ofString(v) catch (_:Dynamic) null;
if ( semver == null ) {
var json = try File.getContent(dir+"/"+v+"/"+Data.JSON) catch( e : Dynamic ) null;
if ( json != null ) {
var inf = Data.readData(json, false);
semver = try SemVer.ofString(inf.version) catch (_:Dynamic) null;
}
}
if (semver != null && matchVersion(version, semver))
matches.push(semver);
matches.push({ dir: v, ver: semver });
}
var best = null;
var best:Dynamic = null;
for( match in matches ) {
if (best == null || match > best) {
if (best == null || match.ver > best.ver) {
best = match;
}
}
return if (best != null) dir + "/" + Data.safe(best) else null;
return if (best != null) dir + "/" + Data.safe(best.dir) else null;
}
function list() {