-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.js
36 lines (28 loc) · 1.12 KB
/
api.js
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
32
33
34
35
36
let ObjectLocator = require('./src/ObjectLocator');
let DependencyGraph = require('./src/DependencyGraph');
let DriverLocator = require('./src/DriverLocator');
let CreateCommand = require('./src/CreateCommand');
let TearDownCommand = require('./src/TearDownCommand');
let fs = require('fs');
module.exports = {
create: (objectName, sync) => {
let objectLocator = new ObjectLocator(fs, objectName);
let objects = objectLocator.run();
let dependencyGraph = new DependencyGraph(objects);
let driverLocator = new DriverLocator(fs, process.cwd() + "/drivers/");
let createCommand = new CreateCommand(dependencyGraph, driverLocator);
if (sync) {
return createCommand.runSync();
} else {
return createCommand.run();
}
},
createSync: (objectName) => {
return module.exports.create(objectName, true);
},
tearDown: (objects) => {
let driverLocator = new DriverLocator(fs, process.cwd() + "/drivers/");
let tearDownCommand = new TearDownCommand(driverLocator);
return tearDownCommand.run(objects);
}
}