stopping for now
This commit is contained in:
46
exec.js
46
exec.js
@@ -1,6 +1,12 @@
|
||||
var fs = require('fs'),
|
||||
/*jslint node: true */
|
||||
/*jshint esversion: 6 */
|
||||
/* jshint -W097 */
|
||||
'use strict';
|
||||
var fs = require('fs'),
|
||||
when = require('when'),
|
||||
_ = require('underscore');
|
||||
_ = require('underscore'),
|
||||
path = require('path'),
|
||||
child_process = require('child_process');
|
||||
var main = function (options) {
|
||||
var heatFiles = options.heatFiles;
|
||||
var candleFiles = options.candleFiles;
|
||||
@@ -8,30 +14,44 @@ var main = function (options) {
|
||||
var heatCommands = options.heatCommands || null;
|
||||
var candleCommands = options.candleCommands || null;
|
||||
var lightCommands = options.lightCommands || null;
|
||||
var heatPath = options.heatPath || path.normalize(__dirname + "/heat.exe");
|
||||
var lightPath = options.lightPath || path.normalize(__dirname + "/light.exe");
|
||||
var candlePath = options.candlePath || path.normalize(__dirname + "/candle.exe");
|
||||
if(!heatCommands){
|
||||
if(!heatFiles || !_.isArray(heatFiles) || heatFiles.length < 1 ){
|
||||
throw "heat files are required if no commands are passed";
|
||||
}
|
||||
checkFiles(heatFiles);
|
||||
}
|
||||
|
||||
if(!candleFiles || !_.isArray(candleFiles) || candleFiles.length < 1 ){
|
||||
throw "candle files are required"
|
||||
|
||||
if(!candleCommands){
|
||||
|
||||
if(!candleFiles || !_.isArray(candleFiles) || candleFiles.length < 1 ){
|
||||
throw "candle files are required";
|
||||
}
|
||||
|
||||
checkFiles(candleCommands);
|
||||
|
||||
}
|
||||
if(!lightFiles || !_.isArray(lightFiles) || lightFiles.length < 1 ){
|
||||
throw "light files are required"
|
||||
|
||||
if(!lightCommands){
|
||||
|
||||
if(!lightFiles || !_.isArray(lightFiles) || lightFiles.length < 1 ){
|
||||
throw "light files are required";
|
||||
}
|
||||
|
||||
checkFiles(lightFiles);
|
||||
|
||||
}
|
||||
|
||||
checkFiles(candleFiles);
|
||||
checkFiles(lightFiles);
|
||||
}
|
||||
child_process.execFileSync(heatPath, heatCommands? heatCommands: _.map(heatFiles, (file)=>`@${path.normalize(file)}`));
|
||||
};
|
||||
var checkFiles = function(files){
|
||||
_.each(files, (file)=>{
|
||||
if(!checkFile(file)){
|
||||
throw "error finding file" + file;
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
var checkFile = function (file) {
|
||||
if (file || file.length < 1) {
|
||||
return false;
|
||||
@@ -43,4 +63,4 @@ var checkFile = function (file) {
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
Reference in New Issue
Block a user