Skip to content

Commit

Permalink
Initial commit of module base.
Browse files Browse the repository at this point in the history
  • Loading branch information
5orenso committed Jun 18, 2016
0 parents commit 3666c48
Show file tree
Hide file tree
Showing 22 changed files with 819 additions and 0 deletions.
1 change: 1 addition & 0 deletions .coveralls-dist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
repo_token: <your coveralls.io token>
37 changes: 37 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
.coveralls.yml

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# Commenting this out is preferred by some people, see
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
node_modules

# Users Environment Variables
.lock-wscript

# Skip idea files
.idea

dev/
config/config.js
artifact/
.DS_Store
118 changes: 118 additions & 0 deletions .jscsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
{
"requireCurlyBraces": [
"if",
"else",
"for",
"while",
"do"
],
"requireSpaceAfterKeywords": [
"if",
"else",
"for",
"while",
"do",
"switch",
"return",
"catch"
],
"requireSpacesInFunctionExpression": {
"beforeOpeningCurlyBrace": true
},
// "disallowSpacesInFunctionExpression": {
// "beforeOpeningRoundBrace": true
// },
"disallowKeywords": [
"with"
],
"disallowKeywordsOnNewLine": [
"else",
"catch"
],

"disallowSpaceAfterPrefixUnaryOperators": true,
"disallowSpaceBeforePostfixUnaryOperators": [
"++",
"--"
],
"requireSpaceBeforeBinaryOperators": true,
"requireSpaceAfterBinaryOperators": true,

"disallowSpacesInsideParentheses": true,
"disallowEmptyBlocks": true,

"requireParenthesesAroundIIFE": true,
"requireSpacesInFunctionDeclaration": {
"beforeOpeningCurlyBrace": true
},
"disallowSpacesInFunctionDeclaration": {
"beforeOpeningRoundBrace": true
},
"requireSpacesInAnonymousFunctionExpression": {
"beforeOpeningCurlyBrace": true
},
"disallowSpacesInNamedFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"requireSpacesInNamedFunctionExpression": {
"beforeOpeningCurlyBrace": true
},

"requireSpacesInConditionalExpression": {
"afterTest": true,
"beforeConsequent": true,
"afterConsequent": true,
"beforeAlternate": true
},

"disallowSpaceBeforeBinaryOperators": [
","
],
"requireCommaBeforeLineBreak": true,

"validateQuoteMarks": {
"escape": true,
"mark": "'"
},
"disallowMultipleLineStrings": true,

"disallowImplicitTypeConversion": [
"numeric",
"boolean",
"binary",
"string"
],
"disallowYodaConditions": true,

"disallowSpacesInsideArrayBrackets": true,

"requireDotNotation": true,
"disallowSpaceAfterObjectKeys": true,
"disallowQuotedKeysInObjects": "allButReserved",

"jsDoc": {
"checkParamNames": true,
"requireParamTypes": true
},

"maximumLineLength": {
"value": 120,
"allowUrlComments": true
},
// "requireSpaceAfterLineComment": true,
"requireLineFeedAtFileEnd": true,
"disallowMultipleLineBreaks": true,
"disallowMixedSpacesAndTabs": true,
"disallowTrailingWhitespace": true,
"validateLineBreaks": "LF",

"disallowTrailingComma": true,
// "requireMultipleVarDecl": true,
// "requireSpacesInsideObjectBrackets": "all",
// "requireSpacesInsideArrayBrackets": "all",

"requireCamelCaseOrUpperCaseIdentifiers": true,
// "requireCapitalizedConstructors": true,

"excludeFiles": ["node_modules/**"]
}
48 changes: 48 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// http://www.jshint.com/docs/options/
{
// This option prohibits the use of bitwise operators such as ^ (XOR), | (OR) and others. Bitwise operators are very rare in JavaScript programs and quite often & is simply a mistyped &&.
"bitwise": true,
// "camelcase": false,
// This option requires you to always put curly braces around blocks in loops and conditionals. JavaScript allows you to omit curly braces when the block consists of only one statement.
"curly": true,
// This options prohibits the use of == and != in favor of === and !==. The former try to coerce values before comparing them which can lead to some unexpected results. The latter don't do any coercion so they are generally safer.
"eqeqeq": true,
// This option enables syntax first defined in the ECMAScript 5.1 specification. This includes allowing reserved keywords as object properties.
// "es5": true,
// This options prohibits overwriting prototypes of native objects such as Array, Date and so on.
"freeze": true,
// This option enables warnings about the use of identifiers which are defined in future versions of JavaScript. Although overwriting them has no effect in contexts where they are not implemented, this practice can cause issues when migrating codebases to newer versions of the language.
"futurehostile": true,
// This option requires all for in loops to filter object's items. The for in statement allows for looping through the names of all of the properties of an object including those inherited through the prototype chain. This behavior can lead to unexpected items in your object so it is generally safer to always filter inherited properties out.
"forin": true,
// This option prohibits the use of a variable before it was defined. JavaScript has function scope only and, in addition to that, all variables are always moved—or hoisted— to the top of the function.
"latedef": "nofunc",
// This option lets you control how nested do you want your blocks to be.
"maxdepth": 5,
// This option lets you set the max number of formal parameters allowed per function.
"maxparams": 5,
// This option lets you set the max number of statements allowed per function.
// "maxstatements": 5,
// This option prohibits the use of arguments.caller and arguments.callee. Both .caller and .callee make quite a few optimizations impossible so they were deprecated in future versions of JavaScript. In fact, ECMAScript 5 forbids the use of arguments.callee in strict mode.
"noarg": true,
// This option prohibits the use of constructor functions for side-effects. Some people like to call constructor functions without assigning its result to any variable.
"nonew": true,
// This option prohibits the use of the comma operator. When misused, the comma operator can obscure the value of a statement and promote incorrect code.
"nocomma": true,
// This option warns about "non-breaking whitespace" characters. These characters can be entered with option-space on Mac computers and have a potential of breaking non-UTF8 web pages.
"nonbsp": true,
// This option requires all functions to run in ECMAScript 5's strict mode. Strict mode is a way to opt in to a restricted variant of JavaScript. Strict mode eliminates some JavaScript pitfalls that didn't cause errors by changing them to produce errors. It also fixes mistakes that made it difficult for the JavaScript engines to perform certain optimizations.
"strict": true,
// This option prohibits the use of explicitly undeclared variables. This option is very useful for spotting leaking and mistyped variables.
"undef": true,
// This option warns when you define and never use your variables. It is very useful for general code cleanup, especially when used in addition to undef.
"unused": true,
// This option suppresses warnings about the use of assignments in cases where comparisons are expected. More often than not, code like if (a = 10) {} is a typo.
"boss": true,
// This option suppresses warnings about == null comparisons. Such comparisons are often useful when you want to check if a variable is null or undefined.
"eqnull": true,
// This option tells JSHint that your code uses ECMAScript 6 specific syntax. Note that these features are not finalized yet and not all browsers implement them.
"esnext": true,
// This option defines globals available when your code is running inside of the Node runtime environment. Node.js is a server-side JavaScript environment that uses an asynchronous event-driven model.
"node": true
}
16 changes: 16 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
language: node_js
node_js:
- '4.3'
- '5.11'
- '6.2'
matrix:
# allow_failures:
# - node_js: "4.3"
fast_finish: true
before_install: npm install -g grunt-cli
install:
- npm install
- npm install -g npm
notifications:
email:
on_failure: always
117 changes: 117 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
/*
* https://github.com/5orenso
*
* Copyright (c) 2016 Øistein Sørensen
* Licensed under the MIT license.
*/
'use strict';

module.exports = function (grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),

jshint: {
options: {
jshintrc: '.jshintrc'
},
gruntfile: {
src: 'Gruntfile.js'
},
lib: {
src: ['app/**/*.js', 'lib/**/*.js']
},
test: {
src: ['test/**/*.js']
}
},

jscs: {
main: ['app/**/*.js', 'lib/**/*.js', 'test/**/*.js'],
options: {
config: ".jscsrc"
}
},

watch: {
all: {
files: ['app/**/*.js', 'lib/**/*.js', 'test/**/*.js', 'config/*.js'],
tasks: ['lint', 'buster:unit']
}
},

buster: {
unit: {
}
},

nodemon: {
dev: {
options: {
file: 'app/app.js',
args: ['-c', 'config/config-dist.js']
},
tasks: ['lint', 'buster:unit']
}
},

shell: {
getLatestTag: {
command: 'git describe --abbrev=0 --tags',
options: {
callback: function (err, stdout, stderr, cb) {
stdout = stdout.trim();
// If we have a leading 'v' in the version, remove it
if (stdout.substring(0, 1) === 'v') {
stdout = stdout.substring(1);
}
console.log('Latest tag: ' + stdout);
grunt.config.set('latestTag', stdout);
console.log('s3cmd put artifact/' + stdout + '.tar.gz s3://geo-lib-releases/');
console.log('');
console.log('PS! Remember to upload a corresponding config tar-ball to s3://geo-lib-<purpose>-configs');
cb();
}
}
},
multiple: {
command: [
'mkdir -p artifact',
'mv ./node_modules ./node_modules2',
'npm install --production',
'tar --exclude "./.git*" --exclude "./node_modules2" --exclude "./test*" --exclude "./coverage" --exclude "./artifact" --exclude "./app/config/config*" --exclude "./.idea" --exclude "./dev" -zcf artifact/<%= latestTag %>.tar.gz .',
'rm -rf node_modules',
'mv ./node_modules2 ./node_modules',
'bash changelog.sh'
].join('&&')
}
},

coveralls: {
real_coverage: {
src: 'coverage/lcov.info'
}
}

});

// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-nodeunit');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-nodemon');
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-buster');
grunt.loadNpmTasks("grunt-jscs");
grunt.loadNpmTasks('grunt-coveralls');

// Default task.
grunt.registerTask( "lint", [ "jshint", "jscs" ] );
grunt.registerTask('default', ['lint', 'buster:unit']);
grunt.registerTask('test', 'buster:unit');
grunt.registerTask('check', ['watch']);
grunt.registerTask('run', ['buster:unit', 'nodemon:dev']);
grunt.registerTask('artifact', ['shell', 'coveralls:real_coverage']);
grunt.registerTask('report', ['coveralls:real_coverage']);

};
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2014 Øistein Sørensen

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Loading

0 comments on commit 3666c48

Please sign in to comment.