Skip to content

Commit

Permalink
Fix CS.
Browse files Browse the repository at this point in the history
  • Loading branch information
satazor committed Oct 30, 2012
1 parent 07b93ff commit 9e3081e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/core/package.js
Expand Up @@ -364,7 +364,7 @@ Package.prototype.exists = function (callback) {

Package.prototype.clone = function () {
template('action', { name: 'cloning', shizzle: this.gitUrl }).on('data', this.emit.bind(this, 'data'));
this.path = path.resolve(config.cache, this.name, this.resourceId);
this.path = path.resolve(config.cache, this.name, this.resourceId);
this.once('cache', function () {
this.once('loadJSON', this.copy.bind(this)).checkout();
}.bind(this)).cache();
Expand Down Expand Up @@ -402,7 +402,7 @@ Package.prototype.cache = function () {
var cp = spawn('git', ['clone', url, this.path]);

cp.on('close', function (code) {
if (code > 0) return this.emit('error', new Error('Git status: ' + code));
if (code) return this.emit('error', new Error('Git status: ' + code));
this.emit('cache');
}.bind(this));
}.bind(this));
Expand Down Expand Up @@ -445,10 +445,10 @@ Package.prototype.checkout = function () {

// Checkout the tag
spawn('git', [ 'checkout', this.tag, '-f'], { cwd: this.path }).on('close', function (code) {
if (code > 0) return this.emit('error', new Error('Git status: ' + code));
if (code) return this.emit('error', new Error('Git status: ' + code));
// Ensure that checkout the tag as it is, removing all untracked files
spawn('git', ['clean', '-f', '-d'], { cwd: this.path }).on('close', function (code) {
if (code > 0) return this.emit('error', new Error('Git status: ' + code));
if (code) return this.emit('error', new Error('Git status: ' + code));
this.emit('checkout');
this.loadJSON();
}.bind(this));
Expand All @@ -469,7 +469,7 @@ Package.prototype.describeTag = function () {

cp.on('close', function (code) {
if (code == 128) tag = 'unspecified'.grey; // not a git repo
else if (code > 0) return this.emit('error', new Error('Git status: ' + code));
else if (code) return this.emit('error', new Error('Git status: ' + code));
this.emit('describeTag', tag.replace(/\n$/, ''));
}.bind(this));
};
Expand Down Expand Up @@ -516,10 +516,10 @@ Package.prototype.versions = function () {
Package.prototype.fetch = function () {
var cp = spawn('git', ['fetch'], { cwd: path.resolve(config.cache, this.name, this.resourceId) });
cp.on('close', function (code) {
if (code > 0) return this.emit('error', new Error('Git status: ' + code));
if (code) return this.emit('error', new Error('Git status: ' + code));
cp = spawn('git', ['reset', '--hard', 'origin/HEAD'], { cwd: path.resolve(config.cache, this.name, this.resourceId) });
cp.on('close', function (code) {
if (code > 0) return this.emit('error', new Error('Git status: ' + code));
if (code) return this.emit('error', new Error('Git status: ' + code));
this.emit('fetch');
}.bind(this));
}.bind(this));
Expand Down

0 comments on commit 9e3081e

Please sign in to comment.