mirror of https://github.com/embarklabs/embark.git
anchoredPath helper (more DRY)
This commit is contained in:
parent
67147f2cad
commit
f1edc28f6d
|
@ -77,24 +77,21 @@ function removeSync() {
|
||||||
return fs.removeSync.apply(fs.removeSync, arguments);
|
return fs.removeSync.apply(fs.removeSync, arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
function embarkPath() {
|
function anchoredPath(envAnchor, ...args) {
|
||||||
const _embarkPath = process.env.EMBARK_PATH;
|
const anchor = process.env[envAnchor];
|
||||||
if (!_embarkPath) {
|
if (!anchor) {
|
||||||
const errMsg = 'process.env.EMBARK_PATH was not set'.bold.red;
|
console.error(`process.env.${envAnchor} was not set`.bold.red);
|
||||||
console.error(errMsg);
|
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
return utils.joinPath(_embarkPath, ...arguments);
|
return utils.joinPath(anchor, ...args);
|
||||||
|
}
|
||||||
|
|
||||||
|
function embarkPath() {
|
||||||
|
return anchoredPath('EMBARK_PATH', ...arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
function dappPath() {
|
function dappPath() {
|
||||||
const _dappPath = process.env.DAPP_PATH;
|
return anchoredPath('DAPP_PATH', ...arguments);
|
||||||
if (!_dappPath) {
|
|
||||||
const errMsg = 'process.env.DAPP_PATH was not set'.bold.red;
|
|
||||||
console.error(errMsg);
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
return utils.joinPath(_dappPath, ...arguments);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function createWriteStream() {
|
function createWriteStream() {
|
||||||
|
|
Loading…
Reference in New Issue