lib/HalDependencyResolver.js
function(describe, fileInfo) {
		if (!describe || !util.isArray(describe)) {
			return when.reject('wrong describe payload given');
		}

		if (!fileInfo) {
			return when.reject('no fileInfo provided');
		}

		console.log('resolving dependencies for ', fileInfo.filename);

		var that = this;
		return pipeline([
			function() {
				// find out what we need for the binary described by fileInfo
				return that.solve(describe, fileInfo.prefixInfo);
			},
			function(modules) {
				if (!modules || (modules.length <= 0)) {
					return when.resolve([]);		//no updates needed
				}

				// go get the module that we need if we have it.
				return that.retrieveModules(modules);
			},
			function(updates) {
				if (!updates || (updates.length <= 0)) {
					return when.resolve([]); 	//'no updates available'
				}

				// go figure out if the updates we found
				var promises = [];
				for (var i = 0; i < updates.length; i++) {
					var promise = that.resolveDependencies(describe, updates[i]);
					promises.push(promise);
				}

				return when.all(promises)
					.then(function(arr) {
						for (var j = 0; j < arr.length; j++) {
							var resvArr = arr[j];
							if (resvArr && (resvArr.length > 0)) {

								//NOTE: the photon isn't accepting updates in this order
								// part1, part2, user
								// insert these new dependencies at the start of the array
								updates = resvArr.concat(updates);

								// so lets flip that to
								// part2, part1, user
								//updates = updates.concat(resvArr);
							}
						}
						return when.resolve(updates);
					},
					function(err) {
						return when.resolve(updates);
					});
			}
		]);
	}
function(describe, fileInfo) {
		if (!describe || !util.isArray(describe)) {
			return when.reject('wrong describe payload given');
		}

		if (!fileInfo) {
			return when.reject('no fileInfo provided');
		}

		console.log('resolving dependencies for ', fileInfo.filename);

		var that = this;
		return pipeline([
			function() {
				// find out what we need for the binary described by fileInfo
				return that.solve(describe, fileInfo.prefixInfo);
			},
			function(modules) {
				if (!modules || (modules.length <= 0)) {
					return when.resolve([]);		//no updates needed
				}

				// go get the module that we need if we have it.
				return that.retrieveModules(modules);
			},
			function(updates) {
				if (!updates || (updates.length <= 0)) {
					return when.resolve([]); 	//'no updates available'
				}

				// go figure out if the updates we found
				var promises = [];
				for (var i = 0; i < updates.length; i++) {
					var promise = that.resolveDependencies(describe, updates[i]);
					promises.push(promise);
				}

				return when.all(promises)
					.then(function(arr) {
						for (var j = 0; j < arr.length; j++) {
							var resvArr = arr[j];
							if (resvArr && (resvArr.length > 0)) {

								//NOTE: the photon isn't accepting updates in this order
								// part1, part2, user
								// insert these new dependencies at the start of the array
								updates = resvArr.concat(updates);

								// so lets flip that to
								// part2, part1, user
								//updates = updates.concat(resvArr);
							}
						}
						return when.resolve(updates);
					},
					function(err) {
						return when.resolve(updates);
					});
			}
		]);
	}
/*

@param Object describe
@param Object fileInfo
@returns Promise