Skip to content

Commit

Permalink
fix install
Browse files Browse the repository at this point in the history
  • Loading branch information
Hsiaoming Yang committed Mar 19, 2013
1 parent f8b153c commit 789341c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
11 changes: 7 additions & 4 deletions lib/install.js
Expand Up @@ -122,6 +122,7 @@ function fetch(query, callback) {
if (err) {
fetchCache(data, function(err, result) {
if (err) {
log.warn('warn', err);
fetchGit(data, callback);
} else {
callback(null, result);
Expand Down Expand Up @@ -189,11 +190,13 @@ function fetchGit(pkg, callback) {
var revision = pkg.revision || pkg.version || 'HEAD';
log.debug('revision', revision);
if (fs.existsSync(dest)) {
git.pull({cwd: dest}, function(err) {
err && log.warn('git', err);
git.checkout(revision, {cwd: dest}, function(err) {
git.checkout('master', {cwd: dest}, function(err) {
git.pull({cwd: dest}, function(err) {
err && log.warn('git', err);
callback(null, dest);
git.checkout(revision, {cwd: dest}, function(err) {
err && log.warn('git', err);
callback(null, dest);
});
});
});
return;
Expand Down
2 changes: 1 addition & 1 deletion lib/sdk/git.js
Expand Up @@ -8,7 +8,7 @@ git.revision = function(options, callback) {
};

git.checkout = function(rev, options, callback) {
exec('git checkout ' + rev, options, callback);
exec('git checkout -q ' + rev, options, callback);
};

git.clone = function(url, dest, options, callback) {
Expand Down
2 changes: 1 addition & 1 deletion lib/sdk/module.js
Expand Up @@ -76,7 +76,7 @@ exports.plainDependencies = function(deps) {
};

function parseIdentify(id) {
var regex = /^((?:[a-z][a-z0-9\-]*\/)?[a-z][a-z0-9\-]*)\/(\d+\.\d+\.\d+)\/([a-z0-9\-\/]+)$/;
var regex = /^((?:[a-z][a-z0-9\-]*\/)?[a-z][a-z0-9\-]*)\/(\d+\.\d+\.\d+)\/([a-z0-9\-\/\.]+)$/;
var match = id.match(regex);
if (!match) return null;
var keys = match[1].split('/');
Expand Down
4 changes: 1 addition & 3 deletions lib/sdk/yuan.js
Expand Up @@ -316,9 +316,7 @@ function sort(versions) {
var ret = {};
vers.forEach(function(v) {
var pkg = versions[v];
if (pkg.filename) {
ret[v] = pkg;
}
ret[v] = pkg;
});
return ret;
}

0 comments on commit 789341c

Please sign in to comment.