Version React iso-fonctionnelle

This commit is contained in:
2015-08-27 22:52:30 +02:00
parent 1d24cf6779
commit 7fc7f9d10e
12 changed files with 223 additions and 354 deletions

1
js/util/index.js Normal file
View File

@ -0,0 +1 @@
exports.System = require('./system');

31
js/util/system.js Normal file
View File

@ -0,0 +1,31 @@
var fs = require('fs');
var cp = require('child_process');
/**
* Load a JSON file
*
* @param filePath The path of the json file
* @return Promise
*/
exports.loadJSONFile = function(filePath) {
return new Promise(function(resolve, reject) {
fs.readFile(filePath, 'utf8', function(err, fileContent) {
if(err) return reject(err);
try {
var json = JSON.parse(fileContent);
return resolve(json);
} catch(err) {
return reject(err);
}
});
});
};
exports.runApp = function(execPath) {
return new Promise(function(resolve, reject) {
cp.exec(execPath, function(err) {
if(err) return reject(err);
return resolve();
});
});
};