-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add abe processes for plugin integration
- Loading branch information
nicolaslabbe
committed
Sep 29, 2016
1 parent
4e2756e
commit 46c46b7
Showing
2 changed files
with
55 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,48 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
value: true | ||
}); | ||
|
||
var _child_process = require('child_process'); | ||
|
||
var _child_process2 = _interopRequireDefault(_child_process); | ||
|
||
var _fsExtra = require('fs-extra'); | ||
|
||
var _fsExtra2 = _interopRequireDefault(_fsExtra); | ||
|
||
var _ = require('../'); | ||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
|
||
function prepend(value, array) { | ||
var newArray = array.slice(0); | ||
newArray.unshift(value); | ||
return newArray; | ||
var newArray = array.slice(0); | ||
newArray.unshift(value); | ||
return newArray; | ||
} | ||
|
||
var abeProcess = function abeProcess(name, args) { | ||
args = prepend('ABE_WEBSITE=' + _.config.root, args); | ||
var publishAll = _child_process2.default.fork(__dirname + '/../../cli/process/' + name + '.js', args); | ||
var abeProcess = function abeProcess(name) { | ||
var args = arguments.length <= 1 || arguments[1] === undefined ? [] : arguments[1]; | ||
|
||
args = prepend('ABE_WEBSITE=' + _.config.root, args); | ||
args = prepend('ABEJS_PATH=' + __dirname + '/../../../dist', args); | ||
|
||
var file = __dirname + '/../../cli/process/' + name + '.js'; | ||
try { | ||
var stats = _fsExtra2.default.statSync(file); | ||
if (stats.isFile()) { | ||
_child_process2.default.fork(file, args); | ||
} | ||
} catch (err) { | ||
try { | ||
file = _.Plugins.instance.getProcess(name); | ||
var stats = _fsExtra2.default.statSync(file); | ||
if (stats.isFile()) { | ||
_child_process2.default.fork(file, args); | ||
} | ||
} catch (err) {} | ||
} | ||
}; | ||
|
||
exports.default = abeProcess; |