ember-try 1.4.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,102 +1,118 @@
1
1
  'use strict';
2
2
 
3
3
  const CoreObject = require('core-object');
4
- const RSVP = require('rsvp');
5
- const mapSeries = require('promise-map-series');
6
4
  const chalk = require('chalk');
7
5
  const debug = require('debug')('ember-try:task:try-each');
8
6
  const runCommand = require('./../utils/run-command');
9
7
 
10
8
  module.exports = CoreObject.extend({
11
- run(scenarios, options) {
9
+ async run(scenarios, options) {
12
10
  // Required lazily to improve startup speed.
13
11
  let ScenarioManager = require('./../utils/scenario-manager');
14
12
  let DependencyManagerAdapterFactory = require('./../utils/dependency-manager-adapter-factory');
15
13
  this.ResultSummary = require('./../utils/result-summary');
16
14
 
17
- let task = this;
18
- let dependencyManagerAdapters = task.dependencyManagerAdapters || DependencyManagerAdapterFactory.generateFromConfig(task.config, task.project.root);
19
- debug('DependencyManagerAdapters: %s', dependencyManagerAdapters.map((item) => { return item.configKey; }));
20
- task.ScenarioManager = new ScenarioManager({
21
- ui: task.ui,
15
+ let dependencyManagerAdapters =
16
+ this.dependencyManagerAdapters ||
17
+ DependencyManagerAdapterFactory.generateFromConfig(this.config, this.project.root);
18
+ debug(
19
+ 'DependencyManagerAdapters: %s',
20
+ dependencyManagerAdapters.map((item) => {
21
+ return item.configKey;
22
+ })
23
+ );
24
+ this.ScenarioManager = new ScenarioManager({
25
+ ui: this.ui,
22
26
  dependencyManagerAdapters,
23
27
  });
24
28
 
25
- task._canceling = false;
26
- task._on('SIGINT', () => {
27
- task._canceling = true;
28
- task.ui.writeLine('\nGracefully shutting down from SIGINT (Ctrl-C)');
29
- return task.ScenarioManager.cleanup();
29
+ this._canceling = false;
30
+ this._on('SIGINT', () => {
31
+ this._canceling = true;
32
+ this.ui.writeLine('\nGracefully shutting down from SIGINT (Ctrl-C)');
33
+ return this.ScenarioManager.cleanup();
30
34
  });
31
35
 
32
- return task.ScenarioManager.setup().then(() => {
36
+ try {
37
+ await this.ScenarioManager.setup();
33
38
  debug('Scenario Manager setup');
34
- return mapSeries(scenarios, task._runCommandForThisScenario, task);
35
- }).then((results) => {
36
- return task._optionallyCleanup(options).then(() => {
37
- debug('Output results');
38
- task._printResults(results);
39
- return task._exitAsAppropriate(results);
40
- });
41
- }).catch((err) => {
42
- task.ui.writeLine(chalk.red('Error!'));
39
+
40
+ let results = [];
41
+ for (let scenario of scenarios) {
42
+ results.push(await this._runCommandForThisScenario(scenario));
43
+ }
44
+
45
+ await this._optionallyCleanup(options);
46
+
47
+ debug('Output results');
48
+ this._printResults(results);
49
+
50
+ return this._exitAsAppropriate(results);
51
+ } catch (err) {
52
+ this.ui.writeLine(chalk.red('Error!'));
53
+
43
54
  if (err) {
44
- task.ui.writeLine(chalk.red(err));
45
- task.ui.writeLine(chalk.red(err.stack));
55
+ this.ui.writeLine(chalk.red(err));
56
+ this.ui.writeLine(chalk.red(err.stack));
46
57
  }
58
+
47
59
  return 1; // Signifies exit code
48
- });
60
+ }
49
61
  },
50
62
 
51
- _runCommandForThisScenario(scenario) {
52
- let task = this;
63
+ async _runCommandForThisScenario(scenario) {
64
+ if (this._canceling) {
65
+ return;
66
+ }
53
67
 
54
- if (task._canceling) { return; }
68
+ let scenarioDependencyState = await this.ScenarioManager.changeTo(scenario);
55
69
 
56
- return task.ScenarioManager.changeTo(scenario)
57
- .then((scenarioDependencyState) => {
58
- if (task._canceling) { return; }
70
+ if (this._canceling) {
71
+ return;
72
+ }
59
73
 
60
- process.env.EMBER_TRY_CURRENT_SCENARIO = scenario.name;
61
- task._writeHeader(`Scenario: ${scenario.name}`);
62
- let command = task._determineCommandFor(scenario);
63
- let runResults = {
64
- scenario: scenario.name,
65
- allowedToFail: !!scenario.allowedToFail,
66
- dependencyState: scenarioDependencyState,
67
- envState: scenario.env,
68
- command: command.join(' '),
69
- };
74
+ process.env.EMBER_TRY_CURRENT_SCENARIO = scenario.name;
75
+ this._writeHeader(`Scenario: ${scenario.name}`);
70
76
 
71
- debug('With:\n', runResults);
77
+ let command = this._determineCommandFor(scenario);
78
+ let runResults = {
79
+ scenario: scenario.name,
80
+ allowedToFail: !!scenario.allowedToFail,
81
+ dependencyState: scenarioDependencyState,
82
+ envState: scenario.env,
83
+ command: command.join(' '),
84
+ };
72
85
 
73
- return task._runCommand({ commandArgs: command, commandOptions: task._commandOptions(scenario.env) }).then((result) => {
74
- if (task._canceling) { return; }
86
+ debug('With:\n', runResults);
75
87
 
76
- runResults.result = result;
77
- task._writeFooter(`Result: ${result}`);
78
- return RSVP.resolve(runResults);
79
- });
80
- });
88
+ let result = await this._runCommand({
89
+ commandArgs: command,
90
+ commandOptions: this._commandOptions(scenario.env),
91
+ });
92
+
93
+ if (this._canceling) {
94
+ return;
95
+ }
96
+
97
+ runResults.result = result;
98
+ this._writeFooter(`Result: ${result}`);
99
+
100
+ return runResults;
81
101
  },
82
102
 
83
103
  _writeHeader(text) {
84
- let task = this;
85
104
  let count = 75 - text.length;
86
105
  let separator = new Array(count + 1).join('=');
87
- task.ui.writeLine(chalk.blue(`\n=== ${text} ${separator}\n`));
106
+ this.ui.writeLine(chalk.blue(`\n=== ${text} ${separator}\n`));
88
107
  },
89
108
 
90
109
  _writeFooter(text) {
91
- let task = this;
92
- task.ui.writeLine(chalk.blue(`\n${text}`));
93
- task.ui.writeLine(chalk.blue('---\n'));
110
+ this.ui.writeLine(chalk.blue(`\n${text}`));
111
+ this.ui.writeLine(chalk.blue('---\n'));
94
112
  },
95
113
 
96
114
  _determineCommandFor(scenario) {
97
- let task = this;
98
-
99
- if (task.commandArgs && task.commandArgs.length) {
115
+ if (this.commandArgs && this.commandArgs.length) {
100
116
  return this.commandArgs;
101
117
  }
102
118
 
@@ -104,8 +120,8 @@ module.exports = CoreObject.extend({
104
120
  return scenario.command.split(' ');
105
121
  }
106
122
 
107
- if (task.config.command) {
108
- return task.config.command.split(' ');
123
+ if (this.config.command) {
124
+ return this.config.command.split(' ');
109
125
  }
110
126
 
111
127
  return this._defaultCommandArgs();
@@ -139,21 +155,17 @@ module.exports = CoreObject.extend({
139
155
  return this._exitBasedOnCondition(outcomes.indexOf(false) > -1);
140
156
  },
141
157
 
142
- _optionallyCleanup(options) {
158
+ async _optionallyCleanup(options) {
143
159
  debug('Cleanup');
144
160
  delete process.env.EMBER_TRY_CURRENT_SCENARIO;
145
161
 
146
- let task = this;
147
- let promise;
148
162
  if (options && options.skipCleanup) {
149
163
  // Create a fake promise for consistency
150
164
  debug('Skip ScenarioManager cleanup');
151
- promise = RSVP.Promise.resolve();
152
165
  } else {
153
166
  debug('Cleanup ScenarioManager');
154
- promise = task.ScenarioManager.cleanup();
167
+ return await this.ScenarioManager.cleanup();
155
168
  }
156
- return promise;
157
169
  },
158
170
 
159
171
  _exitBasedOnCondition(condition) {
@@ -170,5 +182,4 @@ module.exports = CoreObject.extend({
170
182
  _on(signal, fn) {
171
183
  process.on(signal, fn);
172
184
  },
173
-
174
185
  });
@@ -2,96 +2,88 @@
2
2
 
3
3
  const path = require('path');
4
4
  const fs = require('fs');
5
- const extend = require('extend');
6
- const RSVP = require('rsvp');
7
5
  const findByName = require('./find-by-name');
8
6
  const debug = require('debug')('ember-try:utils:config');
9
7
 
10
- const IMPLICIT_BOWER_VERSION = '^1.8.2';
8
+ function getConfigPath(project) {
9
+ let possibleConfigPath;
10
+ if (project.pkg && project.pkg['ember-addon'] && project.pkg['ember-addon']['configPath']) {
11
+ let configDir = project.pkg['ember-addon']['configPath'];
11
12
 
12
- function getBaseConfig(options) {
13
- let relativePath = options.configPath || path.join('config', 'ember-try.js');
14
- let configFile = path.join(options.project.root, relativePath);
15
- let configData;
13
+ possibleConfigPath = path.join(configDir, 'ember-try.js');
14
+ }
16
15
 
17
- if (fs.existsSync(configFile)) {
18
- configData = require(configFile);
16
+ if (fs.existsSync(possibleConfigPath)) {
17
+ debug(`using config from package.json ember-addon.configPath: ${possibleConfigPath}`);
19
18
 
20
- if (typeof configData === 'function') {
21
- configData = configData(options.project);
22
- }
23
- } else {
24
- debug('Config file does not exist %s', configFile);
19
+ return possibleConfigPath;
25
20
  }
26
21
 
27
- return RSVP.resolve(configData).then((data) => {
28
- if (data && data.scenarios && !data.useVersionCompatibility && !options.versionCompatibility) {
29
- return RSVP.resolve(data);
30
- }
31
-
32
- let versionCompatibility = options.versionCompatibility || versionCompatibilityFromPackageJSON(options.project.root);
33
-
34
- if (versionCompatibility) {
35
- // Required lazily to improve startup speed.
36
- let autoScenarioConfigForEmber = require('ember-try-config');
37
- return autoScenarioConfigForEmber({ versionCompatibility, project: options.project }).then((autoConfig) => {
38
- return mergeAutoConfigAndConfigFileData(autoConfig, data);
39
- });
40
- } else {
41
- return RSVP.reject(new Error('No ember-try configuration found. Please see the README for configuration options'));
42
- }
43
- });
22
+ debug('using config from config/ember-try.js');
23
+
24
+ return path.join('config', 'ember-try.js');
44
25
  }
45
26
 
46
- function config(options) {
47
- return getBaseConfig(options).then((configData) => {
48
- return addImplicitBowerToScenarios(configData);
49
- });
27
+ async function getBaseConfig(options) {
28
+ let relativeConfigPath = options.configPath || getConfigPath(options.project);
29
+ let configPath = path.join(options.project.root, relativeConfigPath);
30
+ let data;
31
+
32
+ if (fs.existsSync(configPath)) {
33
+ let configData = await require(configPath);
34
+
35
+ data = typeof configData === 'function' ? await configData(options.project) : configData;
36
+ } else {
37
+ debug('Config file does not exist %s', configPath);
38
+ }
39
+
40
+ if (data && data.scenarios && !data.useVersionCompatibility && !options.versionCompatibility) {
41
+ return data;
42
+ }
43
+
44
+ let versionCompatibility =
45
+ options.versionCompatibility || versionCompatibilityFromPackageJSON(options.project.root);
46
+ if (versionCompatibility) {
47
+ // Required lazily to improve startup speed.
48
+ let autoScenarioConfigForEmber = require('ember-try-config');
49
+
50
+ let autoConfig = await autoScenarioConfigForEmber({
51
+ versionCompatibility,
52
+ project: options.project,
53
+ });
54
+ return await mergeAutoConfigAndConfigFileData(autoConfig, data);
55
+ } else {
56
+ throw new Error(
57
+ 'No ember-try configuration found. Please see the README for configuration options'
58
+ );
59
+ }
50
60
  }
51
61
 
52
- module.exports = config;
62
+ async function config(options) {
63
+ const configData = await getBaseConfig(options);
53
64
 
54
- function addImplicitBowerToScenarios(configData) {
55
- configData.scenarios.forEach((scenario) => {
56
- if (!('bower' in scenario)) {
57
- // Don't do anything for scenarios that don't include bower
58
- return;
59
- }
60
-
61
- if ('npm' in scenario) {
62
- let npm = scenario.npm;
63
- if ((npm.dependencies && npm.dependencies.bower) ||
64
- (npm.devDependencies && npm.devDependencies.bower)) {
65
- // Dont' do anything for scenarios that already include bower in npm,
66
- // either as a dependency or a dev dependency
67
- return;
68
- }
69
- }
70
-
71
- // add an implicit bower dev dependency to npm for this scenario
72
- scenario.npm = scenario.npm || {};
73
- scenario.npm.devDependencies = scenario.npm.devDependencies || {};
74
- scenario.npm.devDependencies.bower = IMPLICIT_BOWER_VERSION;
75
- });
76
65
  return configData;
77
66
  }
78
67
 
68
+ module.exports = config;
69
+
79
70
  function mergeAutoConfigAndConfigFileData(autoConfig, configData) {
80
71
  configData = configData || {};
81
72
  configData.scenarios = configData.scenarios || [];
82
73
 
83
- let conf = extend({}, autoConfig, configData);
74
+ let conf = Object.assign({}, autoConfig, configData);
84
75
 
85
76
  let overriddenScenarios = autoConfig.scenarios.map((scenario) => {
86
77
  let overriddenScenario = findByName(configData.scenarios, scenario.name);
87
- return extend({}, scenario, overriddenScenario);
78
+ return Object.assign({}, scenario, overriddenScenario);
88
79
  });
89
80
 
90
81
  let additionalScenarios = configData.scenarios.filter((scenario) => {
91
82
  return !findByName(autoConfig.scenarios, scenario.name);
92
83
  });
93
84
 
94
- conf.scenarios = [].concat(overriddenScenarios, additionalScenarios);
85
+ conf.scenarios = [...overriddenScenarios, ...additionalScenarios];
86
+
95
87
  return conf;
96
88
  }
97
89
 
@@ -99,9 +91,7 @@ function versionCompatibilityFromPackageJSON(root) {
99
91
  let packageJSONFile = path.join(root, 'package.json');
100
92
  if (fs.existsSync(packageJSONFile)) {
101
93
  let packageJSON = JSON.parse(fs.readFileSync(packageJSONFile));
94
+
102
95
  return packageJSON['ember-addon'] ? packageJSON['ember-addon'].versionCompatibility : null;
103
96
  }
104
97
  }
105
-
106
- // Used for internal testing purposes.
107
- module.exports._addImplicitBowerToScenarios = addImplicitBowerToScenarios;
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- const BowerAdapter = require('../dependency-manager-adapters/bower');
4
3
  const NpmAdapter = require('../dependency-manager-adapters/npm');
4
+ const PnpmAdapter = require('../dependency-manager-adapters/pnpm');
5
5
  const WorkspaceAdapter = require('../dependency-manager-adapters/workspace');
6
6
 
7
7
  module.exports = {
@@ -22,22 +22,40 @@ module.exports = {
22
22
  }
23
23
  });
24
24
 
25
- if (config.useWorkspaces) {
26
- if (hasBower) {
27
- throw new Error('bower is not supported when using workspaces');
28
- }
25
+ if (hasBower) {
26
+ throw new Error('[ember-try] bower configuration is no longer supported');
27
+ }
29
28
 
29
+ if (config.useWorkspaces) {
30
30
  adapters.push(
31
31
  new WorkspaceAdapter({
32
32
  cwd: root,
33
33
  managerOptions: config.npmOptions,
34
34
  useYarnCommand: config.useYarn,
35
- buildManagerOptions: config.buildManagerOptions
35
+ buildManagerOptions: config.buildManagerOptions,
36
+ })
37
+ );
38
+ } else if (config.usePnpm) {
39
+ console.warn(
40
+ 'pnpm support is experimental for now. if you notice any problems please open an issue.'
41
+ );
42
+
43
+ adapters.push(
44
+ new PnpmAdapter({
45
+ cwd: root,
46
+ managerOptions: config.npmOptions,
47
+ buildManagerOptions: config.buildManagerOptions,
48
+ })
49
+ );
50
+ } else if (hasNpm) {
51
+ adapters.push(
52
+ new NpmAdapter({
53
+ cwd: root,
54
+ managerOptions: config.npmOptions,
55
+ useYarnCommand: config.useYarn,
56
+ buildManagerOptions: config.buildManagerOptions,
36
57
  })
37
58
  );
38
- } else if (hasNpm || hasBower) {
39
- adapters.push(new NpmAdapter({ cwd: root, managerOptions: config.npmOptions, useYarnCommand: config.useYarn, buildManagerOptions: config.buildManagerOptions }));
40
- adapters.push(new BowerAdapter({ cwd: root, managerOptions: config.bowerOptions }));
41
59
  }
42
60
 
43
61
  return adapters;
@@ -1,15 +1,14 @@
1
1
  'use strict';
2
2
 
3
3
  const path = require('path');
4
- const RSVP = require('rsvp');
5
- const resolve = RSVP.denodeify(require('resolve'));
4
+ const utils = require('util');
5
+ const resolve = utils.promisify(require('resolve'));
6
6
 
7
- module.exports = function(root) {
7
+ module.exports = async function (root) {
8
8
  /* Find ember-cli's entry point module relative to
9
9
  the current projects root */
10
- return resolve('ember-cli', { basedir: root })
11
- .then((emberPath) => {
12
- // Return the path to the ember command script
13
- return path.join(emberPath, '..', '..', '..', 'bin', 'ember');
14
- });
10
+ let emberPath = await resolve('ember-cli', { basedir: root });
11
+
12
+ // Return the path to the ember command script
13
+ return path.join(emberPath, '..', '..', '..', 'bin', 'ember');
15
14
  };
@@ -35,7 +35,6 @@ module.exports = CoreObject.extend({
35
35
  task.ui.writeLine(`with env: ${JSON.stringify(scenario.envState, null, 2)}`);
36
36
  }
37
37
  task._printDependencyTable(scenario.dependencyState);
38
- task._deprecateBowerSupport(scenario.dependencyState);
39
38
  });
40
39
 
41
40
  task.ui.writeLine('');
@@ -48,12 +47,19 @@ module.exports = CoreObject.extend({
48
47
  task.ui.writeLine('');
49
48
  },
50
49
  _printDependencyTable(dependencyStatus) {
51
- if (!dependencyStatus.length) { return; }
50
+ if (!dependencyStatus.length) {
51
+ return;
52
+ }
52
53
  let task = this;
53
54
  let colorForDepFn;
54
55
  let tableRow;
55
56
  let table = new Table({
56
- head: [chalk.gray('Dependency'), chalk.gray('Expected'), chalk.gray('Used'), chalk.gray('Type')],
57
+ head: [
58
+ chalk.gray('Dependency'),
59
+ chalk.gray('Expected'),
60
+ chalk.gray('Used'),
61
+ chalk.gray('Type'),
62
+ ],
57
63
  colWidths: [20, 20, 30, 10],
58
64
  });
59
65
  dependencyStatus.forEach((dep) => {
@@ -62,7 +68,12 @@ module.exports = CoreObject.extend({
62
68
  } else {
63
69
  colorForDepFn = chalk.yellow;
64
70
  }
65
- tableRow = [dep.name, dep.versionExpected || 'Not Installed', dep.versionSeen || 'Not Installed', dep.packageManager].map((column) => {
71
+ tableRow = [
72
+ dep.name,
73
+ dep.versionExpected || 'Not Installed',
74
+ dep.versionSeen || 'Not Installed',
75
+ dep.packageManager,
76
+ ].map((column) => {
66
77
  return colorForDepFn(column);
67
78
  });
68
79
  table.push(tableRow);
@@ -70,15 +81,6 @@ module.exports = CoreObject.extend({
70
81
  task.ui.writeLine(table);
71
82
  task.ui.writeLine('');
72
83
  },
73
- _deprecateBowerSupport(dependencyStatus) {
74
- if (!dependencyStatus.length) { return; }
75
- let anyBower = dependencyStatus.some(function(element) {
76
- return element.packageManager === 'bower';
77
- });
78
- if (anyBower) {
79
- this.ui.writeLine(chalk.yellow('DEPRECATION: The next major version of `ember-try` (v2.0) will drop support for installing dependencies with `bower`.'));
80
- }
81
- },
82
84
  _printResultsSummary(countFailed, countPassed, allowedFailCount, total) {
83
85
  let task = this;
84
86
  if (countFailed) {
@@ -1,31 +1,26 @@
1
1
  'use strict';
2
2
 
3
- const RSVP = require('rsvp');
4
- const extend = require('extend');
5
3
  const findEmberPath = require('./find-ember-path');
6
4
  const run = require('./run');
7
5
 
8
- module.exports = function(root, commandArgs, opts) {
9
- let options = extend({ cwd: root }, opts);
10
- let runPromise;
11
- let command = commandArgs[0];
12
- let actualArgs = commandArgs.slice(1);
6
+ module.exports = async function (root, commandArgs, opts) {
7
+ let options = Object.assign({ cwd: root }, opts);
8
+ let [command, ...actualArgs] = commandArgs;
13
9
 
14
- if (command === 'ember') {
15
- runPromise = findEmberPath(root).then((emberPath) => {
16
- return run('node', [].concat(`"${emberPath}"`, actualArgs), options);
17
- });
18
- } else {
19
- runPromise = run(command, actualArgs, options);
20
- }
10
+ try {
11
+ if (command === 'ember') {
12
+ let emberPath = await findEmberPath(root);
13
+ await run('node', [`"${emberPath}"`, ...actualArgs], options);
14
+ } else {
15
+ await run(command, actualArgs, options);
16
+ }
21
17
 
22
- return runPromise.then(() => {
23
- return RSVP.resolve(true);
24
- }).catch((errorCode) => {
18
+ return true;
19
+ } catch (errorCode) {
25
20
  if (errorCode !== 1) {
26
- return RSVP.reject(`The command ${commandArgs.join(' ')} exited ${errorCode}`);
21
+ throw new Error(`The command ${commandArgs.join(' ')} exited ${errorCode}`);
27
22
  } else {
28
- return RSVP.resolve(false);
23
+ return false;
29
24
  }
30
- });
25
+ }
31
26
  };
package/lib/utils/run.js CHANGED
@@ -3,22 +3,22 @@
3
3
  const execa = require('execa');
4
4
  const debug = require('debug')('ember-try:utils:run');
5
5
 
6
- module.exports = function run(command, args, opts) {
7
- opts = opts || {};
8
-
9
- opts.stdio = opts.stdio || 'inherit';
6
+ module.exports = async function run(command, args, _options) {
7
+ let options = Object.assign({ stdio: 'inherit', shell: true }, _options);
10
8
 
11
9
  if (process.env.SHUT_UP) {
12
- opts.stdio = 'ignore';
10
+ options.stdio = 'ignore';
13
11
  }
14
12
 
15
13
  let cmdArgs = `${command} ${args.join(' ')}`;
16
- let child = execa.shell(cmdArgs, opts);
17
-
18
- debug('spawned with execa.shell', cmdArgs, opts);
14
+ try {
15
+ debug('spawning execa.shell', cmdArgs, options);
19
16
 
20
- return child.catch((error) => {
17
+ return await execa(cmdArgs, options);
18
+ } catch (error) {
21
19
  debug('error', error);
22
- return Promise.reject(error.code);
23
- });
20
+
21
+ // TODO: should refactor this to throw an error (easier to track down stack traces)
22
+ throw error.exitCode;
23
+ }
24
24
  };
@@ -1,44 +1,33 @@
1
1
  'use strict';
2
2
 
3
3
  const CoreObject = require('core-object');
4
- const RSVP = require('rsvp');
5
- const mapSeries = require('promise-map-series');
6
4
 
7
5
  module.exports = CoreObject.extend({
8
- init() {
9
- this._super.apply(this, arguments);
10
- this._checkDependencyManagerAdapters();
11
- },
6
+ async setup() {
7
+ let { ui } = this;
12
8
 
13
- _checkDependencyManagerAdapters() {
14
- if (!this.dependencyManagerAdapters || this.dependencyManagerAdapters.length === 0) {
15
- throw new Error('No dependency manager adapter');
9
+ for (let depManager of this.dependencyManagerAdapters) {
10
+ await depManager.setup({ ui });
16
11
  }
17
12
  },
18
13
 
19
- setup() {
20
- let ui = this.ui;
21
-
22
- return mapSeries(this.dependencyManagerAdapters, (depManager) => {
23
- return depManager.setup({ ui });
24
- });
25
- },
26
-
27
- changeTo(scenario) {
28
- return mapSeries(this.dependencyManagerAdapters, (depManager) => {
14
+ async changeTo(scenario) {
15
+ let results = [];
16
+ for (let depManager of this.dependencyManagerAdapters) {
29
17
  if (scenario[depManager.configKey]) {
30
- return depManager.changeToDependencySet(scenario[depManager.configKey]);
18
+ let depManagerResults = await depManager.changeToDependencySet(
19
+ scenario[depManager.configKey]
20
+ );
21
+ results.push(...depManagerResults);
31
22
  }
32
- return RSVP.resolve([]);
33
- }).then((results) => {
34
- return RSVP.resolve([].concat.apply([], results));
35
- });
23
+ }
24
+
25
+ return results;
36
26
  },
37
27
 
38
- cleanup() {
39
- return mapSeries(this.dependencyManagerAdapters, (depManager) => {
40
- return depManager.cleanup();
41
- });
28
+ async cleanup() {
29
+ for (let depManager of this.dependencyManagerAdapters) {
30
+ await depManager.cleanup();
31
+ }
42
32
  },
43
33
  });
44
-