create basic structure
This commit is contained in:
		
							
								
								
									
										7
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							@@ -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.
 | 
			
		||||
@@ -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)"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										26
									
								
								ts/index.ts
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								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;
 | 
			
		||||
}
 | 
			
		||||
@@ -1,3 +1,4 @@
 | 
			
		||||
import "typings-global";
 | 
			
		||||
export import beautylog = require("beautylog");
 | 
			
		||||
export import path = require("path");
 | 
			
		||||
export import smartfile = require("smartfile");
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user