Skip to content
This repository has been archived by the owner on Jun 15, 2021. It is now read-only.

Commit

Permalink
support for package mappings, use new install receipt format
Browse files Browse the repository at this point in the history
  • Loading branch information
amccollum committed Nov 16, 2013
1 parent b579a16 commit f33686c
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,25 @@ var async = require('async')
, installedIds = []

, install = function (ids, callback) {
repository.install(ids, function (err, ids, roots) {
repository.install(ids, function (err, receipts) {
if (err) return callback(err) // wrapped in ender-repository

installedIds = installedIds.concat(ids)

// Unmemoize all the packages we just installed
roots.forEach(enderPackage.unloadPackage)
receipts.forEach(function (receipt) {
installedIds.push(receipt.id)
enderPackage.unloadPackage(receipt.root)
enderPackage.addPackageMapping(receipt.source, receipt.root)
})

callback(null, ids, roots)
callback(null, receipts)
})
}

, installRest = function (callback) {
async.whilst(
function () { return missing.length }
, function (callback) {
install(missing, function (err, installedIds) {
install(missing, function (err) {
if (err) return callback(err)
updateMissing(callback)
})
Expand All @@ -76,9 +78,9 @@ var async = require('async')
, installBasePackages = function (callback) {
var installPackage = function (id, callback) {
var doInstall = function () {
install([ id ], function (err, installedIds) {
install([ id ], function (err) {
if (err) return callback(err)
callback(null, installedIds.pop())
callback(null, installedIds[installedIds.length-1])
})
}

Expand Down

0 comments on commit f33686c

Please sign in to comment.