Skip to content

Commit

Permalink
Plain vanilla Kraken Application
Browse files Browse the repository at this point in the history
  • Loading branch information
lmarkus committed Nov 22, 2013
0 parents commit 281da0b
Show file tree
Hide file tree
Showing 22 changed files with 531 additions and 0 deletions.
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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.DS_Store
.idea/
.build/
node_modules/
*.iml
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
91 changes: 91 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
'use strict';


module.exports = function (grunt) {

grunt.initConfig({
jshint: {
files: ['controllers/**/*.js', 'lib/**/*.js', 'models/**/*.js'],
options: {
jshintrc: '.jshintrc'
}
},
requirejs: {
compile: {
options: {
baseUrl: 'public/js',
mainConfigFile: 'public/js/config.js',
dir: '.build/js',
optimize: 'uglify',
modules: [{name: 'app'}]
}
}
},
less: {
compile: {
options: {
yuicompress: true,
paths: ['public/css']
},
files: {
'.build/css/app.css': 'public/css/app.less'
}
}
},
makara: {
files: ['public/templates/**/*.dust'],
options: {
contentPath: ['locales/**/*.properties']
}
},
dustjs: {
compile: {
files: [
{
expand: true,
cwd: 'tmp/',
src: '**/*.dust',
dest: '.build/templates',
ext: '.js'
}
],
options: {
fullname: function (filepath) {
var path = require('path'),
name = path.basename(filepath, '.dust'),
parts = filepath.split(path.sep),
fullname = parts.slice(3, -1).concat(name);

return fullname.join(path.sep);
}
}
}
},
clean: {
'tmp': 'tmp',
'build': '.build/templates'
},
mochatest: {
src: ['test/*.js'],
options: {
globals: ['chai'],
timeout: 6000,
ignoreLeaks: false,
ui: 'bdd',
reporter: 'spec'
}
}
});

//grunt.loadNpmTasks('grunt-ci-suite');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-dustjs');
grunt.loadTasks('./node_modules/makara/tasks/');

grunt.registerTask('i18n', ['clean', 'makara', 'dustjs', 'clean:tmp']);
grunt.registerTask('build', ['jshint', 'less', 'requirejs', 'i18n']);
grunt.registerTask('test', ['jshint', 'mochatest']);

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

A sample application to show the localization features of Kraken

## Relevant code



5 changes: 5 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "kraken-localization",
"version": "0.0.1",
"dependencies": {}
}
47 changes: 47 additions & 0 deletions config/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
// Uncomment and change as needed (Be careful not to leave trailing commas!)

// "port": 8000,
//
// "host": "localhost",
//
// "i18n": {
// "fallback": "en-US",
// "contentPath": "path:./locales"
// },
//
// "routes": {
// "routePath": "path:./controllers"
// },
//
// "view engines": {
// "js": {
// "module": "adaro",
// "settings": {
// "helpers": null,
// "stream": false
// }
// },
//
// "dust": {
// "module": "adaro",
// "settings": {
// "helpers": null,
// "stream": false
// }
// }
// },
// "express": {
// "x-powered-by": false,
// "trust proxy": false,
// "jsonp callback name": null,
// "json replacer": null,
// "json spaces": 0,
// "case sensitive routing": false,
// "strict routing": false,
// "view cache": true,
// "view engine": "js",
// "views": "path:./.build/templates"
// }

}
8 changes: 8 additions & 0 deletions config/middleware.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"middleware": {
"session": {
"module": "memory",
"secret": "5aca7480816d1241737e3a1ad016d79756a363fd"
}
}
}
13 changes: 13 additions & 0 deletions controllers/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
'use strict';


module.exports = function (server) {

server.get('/', function (req, res) {
var model = { name: 'kraken-localization' };

res.render('index', model);

});

};
33 changes: 33 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
'use strict';


var kraken = require('kraken-js'),
app = {};


app.configure = function configure(nconf, next) {
// Fired when an app configures itself
next(null);
};


app.requestStart = function requestStart(server) {
// Fired at the beginning of an incoming request
};


app.requestBeforeRoute = function requestBeforeRoute(server) {
// Fired before routing occurs
};


app.requestAfterRoute = function requestAfterRoute(server) {
// Fired after routing occurs
};


kraken.create(app).listen(function (err) {
if (err) {
console.error(err);
}
});
1 change: 1 addition & 0 deletions locales/US/en/index.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
index.greeting=Hello, {name}!
Empty file added models/index.js
Empty file.
Loading

0 comments on commit 281da0b

Please sign in to comment.