Skip to content

Commit 4d77de0

Browse files
committed
Move logic out of ember-cli commands
1 parent e0d196e commit 4d77de0

File tree

20 files changed

+297
-342
lines changed

20 files changed

+297
-342
lines changed

index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ module.exports = {
44
name: 'ember-try',
55

66
includedCommands() {
7-
return require('./lib/commands');
7+
return {
8+
'try:reset': require('./lib/ember-cli-commands/reset'),
9+
'try:each': require('./lib/ember-cli-commands/try-each'),
10+
'try:one': require('./lib/ember-cli-commands/try-one'),
11+
'try:ember': require('./lib/ember-cli-commands/try-ember'),
12+
'try:config': require('./lib/ember-cli-commands/config'),
13+
};
814
},
915
};

lib/commands/config.js

Lines changed: 0 additions & 23 deletions
This file was deleted.

lib/commands/config.mjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import getConfig from '../utils/config.js';
2+
import { log } from '../utils/console.js';
3+
4+
export async function config({ configPath, cwd }) {
5+
const config = await getConfig({ configPath, cwd });
6+
7+
log(JSON.stringify(config, null, 2));
8+
}

lib/commands/reset.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

lib/commands/reset.mjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import ResetTask from '../tasks/reset.js';
2+
import getConfig from '../utils/config.js';
3+
4+
export async function reset({ configPath, cwd }) {
5+
const config = await getConfig({ configPath, cwd });
6+
const resetTask = new ResetTask({ config, cwd });
7+
8+
await resetTask.run();
9+
}

lib/commands/try-each.js

Lines changed: 0 additions & 36 deletions
This file was deleted.

lib/commands/try-each.mjs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import TryEachTask from '../tasks/try-each.js';
2+
import getConfig from '../utils/config.js';
3+
4+
export async function tryEach({
5+
configPath,
6+
cwd,
7+
skipCleanup,
8+
9+
// For testing purposes:
10+
_getConfig = getConfig,
11+
_TryEachTask = TryEachTask,
12+
}) {
13+
const config = await _getConfig({ configPath, cwd });
14+
const tryEachTask = new _TryEachTask({ config, cwd });
15+
16+
await tryEachTask.run(config.scenarios, { skipCleanup });
17+
}

lib/commands/try-ember.js

Lines changed: 0 additions & 45 deletions
This file was deleted.

lib/commands/try-ember.mjs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import TryEachTask from '../tasks/try-each.js';
2+
import getConfig from '../utils/config.js';
3+
4+
export async function tryEmber({
5+
configPath,
6+
cwd,
7+
ember,
8+
skipCleanup,
9+
10+
// For testing purposes:
11+
_getConfig = getConfig,
12+
_TryEachTask = TryEachTask,
13+
}) {
14+
const config = await _getConfig({
15+
configPath,
16+
cwd,
17+
versionCompatibility: { ember },
18+
});
19+
20+
const tryEachTask = new _TryEachTask({ config, cwd });
21+
22+
await tryEachTask.run(config.scenarios, { skipCleanup });
23+
}

lib/commands/try-one.js

Lines changed: 0 additions & 72 deletions
This file was deleted.

0 commit comments

Comments
 (0)