Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Cleaned up version

  • Loading branch information...
commit f0f1bb040570d2a4d01f9ed282d8adff288be4ce 1 parent e1c13b4
Sergio Lepore authored
Showing with 4 additions and 49 deletions.
  1. +2 −3 .travis.yml
  2. +2 −2 changelog.md
  3. +0 −44 lib/cation.js~
5 .travis.yml
View
@@ -6,6 +6,5 @@ branches:
only:
- master
-notifications:
- email:
- - slepore@moobin.net
+#notifications:
+# email: false
4 changelog.md
View
@@ -4,14 +4,14 @@ Features:
- Full dependency injection container.
- Service schemas can be setted via constructor or setters, in JSON format.
- - Common parameters, shared between all services hosted on the container.
+ - Support for common parameters, shared between all services hosted on the container.
- Service definitions can be references loaded inside the container.
- Triggers to execute service methods, useful for setter injection or quick configuration.
- And again, all of this features can be handled on a simple json schema.
Documentation:
- - Added for dependency injection.
+ - Added docs and refereces for dependency injection.
## 0.2.1 (Oct 08, 2012)
44 lib/cation.js~
View
@@ -1,44 +0,0 @@
-var cation = module.exports = function(dir_aliases, modules) {
- cation.load_dirs = dir_aliases;
- cation.module_schema = modules;
- cation.module_store = {};
-
- return cation;
-};
-
-cation.load = function(name) {
- if (this.module_schema.hasOwnProperty(name)) {
- var module_path = this.module_schema[name];
- module_path = (module_path.search(':') !== -1) ? replaceParameters(module_path, this.load_dirs) : module_path;
-
- this.module_store[name] = require(module_path);
- }
-};
-
-cation.get = function(name) {
- if (!this.module_store.hasOwnProperty(name)) {
- this.load(name);
- }
-
- return this.module_store[name];
-};
-
-cation.add = function(modules) {
- for (var module_alias in modules) {
- this.module_schema[module_alias] = modules[module_alias];
- }
-};
-
-function replaceParameters(search, replacements) {
- var found_params = search.match(/:([A-za-z0-9]+)/gi),
- purged_search = search;
-
- for (var i=0; i < found_params.length; i++) {
- var clean_param_name = found_params[i].replace(':',''),
- replacement_value = replacements[clean_param_name];
-
- purged_search = purged_search.replace(found_params[i], replacement_value);
- }
-
- return purged_search;
-}
Please sign in to comment.
Something went wrong with that request. Please try again.