Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
lmarkus committed May 19, 2015
0 parents commit 328c275
Show file tree
Hide file tree
Showing 7,892 changed files with 1,544,611 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 4 additions & 0 deletions .bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"directory": "public/components",
"json": "bower.json"
}
Binary file added .build/favicon.ico
Binary file not shown.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# http://editorconfig.org
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
3 changes: 3 additions & 0 deletions .jshintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.build
node_modules
public/js
155 changes: 155 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
{
// Whether the scan should stop on first error.
"passfail": false,
// Maximum errors before stopping.
"maxerr": 100,


// Predefined globals

// Whether the standard browser globals should be predefined.
"browser": false,
// Whether the Node.js environment globals should be predefined.
"node": true,
// Whether the Rhino environment globals should be predefined.
"rhino": false,
// Whether CouchDB globals should be predefined.
"couch": false,
// Whether the Windows Scripting Host environment globals should be predefined.
"wsh": false,

// Whether jQuery globals should be predefined.
"jquery": false,
// Whether Prototype and Scriptaculous globals should be predefined.
"prototypejs": false,
// Whether MooTools globals should be predefined.
"mootools": false,
// Whether Dojo Toolkit globals should be predefined.
"dojo": false,

// Custom predefined globals.
"predef": [],

// Development

// Whether debugger statements should be allowed.
"debug": false,
// Whether logging globals should be predefined (console, alert, etc.).
"devel": false,


// ECMAScript 5

// Whether the "use strict"; pragma should be required.
"strict": true,
// Whether global "use strict"; should be allowed (also enables strict).
"globalstrict": true,


// The Good Parts

// Whether automatic semicolon insertion should be allowed.
"asi": false,
// Whether line breaks should not be checked, e.g. `return [\n] x`.
"laxbreak": false,
// Whether bitwise operators (&, |, ^, etc.) should be forbidden.
"bitwise": false,
// Whether assignments inside `if`, `for` and `while` should be allowed. Usually
// conditions and loops are for comparison, not assignments.
"boss": true,
// Whether curly braces around all blocks should be required.
"curly": true,
// Whether `===` and `!==` should be required (instead of `==` and `!=`).
"eqeqeq": true,
// Whether `== null` comparisons should be allowed, even if `eqeqeq` is `true`.
"eqnull": false,
// Whether `eval` should be allowed.
"evil": false,
// Whether ExpressionStatement should be allowed as Programs.
"expr": true,
// Whether `for in` loops must filter with `hasOwnPrototype`.
"forin": false,
// Whether immediate invocations must be wrapped in parens, e.g.
// `( function(){}() );`.
"immed": true,
// Whether use before define should be forbidden.
"latedef": false,
// Whether functions should be allowed to be defined within loops.
"loopfunc": false,
// Whether arguments.caller and arguments.callee should be forbidden.
"noarg": false,
// Whether `.` should be forbidden in regexp literals.
"regexp": false,
// Whether unescaped first/last dash (-) inside brackets in regexps should be allowed.
"regexdash": false,
// Whether script-targeted URLs should be allowed.
"scripturl": false,
// Whether variable shadowing should be allowed.
"shadow": false,
// Whether `new function () { ... };` and `new Object;` should be allowed.
"supernew": false,
// Whether variables must be declared before used.
"undef": true,
// Whether `this` inside a non-constructor function should be allowed.
"validthis": false,
// Whether smarttabs should be allowed
// (http://www.emacswiki.org/emacs/SmartTabs).
"smarttabs": true,
// Whether the `__proto__` property should be allowed.
"proto": false,
// Whether one-case switch statements should be allowed.
"onecase": false,
// Whether non-standard (but widely adopted) globals should be predefined.
"nonstandard": false,
// Allow multiline strings.
"multistr": false,
// Whether line breaks should not be checked around commas.
"laxcomma": false,
// Whether semicolons may be ommitted for the trailing statements inside of a
// one-line blocks.
"lastsemic": false,
// Whether the `__iterator__` property should be allowed.
"iterator": false,
// Whether only function scope should be used for scope tests.
"funcscope": false,
// Whether es.next specific syntax should be allowed.
"esnext": false,


// Style preferences

// Whether constructor names must be capitalized.
"newcap": false,
// Whether empty blocks should be forbidden.
"noempty": false,
// Whether using `new` for side-effects should be forbidden.
"nonew": false,
// Whether names should be checked for leading or trailing underscores
// (object._attribute would be forbidden).
"nomen": false,
// Whether only one var statement per function should be allowed.
"onevar": false,
// Whether increment and decrement (`++` and `--`) should be forbidden.
"plusplus": false,
// Whether all forms of subscript notation are allowed.
"sub": false,
// Whether trailing whitespace rules apply.
"trailing": false,
// Specify indentation.
"indent": 4,
// Whether strict whitespace rules apply.
"white": false,
// Quote formatting
"quotmark": true,

// Complexity

// Maximum number of function parameters.
"maxparams": 5,
// Maximum block nesting depth.
"maxdepth": 3,
// Maximum number of statements per function.
"maxstatements": 25,
// Maximum cyclomatic complexity.
"maxcomplexity": 6
}
5 changes: 5 additions & 0 deletions .nodemonignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/.build/* # Build folder
/public/* # ignore all public resources
/.* # any hidden (dot) files
*.md # Markdown files
*.css # CSS files
5 changes: 5 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.DS_Store
.idea/
.build/
node_modules/
*.iml
15 changes: 15 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
'use strict';


module.exports = function (grunt) {

// Load the project's grunt tasks from a directory
require('grunt-config-dir')(grunt, {
configDir: require('path').resolve('tasks')
});

// Register group tasks
grunt.registerTask('build', [ 'jshint', 'less', 'requirejs', 'i18n', 'copyto' ]);
grunt.registerTask('test', [ 'jshint', 'mochacli' ]);

};
59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# middlewarePOC

POC for meddleware issue


Under Kraken 1.x, the composed middleware construct `enabled` flags are respected.

This POC has the following config fragment:

```javascript
,"poc":{
"parallel":{
"middleware1":{
"enabled":true,
"module":"path:./lib/middleware1"
},
"middleware2":{
"enabled":false,
"module":"path:./lib/middleware2"
}
}
}
```

These middewares only set a flag in the request object.

`req.mw1 = true;` and `req.mw2 = true;`


And a single route to test their behavior:
```javascript
router.get('/', function (req, res) {
assert(req.mw1);
assert(req.mw2);
res.sendStatus(200);
});
```

Running this POC (`curl localhost:8000`) produces:



### Under Meddleware 1.0 (Default included with Kraken 1.x)

```javascript
Middleware 1 says hi
::ffff:127.0.0.1 - - [19/May/2015:16:06:23 +0000] "GET / HTTP/1.1" 500 395 "-" "curl/7.37.1"
```
Expected to fail.

### Under Meddleware 3.0 (Default included with Kraken 2.x)
Updated Kraken to `2.0.0-rc.1`

```javascript
Middleware 1 says hi
Middleware 2 says hi, *from beyond the grave...*
::ffff:127.0.0.1 - - [19/May/2015:16:07:49 +0000] "GET / HTTP/1.1" 200 2 "-" "curl/7.37.1"
```
Unexpected success... Middleware 2 should be disabled.
92 changes: 92 additions & 0 deletions config/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{

"express": {
"view cache": false,
"view engine": "js",
"views": "path:./.build/templates"
},

"view engines": {
"js": {
"module": "engine-munger",
"renderer": {
"method": "js",
"arguments": [
{ "cache": true },
{
"views": "config:express.views",
"view engine": "config:express.view engine",
"specialization": "config:specialization",
"i18n": "config:i18n"
}
]
}
}
},


"i18n": {
"contentPath": "path:./locales",
"fallback": "en-US"
},



"middleware": {

"static": {
"module": {
"arguments": [ "path:./.build" ]
}
}

,"router": {
"module": {
"arguments": [{ "directory": "path:./controllers" }]
}
}


,"expressView": {
"priority": 100,
"enabled": true,
"module": {
"name": "engine-munger/lib/expressView"
}
}

,"poc":{
"parallel":{
"middleware1":{
"enabled":true,
"module":"path:./lib/middleware1"
},
"middleware2":{
"enabled":false,
"module":"path:./lib/middleware2"
}
}
}


,"fileNotFound": {
"enabled": true,
"priority": 130,
"module": {
"name": "kraken-js/middleware/404",
"arguments": [ "errors/404" ]
}
}

,"serverError": {
"enabled": true,
"priority": 140,
"module": {
"name": "kraken-js/middleware/500",
"arguments": [ "errors/500" ]
}
}


}
}
Loading

0 comments on commit 328c275

Please sign in to comment.