Skip to content

Commit 98da83a

Browse files
committed
Fix urijs dependency on linux
1 parent 5344a30 commit 98da83a

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

lib/utils/git.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
var Q = require("q");
2-
var _ = require("lodash");
3-
var path = require("path");
4-
var crc = require("crc");
5-
var exec = Q.denodeify(require("child_process").exec);
6-
var URI = require("URIjs");
7-
var pathUtil = require("./path");
1+
var Q = require('q');
2+
var _ = require('lodash');
3+
var path = require('path');
4+
var crc = require('crc');
5+
var exec = Q.denodeify(require('child_process').exec);
6+
var URI = require('urijs');
7+
var pathUtil = require('./path');
88

9-
var fs = require("./fs");
9+
var fs = require('./fs');
1010

11-
var GIT_PREFIX = "git+";
11+
var GIT_PREFIX = 'git+';
1212
var GIT_TMP = null;
1313

1414

@@ -30,20 +30,20 @@ function parseGitUrl(giturl) {
3030
giturl = giturl.slice(GIT_PREFIX.length);
3131

3232
uri = new URI(giturl);
33-
ref = uri.fragment() || "master";
33+
ref = uri.fragment() || 'master';
3434
uri.fragment(null);
3535

3636
// Extract file inside the repo (after the .git)
37-
fileParts =uri.path().split(".git");
38-
filepath = fileParts.length > 1? fileParts.slice(1).join(".git") : "";
39-
if (filepath[0] == "/") filepath = filepath.slice(1);
37+
fileParts =uri.path().split('.git');
38+
filepath = fileParts.length > 1? fileParts.slice(1).join('.git') : '';
39+
if (filepath[0] == '/') filepath = filepath.slice(1);
4040

4141
// Recreate pathname without the real filename
42-
uri.path(_.first(fileParts)+".git");
42+
uri.path(_.first(fileParts)+'.git');
4343

4444
return {
4545
host: uri.toString(),
46-
ref: ref || "master",
46+
ref: ref || 'master',
4747
filepath: filepath
4848
};
4949
}
@@ -52,7 +52,7 @@ function parseGitUrl(giturl) {
5252
function cloneGitRepo(host, ref) {
5353
var isBranch = false;
5454

55-
ref = ref || "master";
55+
ref = ref || 'master';
5656
if (!validateSha(ref)) isBranch = true;
5757

5858
return Q()
@@ -69,7 +69,7 @@ function cloneGitRepo(host, ref) {
6969
// Return or clone the git repo
7070
.then(function() {
7171
// Unique ID for repo/ref combinaison
72-
var repoId = crc.crc32(host+"#"+ref).toString(16);
72+
var repoId = crc.crc32(host+'#'+ref).toString(16);
7373

7474
// Absolute path to the folder
7575
var repoPath = path.resolve(GIT_TMP, repoId);
@@ -79,9 +79,9 @@ function cloneGitRepo(host, ref) {
7979
if (doExists) return;
8080

8181
// Clone repo
82-
return exec("git clone "+host+" "+repoPath)
82+
return exec('git clone '+host+' '+repoPath)
8383
.then(function() {
84-
return exec("git checkout "+ref, { cwd: repoPath });
84+
return exec('git checkout '+ref, { cwd: repoPath });
8585
});
8686
})
8787
.thenResolve(repoPath);

0 commit comments

Comments
 (0)