initial
This commit is contained in:
		
							
								
								
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
			
		||||
node_modules/
 | 
			
		||||
.settings/
 | 
			
		||||
.idea/
 | 
			
		||||
							
								
								
									
										16
									
								
								.travis.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								.travis.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
			
		||||
language: node_js
 | 
			
		||||
node_js:
 | 
			
		||||
- 4.2.2
 | 
			
		||||
before_install:
 | 
			
		||||
- npm install -g tsd
 | 
			
		||||
deploy:
 | 
			
		||||
  provider: npm
 | 
			
		||||
  email: npm@smart-coordination.com
 | 
			
		||||
  api_key:
 | 
			
		||||
    secure: uNjLbNelm8nj9R/tRlwRvcXWLS1QtA0QEbDKPDTWHNo68wAHgdwXIdzkVkNcihZYVasR/LqGuSLfzoD4H8mKmCXD+v85h048VmmtWniZQRp/OVWl0uzRwDDryhiYlhY5U9oOFEQsMO96C8qPqcGchq+DA7Gi3ZnAl7pmeb54xp9H+7jmLyZTyO8Hq00anV5PopBOW23mZEnWHznzYeg83BlWmLdbyfyZKT4W5Urg1BAMgxt9PdtrQoiPy4LP6AHXG88kvY3Iz8OBG+h/06bura8MPfeupGoktodN9krb+sRE/COybATWImMh9Z5gI5TWqUR7tp7XivpgolYY41gaN93oUQ9EOTdJ5kFku1dnPrNFqXO/97slVTMR6fMMgRXwzTz6BiKI1NsAZeW7oLUONw06APZ6VBhVY6Po3Rioun8OE9Q0wXm/BvnRqVHt3sew4MIgmEBwQSQE14gLJGGgNojzmcPstc0czQp+kzV5DpGiW3IWIWZ7MsBJOOJ13RHeb6koFdBR7JZj0QzzBcWD7juJVOS45MlP7hU/sKRDO/fN3nu8TNwHvJab6XYP5/gqlbh/3h2vb7bxyDXiKGi2Ds8hZOHoyWoCrU3sbH3eKKkKo+LFI3J7PbY11T6TkSAdszLsQzcvC2QlsGQRWVywYMm32R6BVfxF3AlLX5a8JsI=
 | 
			
		||||
  on:
 | 
			
		||||
    tags: true
 | 
			
		||||
    repo: pushrocks/smartenv
 | 
			
		||||
notifications:
 | 
			
		||||
  slack:
 | 
			
		||||
    secure: f5Uss0z9RPl/QcA/DroB8loyE93aOYI6bqCkrsiUscmZtlv/TVQtT4dxqGA6uvcG6iTQDBi3Ul88dQxWkRm4IqbhY35/iMaV2dHW4FVYMAh8GQMbsfL2sALCcufxD9blw47awv3iFcwhV1EeyesscjgL0JIjduk96v/7G/6QIO2838M1lzlgtj+kRUkim8qkaEs1je3gRrhMUIjLuAdscMXyUKYFMjWo9ACSjVUl30R/ZNemb18itIja6i92GotreBgcfEMczvy58ovDC7xdJUsY8LjMI01DwY+WPRnI0tAhsuI8moBwwcdM4e3bAjKjucQRjO33O5bMWRZ6QCiYd0DnCEFyCPQLJ4GSy/tkD00n8ijLHAOSV3AH1zNbdK1EAdSPQXDvlI36KJn/2hyQLoitGHVUPr76ujJWP82ypO2tgIp3XQU0dJVCxDuHnwJO2+hjdI+gCPqxNTpjeujHx3UdkTGNRjuuf9dlZ/D08fApjYxy2fxItTqo3QjP/nrqvBXUOPP8yPHpjIT4H2t5Pr4SJjBGI6X4qhKyFj6s9rA/Xu1rL+45zu1C3uC3z+u3T9UwrbzJ/cZM6r6UQvQmUvIfBNaMlg4I/diQCDIPL+Rhop2nylY3IcHmJnk2itn7kOqj1tohCpFEml5pRuSZy4udWywkdtyBAsHWFLF7oiQ=
 | 
			
		||||
							
								
								
									
										28
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,28 @@
 | 
			
		||||
# smartenv
 | 
			
		||||
store things about your environment and let them travel across modules
 | 
			
		||||
 | 
			
		||||
## Status
 | 
			
		||||
[](https://travis-ci.org/pushrocks/smartenv)
 | 
			
		||||
[](https://david-dm.org/pushrocks/smartenv)
 | 
			
		||||
[](https://david-dm.org/pushrocks/smartenv#info=devDependencies)
 | 
			
		||||
[](https://www.bithound.io/github/pushrocks/smartenv/master/dependencies/npm)
 | 
			
		||||
[](https://www.bithound.io/github/pushrocks/smartenv)
 | 
			
		||||
 | 
			
		||||
## Install
 | 
			
		||||
Install the package through npm
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
npm install smartenv
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Usage
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
var smartenv = require("smartenv");
 | 
			
		||||
 | 
			
		||||
smartenv.info(); //prints an output about your current environment and registered objects
 | 
			
		||||
smartenv.register({akey:"a text"},"somevalue"); // register a new object
 | 
			
		||||
smartenv.makeGlobal() // make smartenv available from gobal.smartenv
 | 
			
		||||
smartenv.get("somevalue").akey; // returns "a text"
 | 
			
		||||
smartenv.items.somevalue.akey; // also returns "a text"
 | 
			
		||||
```
 | 
			
		||||
							
								
								
									
										35
									
								
								index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								index.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,35 @@
 | 
			
		||||
/// <reference path="typings/tsd.d.ts" />
 | 
			
		||||
var beautylog = require("beautylog")("os");
 | 
			
		||||
var addToGlobal = function (objectArg, paramName) {
 | 
			
		||||
    global[paramName] = objectArg;
 | 
			
		||||
};
 | 
			
		||||
var smartenv = {}; //create smartenv object
 | 
			
		||||
smartenv.items = {}; // create the items object to store items to.
 | 
			
		||||
smartenv.makeGlobal = function () {
 | 
			
		||||
    addToGlobal(smartenv, "smartenv"); //add object smartenv as global["smartenv"]
 | 
			
		||||
};
 | 
			
		||||
smartenv.info = {};
 | 
			
		||||
smartenv.info.node = {};
 | 
			
		||||
smartenv.info.node.version = process.version;
 | 
			
		||||
smartenv.info.print = function () {
 | 
			
		||||
    var pck = require("./package.json");
 | 
			
		||||
    beautylog.log("node version is " + smartenv.info.node.version + " and smartenv version is " + pck.version);
 | 
			
		||||
    beautylog.log("the smartenv module currently holds the following properties:");
 | 
			
		||||
    console.log(Object.getOwnPropertyNames(smartenv.items).sort());
 | 
			
		||||
};
 | 
			
		||||
smartenv.register = function (objectArg, paramName) {
 | 
			
		||||
    if (paramName === void 0) { paramName = "undefined"; }
 | 
			
		||||
    if (paramName == "undefined") {
 | 
			
		||||
        beautylog.error("paramName is undefined");
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    smartenv.items[paramName] = objectArg;
 | 
			
		||||
};
 | 
			
		||||
smartenv.get = function (keyName) {
 | 
			
		||||
    return smartenv.items[keyName];
 | 
			
		||||
};
 | 
			
		||||
smartenv.exportEnv = function () {
 | 
			
		||||
};
 | 
			
		||||
smartenv.importEnv = function () {
 | 
			
		||||
};
 | 
			
		||||
module.exports = smartenv;
 | 
			
		||||
							
								
								
									
										32
									
								
								package.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								package.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,32 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "smartci",
 | 
			
		||||
  "version": "0.0.0",
 | 
			
		||||
  "description": "makes it easy to automate tasks with Continuous Integration",
 | 
			
		||||
  "main": "index.js",
 | 
			
		||||
  "scripts": {
 | 
			
		||||
    "test": "(cd ts/compile && node compile.js) && (node test.js)",
 | 
			
		||||
    "reinstall": "(rm -r node_modules && npm install)",
 | 
			
		||||
    "release": "(git pull origin master && npm version patch && git push origin master && git checkout release && git merge master && git push origin release && git checkout master)",
 | 
			
		||||
    "startdev": "(git checkout master && git pull origin master && npm install)"
 | 
			
		||||
  },
 | 
			
		||||
  "repository": {
 | 
			
		||||
    "type": "git",
 | 
			
		||||
    "url": "https://github.com/pushrocks/smartci.git"
 | 
			
		||||
  },
 | 
			
		||||
  "keywords": [
 | 
			
		||||
    "environment"
 | 
			
		||||
  ],
 | 
			
		||||
  "author": "Smart Coordination GmbH <office@push.rocks> (https://push.rocks)",
 | 
			
		||||
  "license": "MIT",
 | 
			
		||||
  "bugs": {
 | 
			
		||||
    "url": "https://github.com/pushrocks/smartci/issues"
 | 
			
		||||
  },
 | 
			
		||||
  "homepage": "https://github.com/pushrocks/smartci",
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
    "beautylog": "^1.0.4"
 | 
			
		||||
  },
 | 
			
		||||
  "devDependencies": {
 | 
			
		||||
    "gulp": "^3.9.0",
 | 
			
		||||
    "gulp-typescript": "^2.9.2"
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										15
									
								
								test.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								test.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
/// <reference path="typings/tsd.d.ts" />
 | 
			
		||||
var smartenv = require("./index.js");
 | 
			
		||||
var beautylog = require("beautylog")("os");
 | 
			
		||||
beautylog.info("Now testing the smartenv module");
 | 
			
		||||
smartenv.info.print();
 | 
			
		||||
beautylog.info("Now testing the smartenv module");
 | 
			
		||||
smartenv.register({ key1: "Peter" }, "docit");
 | 
			
		||||
smartenv.info.print();
 | 
			
		||||
beautylog.log(smartenv.get("docit").key1);
 | 
			
		||||
smartenv.makeGlobal();
 | 
			
		||||
beautylog.log(global.smartenv.get("docit").key1);
 | 
			
		||||
var key2 = "hello";
 | 
			
		||||
smartenv.get("docit").key2 = key2;
 | 
			
		||||
beautylog.log(global.smartenv.get("docit").key2);
 | 
			
		||||
beautylog.success("Success!");
 | 
			
		||||
							
								
								
									
										7
									
								
								ts/classes.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								ts/classes.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
/// <reference path="index.ts" />
 | 
			
		||||
var Environment = (function () {
 | 
			
		||||
    function Environment() {
 | 
			
		||||
    }
 | 
			
		||||
    return Environment;
 | 
			
		||||
})();
 | 
			
		||||
//# sourceMappingURL=classes.js.map
 | 
			
		||||
							
								
								
									
										1
									
								
								ts/classes.js.map
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								ts/classes.js.map
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
{"version":3,"file":"classes.js","sourceRoot":"","sources":["classes.ts"],"names":["Environment","Environment.constructor"],"mappings":"AAAA,iCAAiC;AACjC;IAAAA;IAKAC,CAACA;IAADD,kBAACA;AAADA,CAACA,AALD,IAKC"}
 | 
			
		||||
							
								
								
									
										7
									
								
								ts/classes.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								ts/classes.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
/// <reference path="index.ts" />
 | 
			
		||||
class Environment {
 | 
			
		||||
    runtimeEnv:string;
 | 
			
		||||
    isBrowser:boolean;
 | 
			
		||||
    isNode:boolean;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										28
									
								
								ts/compile/compile.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								ts/compile/compile.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,28 @@
 | 
			
		||||
// import gulp
 | 
			
		||||
var gulp = require("gulp");
 | 
			
		||||
var gulpTypescript = require("gulp-typescript");
 | 
			
		||||
var bl = require("beautylog")("os");
 | 
			
		||||
 | 
			
		||||
gulp.task('compileTS', function() {
 | 
			
		||||
	var stream = gulp.src('../index.ts')
 | 
			
		||||
	  .pipe(gulpTypescript({
 | 
			
		||||
	  	out: "index.js"
 | 
			
		||||
	  }))
 | 
			
		||||
	  .pipe(gulp.dest("../../"));
 | 
			
		||||
	return stream;
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
gulp.task('compileTestTS', function() {
 | 
			
		||||
	var stream = gulp.src('../test.ts')
 | 
			
		||||
			.pipe(gulpTypescript({
 | 
			
		||||
				out: "test.js"
 | 
			
		||||
			}))
 | 
			
		||||
			.pipe(gulp.dest("../../"));
 | 
			
		||||
	return stream;
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
gulp.task('default',['compileTS','compileTestTS'], function() {
 | 
			
		||||
	bl.success('Typescript compiled');
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
gulp.start.apply(gulp, ['default']);
 | 
			
		||||
							
								
								
									
										2
									
								
								ts/compile/readme.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								ts/compile/readme.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,2 @@
 | 
			
		||||
# How to compile.
 | 
			
		||||
Make sure gulp and gulp-taypescript from npm are available. Then run the gulpfile in this directory.
 | 
			
		||||
							
								
								
									
										50
									
								
								ts/index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								ts/index.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,50 @@
 | 
			
		||||
/// <reference path="typings/tsd.d.ts" />
 | 
			
		||||
/// <reference path="classes.ts" />
 | 
			
		||||
var beautylog = require("beautylog")("os");
 | 
			
		||||
var addToGlobal = function (objectArg, paramName) {
 | 
			
		||||
    global[paramName] = objectArg;
 | 
			
		||||
};
 | 
			
		||||
var smartenv = {}; //create smartenv object
 | 
			
		||||
smartenv.items = {}; // create the items object to store items to.
 | 
			
		||||
smartenv.makeGlobal = function () {
 | 
			
		||||
    addToGlobal(smartenv, "smartenv"); //add object smartenv as global["smartenv"]
 | 
			
		||||
};
 | 
			
		||||
smartenv.info = {};
 | 
			
		||||
smartenv.info.jsenv = function () {
 | 
			
		||||
    var app = {
 | 
			
		||||
        env: '',
 | 
			
		||||
        agent: ''
 | 
			
		||||
    };
 | 
			
		||||
    if (window) {
 | 
			
		||||
        app.env = 'browser';
 | 
			
		||||
        app.agent = navigator.userAgent;
 | 
			
		||||
    }
 | 
			
		||||
    else if (process) {
 | 
			
		||||
        app.env = 'node';
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
smartenv.info.node = {};
 | 
			
		||||
smartenv.info.node.version = process.version;
 | 
			
		||||
smartenv.info.print = function () {
 | 
			
		||||
    var pck = require("./package.json");
 | 
			
		||||
    beautylog.log("node version is " + smartenv.info.node.version + " and smartenv version is " + pck.version);
 | 
			
		||||
    beautylog.log("the smartenv module currently holds the following properties:");
 | 
			
		||||
    console.log(Object.getOwnPropertyNames(smartenv.items).sort());
 | 
			
		||||
};
 | 
			
		||||
smartenv.register = function (objectArg, paramName) {
 | 
			
		||||
    if (paramName === void 0) { paramName = "undefined"; }
 | 
			
		||||
    if (paramName == "undefined") {
 | 
			
		||||
        beautylog.error("paramName is undefined");
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    smartenv.items[paramName] = objectArg;
 | 
			
		||||
};
 | 
			
		||||
smartenv.get = function (keyName) {
 | 
			
		||||
    return smartenv.items[keyName];
 | 
			
		||||
};
 | 
			
		||||
smartenv.exportEnv = function () {
 | 
			
		||||
};
 | 
			
		||||
smartenv.importEnv = function () {
 | 
			
		||||
};
 | 
			
		||||
module.exports = smartenv;
 | 
			
		||||
//# sourceMappingURL=index.js.map
 | 
			
		||||
							
								
								
									
										1
									
								
								ts/index.js.map
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								ts/index.js.map
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,mCAAmC;AACnC,IAAI,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC;AAC3C,IAAI,WAAW,GAAG,UAAS,SAAS,EAAC,SAAS;IAC1C,MAAM,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;AAClC,CAAC,CAAC;AACF,IAAI,QAAQ,GAAO,EAAE,CAAC,CAAC,wBAAwB;AAC/C,QAAQ,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC,6CAA6C;AAClE,QAAQ,CAAC,UAAU,GAAG;IAClB,WAAW,CAAC,QAAQ,EAAC,UAAU,CAAC,CAAC,CAAA,2CAA2C;AAChF,CAAC,CAAC;AAGF,QAAQ,CAAC,IAAI,GAAG,EAAE,CAAC;AACnB,QAAQ,CAAC,IAAI,CAAC,KAAK,GAAG;IAClB,IAAI,GAAG,GAAG;QACN,GAAG,EAAE,EAAE;QACP,KAAK,EAAE,EAAE;KACZ,CAAC;IAEF,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;QACT,GAAG,CAAC,GAAG,GAAG,SAAS,CAAC;QACpB,GAAG,CAAC,KAAK,GAAG,SAAS,CAAC,SAAS,CAAC;IACpC,CAAC;IAAC,IAAI,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;QACjB,GAAG,CAAC,GAAG,GAAG,MAAM,CAAC;IACrB,CAAC;AACL,CAAC,CAAC;AACF,QAAQ,CAAC,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;AACxB,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;AAC7C,QAAQ,CAAC,IAAI,CAAC,KAAK,GAAG;IAClB,IAAI,GAAG,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACpC,SAAS,CAAC,GAAG,CAAC,kBAAkB,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,GAAG,2BAA2B,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC;IAC3G,SAAS,CAAC,GAAG,CAAC,+DAA+D,CAAC,CAAC;IAC/E,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,mBAAmB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;AACnE,CAAC,CAAC;AAEF,QAAQ,CAAC,QAAQ,GAAG,UAAS,SAAS,EAAC,SAAuB;IAAvB,yBAAuB,GAAvB,uBAAuB;IAC1D,EAAE,CAAC,CAAC,SAAS,IAAI,WAAW,CAAC,CAAA,CAAC;QAC1B,SAAS,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAC1C,MAAM,CAAC;IACX,CAAC;IACD,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;AAC1C,CAAC,CAAC;AACF,QAAQ,CAAC,GAAG,GAAG,UAAS,OAAO;IAC3B,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AACnC,CAAC,CAAC;AAEF,QAAQ,CAAC,SAAS,GAAG;AAErB,CAAC,CAAC;AAEF,QAAQ,CAAC,SAAS,GAAG;AAErB,CAAC,CAAC;AAEF,MAAM,CAAC,OAAO,GAAG,QAAQ,CAAC"}
 | 
			
		||||
							
								
								
									
										56
									
								
								ts/index.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								ts/index.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,56 @@
 | 
			
		||||
/// <reference path="typings/tsd.d.ts" />
 | 
			
		||||
/// <reference path="classes.ts" />
 | 
			
		||||
var beautylog = require("beautylog")("os");
 | 
			
		||||
var addToGlobal = function(objectArg,paramName) {
 | 
			
		||||
    global[paramName] = objectArg;
 | 
			
		||||
};
 | 
			
		||||
var smartenv:any = {}; //create smartenv object
 | 
			
		||||
smartenv.items = {}; // create the items object to store items to.
 | 
			
		||||
smartenv.makeGlobal = function() {
 | 
			
		||||
    addToGlobal(smartenv,"smartenv");//add object smartenv as global["smartenv"]
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
smartenv.info = {};
 | 
			
		||||
smartenv.info.jsenv = function() {
 | 
			
		||||
    var app = {
 | 
			
		||||
        env: '',
 | 
			
		||||
        agent: ''
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    if (window) {
 | 
			
		||||
        app.env = 'browser';
 | 
			
		||||
        app.agent = navigator.userAgent;
 | 
			
		||||
    } else if (process) {
 | 
			
		||||
        app.env = 'node';
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
smartenv.info.node = {};
 | 
			
		||||
smartenv.info.node.version = process.version;
 | 
			
		||||
smartenv.info.print = function() {
 | 
			
		||||
    var pck = require("./package.json");
 | 
			
		||||
    beautylog.log("node version is " + smartenv.info.node.version + " and smartenv version is " + pck.version);
 | 
			
		||||
    beautylog.log("the smartenv module currently holds the following properties:");
 | 
			
		||||
    console.log(Object.getOwnPropertyNames(smartenv.items).sort());
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
smartenv.register = function(objectArg,paramName = "undefined") {
 | 
			
		||||
    if (paramName == "undefined"){
 | 
			
		||||
        beautylog.error("paramName is undefined");
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    smartenv.items[paramName] = objectArg;
 | 
			
		||||
};
 | 
			
		||||
smartenv.get = function(keyName) {
 | 
			
		||||
    return smartenv.items[keyName];
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
smartenv.exportEnv = function() {
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
smartenv.importEnv = function() {
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
module.exports = smartenv;
 | 
			
		||||
							
								
								
									
										16
									
								
								ts/test.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								ts/test.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
			
		||||
/// <reference path="typings/tsd.d.ts" />
 | 
			
		||||
var smartenv = require("./index.js");
 | 
			
		||||
var beautylog = require("beautylog")("os");
 | 
			
		||||
beautylog.info("Now testing the smartenv module");
 | 
			
		||||
smartenv.info.print();
 | 
			
		||||
beautylog.info("Now testing the smartenv module");
 | 
			
		||||
smartenv.register({ key1: "Peter" }, "docit");
 | 
			
		||||
smartenv.info.print();
 | 
			
		||||
beautylog.log(smartenv.get("docit").key1);
 | 
			
		||||
smartenv.makeGlobal();
 | 
			
		||||
beautylog.log(global.smartenv.get("docit").key1);
 | 
			
		||||
var key2 = "hello";
 | 
			
		||||
smartenv.get("docit").key2 = key2;
 | 
			
		||||
beautylog.log(global.smartenv.get("docit").key2);
 | 
			
		||||
beautylog.success("Success!");
 | 
			
		||||
//# sourceMappingURL=test.js.map
 | 
			
		||||
							
								
								
									
										1
									
								
								ts/test.js.map
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								ts/test.js.map
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,IAAI,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AACrC,IAAI,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC;AAC3C,SAAS,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;AAClD,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;AACtB,SAAS,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;AAClD,QAAQ,CAAC,QAAQ,CAAC,EAAC,IAAI,EAAC,OAAO,EAAC,EAAC,OAAO,CAAC,CAAC;AAC1C,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;AACtB,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;AAC1C,QAAQ,CAAC,UAAU,EAAE,CAAC;AACtB,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;AAEjD,IAAI,IAAI,GAAG,OAAO,CAAC;AACnB,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC;AAClC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;AAEjD,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC"}
 | 
			
		||||
							
								
								
									
										17
									
								
								ts/test.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								ts/test.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
			
		||||
/// <reference path="typings/tsd.d.ts" />
 | 
			
		||||
var smartenv = require("./index.js");
 | 
			
		||||
var beautylog = require("beautylog")("os");
 | 
			
		||||
beautylog.info("Now testing the smartenv module");
 | 
			
		||||
smartenv.info.print();
 | 
			
		||||
beautylog.info("Now testing the smartenv module");
 | 
			
		||||
smartenv.register({key1:"Peter"},"docit");
 | 
			
		||||
smartenv.info.print();
 | 
			
		||||
beautylog.log(smartenv.get("docit").key1);
 | 
			
		||||
smartenv.makeGlobal();
 | 
			
		||||
beautylog.log(global.smartenv.get("docit").key1);
 | 
			
		||||
 | 
			
		||||
var key2 = "hello";
 | 
			
		||||
smartenv.get("docit").key2 = key2;
 | 
			
		||||
beautylog.log(global.smartenv.get("docit").key2);
 | 
			
		||||
 | 
			
		||||
beautylog.success("Success!");
 | 
			
		||||
							
								
								
									
										12
									
								
								ts/tsd.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								ts/tsd.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
{
 | 
			
		||||
  "version": "v4",
 | 
			
		||||
  "repo": "borisyankov/DefinitelyTyped",
 | 
			
		||||
  "ref": "master",
 | 
			
		||||
  "path": "typings",
 | 
			
		||||
  "bundle": "typings/tsd.d.ts",
 | 
			
		||||
  "installed": {
 | 
			
		||||
    "node/node.d.ts": {
 | 
			
		||||
      "commit": "efa0c1196d7280640e624ac1e7fa604502e7bd63"
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										2079
									
								
								ts/typings/node/node.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2079
									
								
								ts/typings/node/node.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1
									
								
								ts/typings/tsd.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								ts/typings/tsd.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
/// <reference path="node/node.d.ts" />
 | 
			
		||||
		Reference in New Issue
	
	Block a user