add relative path compatibility

This commit is contained in:
Philipp Kunz 2017-05-12 19:12:03 +02:00
parent 2925a88e5b
commit 5a307f4c2c
2 changed files with 6 additions and 1 deletions

View File

@ -1,5 +1,6 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./qenv.plugins");
const helpers = require("./qenv.helpers"); const helpers = require("./qenv.helpers");
class Qenv { class Qenv {
constructor(basePathArg = process.cwd(), envYmlPathArg, failOnMissing = true) { constructor(basePathArg = process.cwd(), envYmlPathArg, failOnMissing = true) {
@ -7,6 +8,8 @@ class Qenv {
this.availableEnvVars = []; this.availableEnvVars = [];
this.missingEnvVars = []; this.missingEnvVars = [];
this.keyValueObjectArray = []; this.keyValueObjectArray = [];
basePathArg = plugins.path.resolve(basePathArg);
envYmlPathArg = plugins.path.resolve(basePathArg);
helpers.getRequiredEnvVars(basePathArg, this.requiredEnvVars); helpers.getRequiredEnvVars(basePathArg, this.requiredEnvVars);
helpers.getAvailableEnvVars(this.requiredEnvVars, envYmlPathArg, this.availableEnvVars, this.keyValueObjectArray); helpers.getAvailableEnvVars(this.requiredEnvVars, envYmlPathArg, this.availableEnvVars, this.keyValueObjectArray);
this.missingEnvVars = helpers.getMissingEnvVars(this.requiredEnvVars, this.availableEnvVars); this.missingEnvVars = helpers.getMissingEnvVars(this.requiredEnvVars, this.availableEnvVars);
@ -27,4 +30,4 @@ class Qenv {
} }
} }
exports.Qenv = Qenv; exports.Qenv = Qenv;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicWVudi5jbGFzc2VzLnFlbnYuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9xZW52LmNsYXNzZXMucWVudi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUNBLDBDQUF5QztBQU96QztJQUtFLFlBQWEsV0FBVyxHQUFHLE9BQU8sQ0FBQyxHQUFHLEVBQU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Q0FBQTtRQUNqSCxJQUFJLENBQUMsY0FBYyxHQUFHLE9BQU8sQ0FBQyxpQkFBaUIsQ0FBQyxJQUFJLENBQUMsZUFBZSxFQUFFLElBQUksQ0FBQyxnQkFBZ0IsQ0FBQyxDQUFBO1FBRTVGLDJCQUEyQjtRQUMzQixFQUFFLENBQUMsQ0FBQyxJQUFJLENBQUMsY0FBYyxDQUFDLE1BQU0sR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDO1lBQ25DLE9BQU8sQ0FBQyxJQUFJLENBQUMsd0JBQXdCLENBQUMsQ0FBQTtZQUN0QyxPQUFPLENBQUMsR0FBRyxDQUFDLElBQUksQ0FBQyxlQUFlLENBQUMsQ0FBQTtZQUNqQyxPQUFPLENBQUMsS0FBSyxDQUFDLG1EQUFtRCxDQUFDLENBQUE7WUFDbEUsT0FBTyxDQUFDLEdBQUcsQ0FBQyxJQUFJLENBQUMsY0FBYyxDQUFDLENBQUE7WUFDaEMsRUFBRSxDQUFDLENBQUMsYUFBYSxDQUFDLENBQUMsQ0FBQztnQkFDbEIsT0FBTyxDQUFDLEtBQUssQ0FBQyxVQUFVLENBQUMsQ0FBQTtnQkFDekIsT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsQ0FBQTtZQUNqQixDQUFDO1FBQ0gsQ0FBQztJQUNILENBQUM7SUFFRCxTQUFTLENBQUUsVUFBVTtRQUNuQixNQUFNLENBQUMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxVQUFVLENBQUMsQ0FBQTtJQUNoQyxDQUFDO0NBQ0Y7QUE1QkQsb0JBNEJDIn0=

View File

@ -12,6 +12,8 @@ export class Qenv {
missingEnvVars: string[] = [] missingEnvVars: string[] = []
keyValueObjectArray: IKeyValueObject[] = [] keyValueObjectArray: IKeyValueObject[] = []
constructor (basePathArg = process.cwd(), envYmlPathArg, failOnMissing = true) { constructor (basePathArg = process.cwd(), envYmlPathArg, failOnMissing = true) {
basePathArg = plugins.path.resolve(basePathArg)
envYmlPathArg = plugins.path.resolve(basePathArg)
helpers.getRequiredEnvVars(basePathArg, this.requiredEnvVars) helpers.getRequiredEnvVars(basePathArg, this.requiredEnvVars)
helpers.getAvailableEnvVars(this.requiredEnvVars, envYmlPathArg, this.availableEnvVars, this.keyValueObjectArray) helpers.getAvailableEnvVars(this.requiredEnvVars, envYmlPathArg, this.availableEnvVars, this.keyValueObjectArray)
this.missingEnvVars = helpers.getMissingEnvVars(this.requiredEnvVars, this.availableEnvVars) this.missingEnvVars = helpers.getMissingEnvVars(this.requiredEnvVars, this.availableEnvVars)