fix scm detection for specific git urls

pull/51/merge
Fabian Jakobs 2015-04-02 08:40:49 +00:00
rodzic 4909adf379
commit cb368e4ab9
2 zmienionych plików z 28 dodań i 4 usunięć

22
node_modules/c9/scm_url_parse.js wygenerowano vendored
Wyświetl plik

@ -31,17 +31,31 @@ define(function(require, exports, module) {
parsed.hostname &&
parsed.slashes &&
parsed.pathname
)
) {
var scm;
var provider = providers[parsed.hostname] || defaultProvider;
switch (provider) {
case "github":
scm = "git";
break;
case "bitbucket":
scm = parsed.pathname.match(/\.git$/) ? "git": "hg";
break;
default:
scm = parsed.pathname.match(/\.git$/) ? "git": "hg";
}
return {
protocol: parsed.protocol,
scm: parsed.pathname.match(/\.git$/) ? "git": "hg",
provider: providers[parsed.hostname] || defaultProvider,
scm: scm,
provider: provider,
auth: parsed.auth || "",
hostname: parsed.hostname,
pathname: parsed.pathname.replace(/^\/+/, ""),
full: url
};
else
}
else {
return null;
}
};
});

10
node_modules/c9/scm_url_parse_test.js wygenerowano vendored
Wyświetl plik

@ -64,6 +64,16 @@ describe(__filename, function(){
assert.equal(url.pathname, "fjakobs/juhu");
done();
});
it("should parse github URL without .git", function(done) {
var url = parse("https://github.com/arunoda/meteor-streams");
assert.equal(url.protocol, "https:");
assert.equal(url.scm, "git");
assert.equal(url.provider, "github");
assert.equal(url.hostname, "github.com");
assert.equal(url.pathname, "arunoda/meteor-streams");
done();
});
});
});