all files / lib/component/ getToInstall.js

75% Statements 12/16
33.33% Branches 2/6
75% Functions 3/4
75% Lines 12/16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31                                     
'use strict';
 
var path = require('path');
 
var fs = require('graceful-fs');
 
var fecom = require('../fecom');
var Component = require('./Component');
 
module.exports = function (parsedList) {
 
  Iif (!parsedList.length) {
    parsedList = fecom.config.dependencies || [];
    parsedList = parsedList.map(function (str) {
      return fecom.parse(str);
    });
  }
 
  Iif (!parsedList.length) {
    throw new Error('No component to install');
  }
 
  parsedList = parsedList.map(function (parsed) {
    parsed.specified = true;
    return parsed;
  });
 
  return Promise.all(parsedList.map(function (parsed) {
    return fecom.async(new Component(parsed, 'remote'));
  }));
};