From 8b715c52ac30565e808ddb25d99a4fdd54e7bed4 Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Sun, 19 Jun 2016 20:08:34 +0200 Subject: [PATCH] create basic structure --- README.md | 7 +++++++ package.json | 2 +- ts/index.ts | 26 ++++++++++++++++++++++++++ ts/qenv.plugins.ts | 1 + 4 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..db59da5 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# qenv +provides an easy way for promised environments + +## Usage +qenv looks for an qenv.yml that defines needed env vars. qenv dirst checks if they are already specified. +If not, qenv by default looks for a .nogit/env.yml file. +If any env var is not specified, qenv throws an error and exits. \ No newline at end of file diff --git a/package.json b/package.json index b72a1b9..5f19003 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "qenv", "version": "1.0.1", - "description": "smart handling of environment variables", + "description": "promised environments", "main": "dist/index.js", "scripts": { "test": "(npmts)" diff --git a/ts/index.ts b/ts/index.ts index e69de29..fd231a8 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -0,0 +1,26 @@ +import * as plugins from "./qenv.plugins"; + +export class qenv { + envVarsRequired:string[]; + envVarsAvailable:string[]; + envVarsMissing:string[]; + constructor(basePathArg = "./qenv.yml",envYmlPathArg){ + this.envVarsRequired = getEnvVarsRequired(basePathArg); + this.envVarsAvailable; + } +}; + +let getEnvVarsRequired = (pathArg:string):string[] => { + let result:string[] = []; + let qenvFilePath = plugins.path.join(pathArg,"qenv.yml"); + let qenvFile = plugins.smartfile.local.toObjectSync(qenvFilePath); + for(let keyArg in qenvFile.vars){ + result.push(qenvFile.vars[keyArg]); + } + return result; +} + +let getEnvVarsAvailable = ():string[] => { + let result = []; + return result; +} \ No newline at end of file diff --git a/ts/qenv.plugins.ts b/ts/qenv.plugins.ts index 40ea398..18ecf52 100644 --- a/ts/qenv.plugins.ts +++ b/ts/qenv.plugins.ts @@ -1,3 +1,4 @@ import "typings-global"; export import beautylog = require("beautylog"); +export import path = require("path"); export import smartfile = require("smartfile");