Skip to content

Commit

Permalink
Merge branch 'development' of github.com:HaxeFoundation/haxelib into …
Browse files Browse the repository at this point in the history
…development

(sorry)
  • Loading branch information
RealyUniqueName committed Nov 2, 2019
2 parents 2fa2f6a + ce9ecd4 commit c994dc4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
Binary file modified run.n
Binary file not shown.
24 changes: 14 additions & 10 deletions src/haxelib/Data.hx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/
package haxelib;

import haxe.CallStack;
import haxe.ds.Option;
import haxe.ds.*;
import haxe.zip.Reader;
Expand Down Expand Up @@ -63,27 +64,30 @@ abstract DependencyVersion(String) to String from SemVer {

@:to function toValidatable():Validatable
return
if (this == '') { validate: function () return None }
else @:privateAccess new SemVer(this);
if (this == '' || this == 'git' || (Std.is(this, String) && this.startsWith('git:')))
{ validate: function () return None }
else
@:privateAccess new SemVer(this);

static public function isValid(s:String)
return new DependencyVersion(s).toValidatable().validate() == None;

static public var DEFAULT(default, null) = new DependencyVersion('');
static public var GIT(default, null) = new DependencyVersion('git');
}

abstract Dependencies(Dynamic<DependencyVersion>) from Dynamic<DependencyVersion> {
@:to public function toArray():Array<Dependency> {
var fields = Reflect.fields(this);
fields.sort(Reflect.compare);

var result:Array<Dependency> = new Array<Dependency>();

for (f in fields) {
var value:String = Reflect.field(this, f);

var isGit = value != null && (value + "").startsWith("git:");
var isGit = value != null && (value + "").startsWith("git:");

if ( !isGit )
{
result.push ({
Expand All @@ -101,7 +105,7 @@ abstract Dependencies(Dynamic<DependencyVersion>) from Dynamic<DependencyVersion
var urlParts = value.split("#");
var url = urlParts[0];
var branch = urlParts.length > 1 ? urlParts[1] : null;

result.push ({
name: f,
type: (DependencyType.Git : DependencyType),
Expand All @@ -111,10 +115,10 @@ abstract Dependencies(Dynamic<DependencyVersion>) from Dynamic<DependencyVersion
branch: (branch : String),
});
}


}

return result;
}
public inline function iterator()
Expand Down
2 changes: 2 additions & 0 deletions test/tests/integration/TestPath.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package tests.integration;

import haxe.io.Path;
using IntegrationTests;
using StringTools;
using Lambda;

class TestPath extends IntegrationTests {
#if !system_haxelib
Expand Down

0 comments on commit c994dc4

Please sign in to comment.