Compare commits

...

20 Commits

Author SHA1 Message Date
7527049fd0 1.1.3 2017-01-21 11:57:09 +01:00
25589d4ca2 cleanup dependencies 2017-01-21 11:57:04 +01:00
73c223af6c 1.1.2 2017-01-21 11:51:35 +01:00
ead69f3bb9 remove beautylog dependency 2017-01-21 11:51:30 +01:00
7de17bbefa add better README 2016-12-31 19:26:32 +01:00
4e39970dd7 1.1.1 2016-08-04 16:44:48 +02:00
2a7c239176 fix interface naming 2016-08-04 16:44:42 +02:00
35e71ccf00 1.1.0 2016-08-04 16:09:44 +02:00
11a2cf83ee add keyValueObjectArray 2016-08-04 16:09:39 +02:00
d7a0541d81 1.0.8 2016-06-21 16:25:09 +02:00
c03e17d522 improve log output 2016-06-21 16:25:03 +02:00
b9d1080829 1.0.7 2016-06-21 16:13:45 +02:00
a84a257e4b improve log output 2016-06-21 16:13:29 +02:00
2fa659a22a 1.0.6 2016-06-20 22:19:11 +02:00
bdc99cc3a6 link typings om package.json 2016-06-20 22:18:48 +02:00
2956278369 cosmetics 2016-06-20 12:05:35 +02:00
c61ef2eeba 1.0.5 2016-06-20 11:21:26 +02:00
41c97c4c05 improve README 2016-06-20 11:21:21 +02:00
8870f9adf2 1.0.4 2016-06-20 11:04:19 +02:00
dfb400ba5c improve README 2016-06-20 11:04:16 +02:00
14 changed files with 247 additions and 140 deletions

3
.gitignore vendored
View File

@ -1,3 +1,4 @@
node_modules/ node_modules/
coverage/ coverage/
docs/ pages/
public/

View File

@ -3,13 +3,16 @@ image: hosttoday/ht-docker-node:npmts
stages: stages:
- test - test
- release - release
- trigger
- pages
testLEGACY: testLEGACY:
stage: test stage: test
script: script:
- npmci test lts - npmci test legacy
tags: tags:
- docker - docker
allow_failure: true
testLTS: testLTS:
stage: test stage: test
@ -32,4 +35,25 @@ release:
only: only:
- tags - tags
tags: tags:
- docker - docker
trigger:
stage: trigger
script:
- npmci trigger
only:
- tags
tags:
- docker
pages:
image: hosttoday/ht-docker-node:npmpage
stage: pages
script:
- npmci command npmpage --publish gitlab
only:
- tags
artifacts:
expire_in: 1 week
paths:
- public

View File

@ -1,7 +1,40 @@
# qenv # qenv
provides an easy way for promised environments easy promised environments
## Availabililty
[![npm](https://push.rocks/assets/repo-button-npm.svg)](https://www.npmjs.com/package/qenv)
[![git](https://push.rocks/assets/repo-button-git.svg)](https://GitLab.com/pushrocks/qenv)
[![git](https://push.rocks/assets/repo-button-mirror.svg)](https://github.com/pushrocks/qenv)
[![docs](https://push.rocks/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/qenv/)
## Status for master
[![build status](https://GitLab.com/pushrocks/qenv/badges/master/build.svg)](https://GitLab.com/pushrocks/qenv/commits/master)
[![coverage report](https://GitLab.com/pushrocks/qenv/badges/master/coverage.svg)](https://GitLab.com/pushrocks/qenv/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/qenv.svg)](https://www.npmjs.com/package/qenv)
[![Dependency Status](https://david-dm.org/pushrocks/qenv.svg)](https://david-dm.org/pushrocks/qenv)
[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/qenv/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/qenv/master/dependencies/npm)
[![bitHound Code](https://www.bithound.io/github/pushrocks/qenv/badges/code.svg)](https://www.bithound.io/github/pushrocks/qenv)
[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
## Usage ## Usage
qenv looks for an qenv.yml that defines needed env vars. qenv dirst checks if they are already specified. Use TypeScript for best in class instellisense.
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. qenv works with two files:
* **qenv.yml** - specifies which ENV vars are required.
* **env.yml** - specifies all env vars that are not already set in the current environment.
Now obviously you can set build specific env vars in many CI environments.
So there we do not need an **env.yml** since all ENV vars are in place
However when on another machine you can have a env.yml that will be added to the environment by qenv.
```javascript
import {Qenv} from "qenv";
myQenv = new Qenv("path/to/dir/where/qenv.yml/is/","path/to/dir/where/env.yml/is(");
```
[![npm](https://push.rocks/assets/repo-header.svg)](https://push.rocks)

7
dist/index.d.ts vendored
View File

@ -1,6 +1,11 @@
export interface IKeyValueObject {
key: string;
value: string;
}
export declare class Qenv { export declare class Qenv {
requiredEnvVars: string[]; requiredEnvVars: string[];
availableEnvVars: string[]; availableEnvVars: string[];
missingEnvVars: string[]; missingEnvVars: string[];
constructor(basePathArg: string, envYmlPathArg: any); keyValueObjectArray: IKeyValueObject[];
constructor(basePathArg: string, envYmlPathArg: any, failOnMissing?: boolean);
} }

77
dist/index.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,4 @@
import "typings-global"; import 'typings-global';
export import beautylog = require("beautylog");
export declare let lodash: any; export declare let lodash: any;
export import path = require("path"); export import path = require('path');
export import smartfile = require("smartfile"); export import smartfile = require('smartfile');

View File

@ -1,8 +1,6 @@
"use strict"; "use strict";
require("typings-global"); require("typings-global");
exports.beautylog = require("beautylog"); exports.lodash = require('lodash');
exports.lodash = require("lodash");
exports.path = require("path"); exports.path = require("path");
exports.smartfile = require("smartfile"); exports.smartfile = require("smartfile");
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicWVudi5wbHVnaW5zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvcWVudi5wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSwwQkFBdUI7QUFDWixRQUFBLE1BQU0sR0FBRyxPQUFPLENBQUMsUUFBUSxDQUFDLENBQUE7QUFDckMsK0JBQW9DO0FBQ3BDLHlDQUE4QyJ9
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInFlbnYucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFBZ0IsQ0FBQyxDQUFBO0FBQ1YsaUJBQVMsV0FBVyxXQUFXLENBQUMsQ0FBQztBQUNwQyxjQUFNLEdBQUcsT0FBTyxDQUFDLFFBQVEsQ0FBQyxDQUFDO0FBQ3hCLFlBQUksV0FBVyxNQUFNLENBQUMsQ0FBQztBQUN2QixpQkFBUyxXQUFXLFdBQVcsQ0FBQyxDQUFDIiwiZmlsZSI6InFlbnYucGx1Z2lucy5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBcInR5cGluZ3MtZ2xvYmFsXCI7XG5leHBvcnQgaW1wb3J0IGJlYXV0eWxvZyA9IHJlcXVpcmUoXCJiZWF1dHlsb2dcIik7XG5leHBvcnQgbGV0IGxvZGFzaCA9IHJlcXVpcmUoXCJsb2Rhc2hcIik7XG5leHBvcnQgaW1wb3J0IHBhdGggPSByZXF1aXJlKFwicGF0aFwiKTtcbmV4cG9ydCBpbXBvcnQgc21hcnRmaWxlID0gcmVxdWlyZShcInNtYXJ0ZmlsZVwiKTtcbiJdfQ==

View File

@ -1,8 +1,9 @@
{ {
"name": "qenv", "name": "qenv",
"version": "1.0.3", "version": "1.1.3",
"description": "promised environments", "description": "easy promised environments",
"main": "dist/index.js", "main": "dist/index.js",
"typings": "dist/index.d.ts",
"scripts": { "scripts": {
"test": "(npmts)" "test": "(npmts)"
}, },
@ -22,15 +23,13 @@
}, },
"homepage": "https://gitlab.com/pushrocks/qenv#README", "homepage": "https://gitlab.com/pushrocks/qenv#README",
"devDependencies": { "devDependencies": {
"npmts-g": "^5.2.6", "npmts-g": "^6.0.0",
"should": "^9.0.2", "smartchai": "^1.0.1",
"typings-test": "^1.0.1" "typings-test": "^1.0.3"
}, },
"dependencies": { "dependencies": {
"beautylog": "^5.0.12", "lodash": "^4.17.4",
"lodash": "^4.13.1", "smartfile": "^4.1.3",
"q": "^1.4.1", "typings-global": "^1.0.14"
"smartfile": "^3.0.10",
"typings-global": "^1.0.3"
} }
} }

3
test/test.d.ts vendored
View File

@ -1,2 +1 @@
import "typings-test"; import 'typings-test';
import "should";

View File

@ -1,23 +1,26 @@
"use strict"; "use strict";
require("typings-test"); require("typings-test");
var path = require("path"); const path = require("path");
require("should"); const smartchai_1 = require("smartchai");
var index_1 = require("../dist/index"); const index_1 = require("../dist/index");
process.cwd = function () { process.cwd = () => {
return path.join(__dirname, "./assets/"); return path.join(__dirname, './assets/');
}; };
process.env["key1"] = "original"; process.env['key1'] = 'original';
var qenvTestObject; let qenvTestObject;
describe("Qenv class", function () { describe('Qenv class', function () {
it("should create a new class", function () { it('should create a new class', function () {
qenvTestObject = new index_1.Qenv(process.cwd(), process.cwd()); qenvTestObject = new index_1.Qenv(process.cwd(), process.cwd(), false);
}); });
it("key1 should be not be overwritten since it is already present", function () { it('key1 should be not be overwritten since it is already present', function () {
process.env.key1.should.equal("original"); smartchai_1.expect(process.env.key1).to.equal('original');
}); });
it("key2 should be read from Yml", function () { it('key2 should be read from Yml', function () {
process.env.key2.should.equal("fromYml"); smartchai_1.expect(process.env.key2).to.equal('fromYml');
});
it('keyValueObjectArray should hold all retrieved values', function () {
smartchai_1.expect(qenvTestObject.keyValueObjectArray[0].value).to.equal('original');
smartchai_1.expect(qenvTestObject.keyValueObjectArray[1].value).to.equal('fromYml');
}); });
}); });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLHdCQUFxQjtBQUNyQiw2QkFBNEI7QUFDNUIseUNBQWtDO0FBQ2xDLHlDQUFrQztBQUVsQyxPQUFPLENBQUMsR0FBRyxHQUFHO0lBQ1YsTUFBTSxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsU0FBUyxFQUFDLFdBQVcsQ0FBQy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"path"; import * as path from 'path'
import "should"; import { expect } from 'smartchai'
import {Qenv} from "../dist/index"; import {Qenv} from '../dist/index'
process.cwd = () => { process.cwd = () => {
return path.join(__dirname,"./assets/"); return path.join(__dirname,'./assets/')
} }
process.env["key1"] = "original" process.env['key1'] = 'original'
let qenvTestObject:Qenv; let qenvTestObject: Qenv
describe("Qenv class",function(){ describe('Qenv class',function(){
it("should create a new class",function(){ it('should create a new class',function(){
qenvTestObject = new Qenv(process.cwd(),process.cwd()); qenvTestObject = new Qenv(process.cwd(),process.cwd(),false)
}); })
it("key1 should be not be overwritten since it is already present",function(){ it('key1 should be not be overwritten since it is already present',function(){
process.env.key1.should.equal("original"); expect(process.env.key1).to.equal('original')
}); })
it("key2 should be read from Yml",function(){ it('key2 should be read from Yml',function(){
process.env.key2.should.equal("fromYml"); expect(process.env.key2).to.equal('fromYml')
})
it('keyValueObjectArray should hold all retrieved values',function(){
expect(qenvTestObject.keyValueObjectArray[0].value).to.equal('original')
expect(qenvTestObject.keyValueObjectArray[1].value).to.equal('fromYml')
}) })
}); })

View File

@ -1,51 +1,74 @@
import * as plugins from "./qenv.plugins"; import * as plugins from './qenv.plugins'
export class Qenv { export interface IKeyValueObject {
requiredEnvVars:string[]; key: string,
availableEnvVars:string[]; value: string
missingEnvVars:string[];
constructor(basePathArg = process.cwd(),envYmlPathArg){
this.requiredEnvVars = getRequiredEnvVars(basePathArg);
this.availableEnvVars = getAvailableEnvVars(this.requiredEnvVars,envYmlPathArg);
this.missingEnvVars = getMissingEnvVars(this.requiredEnvVars,this.availableEnvVars);
for(let keyArg in this.missingEnvVars){
plugins.beautylog.warn(this.missingEnvVars[keyArg] + " is required, but missing!")
}
}
}; };
let getRequiredEnvVars = (pathArg:string):string[] => { export class Qenv {
let result:string[] = []; requiredEnvVars: string[] = []
let qenvFilePath = plugins.path.join(pathArg,"qenv.yml"); availableEnvVars: string[] = []
let qenvFile = plugins.smartfile.local.toObjectSync(qenvFilePath); missingEnvVars: string[] = []
for(let keyArg in qenvFile.vars){ keyValueObjectArray: IKeyValueObject[] = []
result.push(qenvFile.vars[keyArg]); constructor(basePathArg = process.cwd(),envYmlPathArg,failOnMissing = true) {
} getRequiredEnvVars(basePathArg,this.requiredEnvVars)
return result; getAvailableEnvVars(this.requiredEnvVars,envYmlPathArg,this.availableEnvVars,this.keyValueObjectArray)
} this.missingEnvVars = getMissingEnvVars(this.requiredEnvVars,this.availableEnvVars)
let getAvailableEnvVars = (requiredEnvVarsArg:string[],envYmlPathArg:string):string[] => { // handle missing variables
let result = []; if (this.missingEnvVars.length > 0) {
envYmlPathArg = plugins.path.join(envYmlPathArg,"env.yml") console.info('Required Env Vars are:')
let envYml; console.log(this.requiredEnvVars)
try { console.error('However some Env variables could not be resolved:')
envYml = plugins.smartfile.local.toObjectSync(envYmlPathArg); console.log(this.missingEnvVars)
} if (failOnMissing) {
catch(err){ console.error('Exiting!')
envYml = {}; process.exit(1)
} }
for(let keyArg in requiredEnvVarsArg){
let requiredEnvVar:string = requiredEnvVarsArg[keyArg];
if(process.env[requiredEnvVar]){
result.push(requiredEnvVar);
} else if(envYml.hasOwnProperty(requiredEnvVar)){
process.env[requiredEnvVar] = envYml[requiredEnvVar];
result.push(requiredEnvVar);
} }
} };
return result; };
let getRequiredEnvVars = (pathArg: string, requiredEnvVarsArray: string[]) => {
let qenvFilePath = plugins.path.join(pathArg,'qenv.yml')
let qenvFile = plugins.smartfile.fs.toObjectSync(qenvFilePath)
for (let keyArg in qenvFile.vars) {
requiredEnvVarsArray.push(qenvFile.vars[keyArg])
};
} }
let getMissingEnvVars = (requiredEnvVarsArray:string[],availableEnvVarsArray:string[]) => { let getAvailableEnvVars = (
return plugins.lodash.difference(requiredEnvVarsArray,availableEnvVarsArray); requiredEnvVarsArg: string[],
} envYmlPathArg: string,
availableEnvVarsArray: string[],
keyValueObjectArrayArg: IKeyValueObject[]
) => {
envYmlPathArg = plugins.path.join(envYmlPathArg,'env.yml')
let envYml
try {
envYml = plugins.smartfile.fs.toObjectSync(envYmlPathArg)
} catch (err) {
console.log("env file couldn't be found at " + envYmlPathArg)
envYml = {}
}
for (let requiredEnvVar of requiredEnvVarsArg){
if (process.env[requiredEnvVar]) {
availableEnvVarsArray.push(requiredEnvVar)
keyValueObjectArrayArg.push({
key: requiredEnvVar,
value: process.env[requiredEnvVar]
})
} else if (envYml.hasOwnProperty(requiredEnvVar)) {
process.env[requiredEnvVar] = envYml[requiredEnvVar]
availableEnvVarsArray.push(requiredEnvVar)
keyValueObjectArrayArg.push({
key: requiredEnvVar,
value: process.env[requiredEnvVar]
})
}
};
}
let getMissingEnvVars = (requiredEnvVarsArray: string[],availableEnvVarsArray: string[]) => {
return plugins.lodash.difference(requiredEnvVarsArray,availableEnvVarsArray)
}

View File

@ -1,5 +1,4 @@
import "typings-global"; import 'typings-global'
export import beautylog = require("beautylog"); export let lodash = require('lodash')
export let lodash = require("lodash"); export import path = require('path')
export import path = require("path"); export import smartfile = require('smartfile')
export import smartfile = require("smartfile");

3
tslint.json Normal file
View File

@ -0,0 +1,3 @@
{
"extends": "tslint-config-standard"
}