Fix update for asset packages.

This commit is contained in:
André Cruz
2012-11-05 01:53:43 +00:00
parent d23adeef5a
commit 4ab8cd398b
2 changed files with 16 additions and 9 deletions

View File

@@ -150,8 +150,7 @@ Package.prototype.lookup = function () {
};
Package.prototype.install = function () {
// Only print the installing action if this package has been resolved
if (this.version) template('action', { name: 'installing', shizzle: this.name + (this.version ? '#' + this.version : '') })
template('action', { name: 'installing', shizzle: this.name + (this.version ? '#' + this.version : '') })
.on('data', this.emit.bind(this, 'data'));
if (path.resolve(this.path) == this.localPath) {
@@ -190,7 +189,7 @@ Package.prototype.cleanUpLocal = function () {
else delete this.json.commit;
if (this.gitUrl) this.json.repository = { type: "git", url: this.gitUrl };
if (this.assetUrl) this.json = this.generateAssetJSON();
else if (this.assetUrl) this.json = this.generateAssetJSON();
var jsonStr = JSON.stringify(this.json, null, 2);
fs.writeFile(path.join(this.localPath, config.json), jsonStr);
@@ -526,12 +525,15 @@ Package.prototype.fetch = function () {
};
Package.prototype.fetchURL = function () {
if (this.json.repository && this.json.repository.type == 'git') {
if (!this.json.repository) return this.emit('fetchURL');
if (this.json.repository.type == 'git') {
this.gitUrl = this.json.repository.url;
this.generateResourceId();
this.emit('fetchURL', this.gitUrl);
this.emit('fetchURL', this.gitUrl, 'git');
} else {
this.emit('error', new Error('No git url found for ' + this.name));
this.assetUrl = this.json.repository.url;
this.emit('fetchURL', this.assetUrl, 'asset');
}
};