Skip to content

Commit

Permalink
Merge branch 'release/v0.1.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
nicosommi committed Aug 10, 2015
2 parents f3d7a1b + ae7955e commit f7e2eed
Show file tree
Hide file tree
Showing 18 changed files with 136 additions and 294 deletions.
5 changes: 5 additions & 0 deletions .bithoundrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"ignore": [
"es5/**/*.js"
]
}
9 changes: 2 additions & 7 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
# Save as .codeclimate.yml (note leading .) in project root directory
languages:
JavaScript: true
Ruby: false
PHP: false
Python: false

# exclude_paths:
# - "foo/bar.rb"
exclude_paths:
- es5/*
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ build/Release
# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules

# lcov file
lcov.info
22 changes: 2 additions & 20 deletions .karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,31 +58,13 @@ let configOptions = {

// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false
singleRun: true
};

/**
* Special Options For SauceLabs
*/
if (process.env.SAUCE_USERNAME) {
/**
* If SauceLabs credentials are available,
* set up the tests to run through them.
*/
configOptions.sauceLabs = {
testName: "Forbin.js"
};
const customLaunchers = require("./.sauce.json").platforms;
configOptions.customLaunchers = customLaunchers;
configOptions.browsers = Object.keys(customLaunchers);
reporters.push("saucelabs");
} else {
/**
* If there are no SauceLabs credentials available,
* detect the browsers that we *can* use.
*/
frameworks.push("detectBrowsers");
}
frameworks.push("detectBrowsers");

module.exports = function(config) {
// level of logging
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015 Free All Media LLC
Copyright (c) 2015 Free All Media, LLC

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
52 changes: 25 additions & 27 deletions es5/lib/forbin.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ var setupFilters = Symbol("setupFilters"),
processFilters = Symbol("processFilters"),
processBeforeFilters = Symbol("processBeforeFilters"),
processAfterFilters = Symbol("processAfterFilters"),
actions = Symbol("actions"),
addFilter = Symbol("addFilter");
addFilter = Symbol("addFilter"),
getFilters = Symbol("getFilters");

/**
* Request/Response controller with filters.
Expand Down Expand Up @@ -144,9 +144,10 @@ var Controller = (function () {
options[_key5 - 1] = arguments[_key5];
}

var filter = null;
switch (options.length) {
case 1:
var filter = options[0];
filter = options[0];
// Filter to run before all actions, no skip available
this.actionNames.forEach(function (actionName) {
owner.push({
Expand All @@ -157,25 +158,23 @@ var Controller = (function () {
break;
case 2:
if (Array.isArray(options[0])) {
(function () {
// A. Filter to run before all actions, with skip available
var actionArray = options[0],
filter = options[1];
actionArray.forEach(function (action) {
owner.push({
action: action,
filter: filter
});
}, _this2);
})();
// A. Filter to run before all actions, with skip available
var actionArray = options[0];
filter = options[1];
actionArray.forEach(function (action) {
owner.push({
action: action,
filter: filter
});
}, this);
} else {
// B. Filter to run before a specific action, no skip available
var action = options[0],
_filter = options[1];
var action = options[0];
filter = options[1];

owner.push({
action: action,
filter: _filter
filter: filter
});
}
break;
Expand Down Expand Up @@ -248,24 +247,23 @@ var Controller = (function () {
});
}
}, {
key: processBeforeFilters,
value: function (action, request, response, callback) {
key: getFilters,
value: function (action, filterObject) {
var _this4 = this;

var applicableFilters = this._filters.before.filter(function (filter) {
return filterObject.filter(function (filter) {
return filter.action === _this4[action];
});
this[processFilters](applicableFilters, request, response, callback);
}
}, {
key: processBeforeFilters,
value: function (action, request, response, callback) {
this[processFilters](this[getFilters](action, this._filters.before), request, response, callback);
}
}, {
key: processAfterFilters,
value: function (action, request, response, callback) {
var _this5 = this;

var applicableFilters = this._filters.after.filter(function (filter) {
return filter.action === _this5[action];
});
this[processFilters](applicableFilters, request, response, callback);
this[processFilters](this[getFilters](action, this._filters.after), request, response, callback);
}
}, {
key: actionNames,
Expand Down
29 changes: 15 additions & 14 deletions es6/lib/forbin.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const setupFilters = Symbol("setupFilters"),
processFilters = Symbol("processFilters"),
processBeforeFilters = Symbol("processBeforeFilters"),
processAfterFilters = Symbol("processAfterFilters"),
actions = Symbol("actions"),
addFilter = Symbol("addFilter");
addFilter = Symbol("addFilter"),
getFilters = Symbol("getFilters");

/**
* Request/Response controller with filters.
Expand Down Expand Up @@ -93,9 +93,10 @@ export default class Controller {

/* Private Methods */
[addFilter](owner, ...options) {
let filter = null;
switch(options.length) {
case 1:
const filter = options[0];
filter = options[0];
// Filter to run before all actions, no skip available
this.actionNames.forEach((actionName) => {
owner.push({
Expand All @@ -107,8 +108,8 @@ export default class Controller {
case 2:
if (Array.isArray(options[0])) {
// A. Filter to run before all actions, with skip available
const actionArray = options[0],
filter = options[1];
const actionArray = options[0];
filter = options[1];
actionArray.forEach((action) => {
owner.push({
action: action,
Expand All @@ -117,8 +118,8 @@ export default class Controller {
}, this);
} else {
// B. Filter to run before a specific action, no skip available
const action = options[0],
filter = options[1];
const action = options[0];
filter = options[1];

owner.push({
action: action,
Expand Down Expand Up @@ -210,18 +211,18 @@ export default class Controller {
);
}

[processBeforeFilters](action, request, response, callback) {
const applicableFilters = this._filters.before.filter((filter) => {
[getFilters](action, filterObject) {
return filterObject.filter((filter) => {
return (filter.action === this[action]);
});
this[processFilters](applicableFilters, request, response, callback);
}

[processBeforeFilters](action, request, response, callback) {
this[processFilters](this[getFilters](action, this._filters.before), request, response, callback);
}

[processAfterFilters](action, request, response, callback) {
const applicableFilters = this._filters.after.filter((filter) => {
return (filter.action === this[action]);
});
this[processFilters](applicableFilters, request, response, callback);
this[processFilters](this[getFilters](action, this._filters.after), request, response, callback);
}

[actionNames]() {
Expand Down
4 changes: 4 additions & 0 deletions gulpfile.babel.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import "./tasks/suppress-errors.js";
import "./tasks/build-spec.js";
import "./tasks/build-spec-assets.js";
import "./tasks/build-lib.js";
import "./tasks/build-lib-assets.js";
import "./tasks/build.js";
import "./tasks/test-local.js";
import "./tasks/test-browsers.js";
import "./tasks/test.js";
import "./tasks/test-watch.js";
Loading

0 comments on commit f7e2eed

Please sign in to comment.