Skip to content

Commit 6d01c27

Browse files
committed
- added ignore functionality for npm modules
- dips libraries (dependency and entity) are now accessible via exports - added license (MIT) details - updated documentation
1 parent a577031 commit 6d01c27

24 files changed

+896
-137
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2014 - Christoph Rust
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
# Dips [![Build Status](https://travis-ci.org/devcrust/node-dips.png?branch=master)](https://travis-ci.org/devcrust/node-dips)
1+
# Dips [![NPM version](https://badge.fury.io/js/dips.png)](http://badge.fury.io/js/dips) [![Build Status](https://travis-ci.org/devcrust/node-dips.png?branch=master)](https://travis-ci.org/devcrust/node-dips)
22

3-
A simple yet powerfull dependency injection and entity (file) management framework for Node.js
3+
A simple yet powerful dependency injection and entity (file) management framework for Node.js
4+
5+
[![NPM](https://nodei.co/npm/dips.png)](https://nodei.co/npm/dips/)
46

57
---
68

79
## Features
810

911
* Inject all types of dependencies (Function, Object/Instance, Array, Boolean, String, Number, etc.)
1012
* Support for Node.js core and NPM dependencies out of the box
11-
* File entity resolver (folder/subfolder/file.js becomes `Dips.$.folder.subfolder.file`)
13+
* File entity resolver (folder/sub-folder/file.js becomes `Dips.$.folder.sub-folder.file`)
1214
* Fast (lazy loading support)
1315
* Re-register dependencies
1416
* Supports multiple containers/scopes
@@ -90,7 +92,7 @@ dips.invoke(function($db, callback)
9092
});
9193

9294
// Example II: Invoke function
93-
dips.invoke(function($fs, $path) // $fs and $path registred by the "core" dependencies
95+
dips.invoke(function($fs, $path) // $fs and $path registered by the "core" dependencies
9496
{
9597
$fs.readdirSync($path.resolve(__dirname, '..'));
9698
});
@@ -133,6 +135,7 @@ dips.$('lib.database.connection') // equals: require('./lib/database/connection.
133135
- `prefix ([String=""])` - the optional prefix to use e.g. "core" -> "core\_fs", etc. _(optional)_
134136
- `npm ([Object.<String, *> | *])` - if present (typically with the value of `true`), registers the installed NPM modules (behaves like [module.require](http://nodejs.org/api/modules.html#modules_all_together)) as dependencies _(optional)_
135137
- `prefix ([String=""])` - the optional prefix to use e.g. "npm" -> "npm\_express", etc. _(optional)_
138+
- `ignore ([Array.<String, RegExp>])` - the optional ignores added to the default ignores ".bin" and ".gitignore" _(optional)_
136139
- `...` - the custom dependencies to register, dependency id as key `String` _(optional)_
137140
* `containers ([Object.<String, Container>])` - the dependency containers to register _(optional)_
138141

@@ -184,7 +187,7 @@ _The following methods are inherited from `Container`_
184187

185188
* `setDependencies(Object.<String, *> values)` - sets and overrides the given dependencies within the `defaultContainer`
186189

187-
* `addDependencies(Object.<String, *> values)` - addes the given dependencies within the `defaultContainer`
190+
* `addDependencies(Object.<String, *> values)` - adds the given dependencies within the `defaultContainer`
188191

189192
* `hasDependency(String id)` - checks if the dependency with the given id does exist within the `defaultContainer`
190193

@@ -251,4 +254,28 @@ dips.invoke({
251254
});
252255
```
253256

254-
__Passing other types (`string`, `number`, `boolean`, `null`, `undefined`) as value for `Dips.invoke` will be returned as they are, without modification.__
257+
__Passing other types (`string`, `number`, `boolean`, `null`, `undefined`) as value for `Dips.invoke` will be returned as they are, without modification.__
258+
259+
## License
260+
261+
[The MIT License (MIT)](http://opensource.org/licenses/MIT)
262+
263+
Copyright (c) 2014 - Christoph Rust
264+
265+
Permission is hereby granted, free of charge, to any person obtaining a copy
266+
of this software and associated documentation files (the "Software"), to deal
267+
in the Software without restriction, including without limitation the rights
268+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
269+
copies of the Software, and to permit persons to whom the Software is
270+
furnished to do so, subject to the following conditions:
271+
272+
The above copyright notice and this permission notice shall be included in
273+
all copies or substantial portions of the Software.
274+
275+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
276+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
277+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
278+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
279+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
280+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
281+
THE SOFTWARE.

dips.js

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
* ################
55
*/
66

7+
/**
8+
* @namespace Dips
9+
*/
10+
711
var entities = {
812

913
file : require('./lib/entity/file.js')
@@ -20,6 +24,7 @@ var entities = {
2024
/**
2125
* The dips class.
2226
*
27+
* @memberOf Dips
2328
* @constructor
2429
* @param {Object} config
2530
*/
@@ -123,7 +128,8 @@ function Dips(config)
123128

124129
// Check npm
125130
if (config.dependencies.hasOwnProperty('npm')) {
126-
this.addDependencies(dependencies.npm.getDependencies(config.dependencies.npm.prefix || undefined));
131+
this.addDependencies(dependencies.npm.getDependencies(config.dependencies.npm.prefix || undefined,
132+
config.dependencies.npm.ignore || undefined));
127133
}
128134

129135
/*
@@ -510,4 +516,31 @@ Dips.prototype.invoke = function (value)
510516
module.exports = function (config)
511517
{
512518
return new Dips(config);
513-
};
519+
};
520+
521+
/**
522+
* The entities.
523+
*
524+
* @memberOf Dips
525+
* @property entities
526+
* @type {Object}
527+
*/
528+
module.exports.entities = entities;
529+
530+
/**
531+
* The dependencies.
532+
*
533+
* @memberOf Dips
534+
* @property dependencies
535+
* @type {Object}
536+
*/
537+
module.exports.dependencies = dependencies;
538+
539+
/**
540+
* The container.
541+
*
542+
* @memberOf Dips
543+
* @property Container
544+
* @type {Container}
545+
*/
546+
module.exports.Container = Container;

docs/Arguments.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,13 +432,13 @@ <h5>Returns:</h5>
432432
</div>
433433

434434
<nav>
435-
<h2><a href="index.html">Index</a></h2><h3>Classes</h3><ul><li><a href="ArgumentsResult.html">ArgumentsResult</a></li><li><a href="Container.html">Container</a></li><li><a href="Dips.html">Dips</a></li></ul><h3>Namespaces</h3><ul><li><a href="Arguments.html">Arguments</a></li><li><a href="Core_Dependencies.html">Core_Dependencies</a></li><li><a href="File_Entities.html">File_Entities</a></li><li><a href="Lazy_Loader.html">Lazy_Loader</a></li><li><a href="NPM_Dependencies.html">NPM_Dependencies</a></li></ul>
435+
<h2><a href="index.html">Index</a></h2><h3>Classes</h3><ul><li><a href="ArgumentsResult.html">ArgumentsResult</a></li><li><a href="Container.html">Container</a></li><li><a href="Dips.Dips.html">Dips</a></li></ul><h3>Namespaces</h3><ul><li><a href="Arguments.html">Arguments</a></li><li><a href="Core_Dependencies.html">Core_Dependencies</a></li><li><a href="Dips.html">Dips</a></li><li><a href="File_Entities.html">File_Entities</a></li><li><a href="Lazy_Loader.html">Lazy_Loader</a></li><li><a href="NPM_Dependencies.html">NPM_Dependencies</a></li></ul>
436436
</nav>
437437

438438
<br clear="both">
439439

440440
<footer>
441-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha3</a> on Sun Jan 19 2014 14:54:00 GMT+0100 (CET)
441+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha3</a> on Wed Jan 22 2014 14:48:11 GMT+0000 (GMT)
442442
</footer>
443443

444444
<script> prettyPrint(); </script>

docs/ArgumentsResult.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,13 +1123,13 @@ <h5>Returns:</h5>
11231123
</div>
11241124

11251125
<nav>
1126-
<h2><a href="index.html">Index</a></h2><h3>Classes</h3><ul><li><a href="ArgumentsResult.html">ArgumentsResult</a></li><li><a href="Container.html">Container</a></li><li><a href="Dips.html">Dips</a></li></ul><h3>Namespaces</h3><ul><li><a href="Arguments.html">Arguments</a></li><li><a href="Core_Dependencies.html">Core_Dependencies</a></li><li><a href="File_Entities.html">File_Entities</a></li><li><a href="Lazy_Loader.html">Lazy_Loader</a></li><li><a href="NPM_Dependencies.html">NPM_Dependencies</a></li></ul>
1126+
<h2><a href="index.html">Index</a></h2><h3>Classes</h3><ul><li><a href="ArgumentsResult.html">ArgumentsResult</a></li><li><a href="Container.html">Container</a></li><li><a href="Dips.Dips.html">Dips</a></li></ul><h3>Namespaces</h3><ul><li><a href="Arguments.html">Arguments</a></li><li><a href="Core_Dependencies.html">Core_Dependencies</a></li><li><a href="Dips.html">Dips</a></li><li><a href="File_Entities.html">File_Entities</a></li><li><a href="Lazy_Loader.html">Lazy_Loader</a></li><li><a href="NPM_Dependencies.html">NPM_Dependencies</a></li></ul>
11271127
</nav>
11281128

11291129
<br clear="both">
11301130

11311131
<footer>
1132-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha3</a> on Sun Jan 19 2014 14:54:00 GMT+0100 (CET)
1132+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha3</a> on Wed Jan 22 2014 14:48:11 GMT+0000 (GMT)
11331133
</footer>
11341134

11351135
<script> prettyPrint(); </script>

docs/Container.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,13 +1264,13 @@ <h5>Returns:</h5>
12641264
</div>
12651265

12661266
<nav>
1267-
<h2><a href="index.html">Index</a></h2><h3>Classes</h3><ul><li><a href="ArgumentsResult.html">ArgumentsResult</a></li><li><a href="Container.html">Container</a></li><li><a href="Dips.html">Dips</a></li></ul><h3>Namespaces</h3><ul><li><a href="Arguments.html">Arguments</a></li><li><a href="Core_Dependencies.html">Core_Dependencies</a></li><li><a href="File_Entities.html">File_Entities</a></li><li><a href="Lazy_Loader.html">Lazy_Loader</a></li><li><a href="NPM_Dependencies.html">NPM_Dependencies</a></li></ul>
1267+
<h2><a href="index.html">Index</a></h2><h3>Classes</h3><ul><li><a href="ArgumentsResult.html">ArgumentsResult</a></li><li><a href="Container.html">Container</a></li><li><a href="Dips.Dips.html">Dips</a></li></ul><h3>Namespaces</h3><ul><li><a href="Arguments.html">Arguments</a></li><li><a href="Core_Dependencies.html">Core_Dependencies</a></li><li><a href="Dips.html">Dips</a></li><li><a href="File_Entities.html">File_Entities</a></li><li><a href="Lazy_Loader.html">Lazy_Loader</a></li><li><a href="NPM_Dependencies.html">NPM_Dependencies</a></li></ul>
12681268
</nav>
12691269

12701270
<br clear="both">
12711271

12721272
<footer>
1273-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha3</a> on Sun Jan 19 2014 14:54:00 GMT+0100 (CET)
1273+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha3</a> on Wed Jan 22 2014 14:48:11 GMT+0000 (GMT)
12741274
</footer>
12751275

12761276
<script> prettyPrint(); </script>

docs/Core_Dependencies.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,13 +381,13 @@ <h5>Returns:</h5>
381381
</div>
382382

383383
<nav>
384-
<h2><a href="index.html">Index</a></h2><h3>Classes</h3><ul><li><a href="ArgumentsResult.html">ArgumentsResult</a></li><li><a href="Container.html">Container</a></li><li><a href="Dips.html">Dips</a></li></ul><h3>Namespaces</h3><ul><li><a href="Arguments.html">Arguments</a></li><li><a href="Core_Dependencies.html">Core_Dependencies</a></li><li><a href="File_Entities.html">File_Entities</a></li><li><a href="Lazy_Loader.html">Lazy_Loader</a></li><li><a href="NPM_Dependencies.html">NPM_Dependencies</a></li></ul>
384+
<h2><a href="index.html">Index</a></h2><h3>Classes</h3><ul><li><a href="ArgumentsResult.html">ArgumentsResult</a></li><li><a href="Container.html">Container</a></li><li><a href="Dips.Dips.html">Dips</a></li></ul><h3>Namespaces</h3><ul><li><a href="Arguments.html">Arguments</a></li><li><a href="Core_Dependencies.html">Core_Dependencies</a></li><li><a href="Dips.html">Dips</a></li><li><a href="File_Entities.html">File_Entities</a></li><li><a href="Lazy_Loader.html">Lazy_Loader</a></li><li><a href="NPM_Dependencies.html">NPM_Dependencies</a></li></ul>
385385
</nav>
386386

387387
<br clear="both">
388388

389389
<footer>
390-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha3</a> on Sun Jan 19 2014 14:54:00 GMT+0100 (CET)
390+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha3</a> on Wed Jan 22 2014 14:48:11 GMT+0000 (GMT)
391391
</footer>
392392

393393
<script> prettyPrint(); </script>

0 commit comments

Comments
 (0)