Skip to content

Commit 3919af1

Browse files
authored
Merge pull request #1 from EnsembleLab/dev
Dev
2 parents 8583f46 + e3e72fb commit 3919af1

32 files changed

+856
-0
lines changed

.editorconfig

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Unix-style newlines with a newline ending every file
7+
[*]
8+
end_of_line = lf
9+
insert_final_newline = true
10+
11+
# Matches multiple files with brace expansion notation
12+
# Set default charset
13+
[*.{js,py}]
14+
charset = utf-8
15+
indent_style = space
16+
indent_size = 4
17+
18+
# Tab indentation (no size specified)
19+
[Makefile]
20+
indent_style = tab
21+
22+
# Matches the exact files either package.json or .travis.yml
23+
[{package.json,.travis.yml}]
24+
indent_style = space
25+
indent_size = 2

.jshintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/
2+
coverage

.jshintrc

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
{
2+
// -----------------
3+
// --------------------------------------------------------------------
4+
// JSHint Configuration, Strict Edition
5+
// --------------------------------------------------------------------
6+
//
7+
// This is a options template for [JSHint][1], using [JSHint example][2]
8+
// and [Ory Band's example][3] as basis and setting config values to
9+
// be most strict:
10+
//
11+
// * set all enforcing options to true
12+
// * set all relaxing options to false
13+
// * set all environment options to false, except the browser value
14+
// * set all JSLint legacy options to false
15+
//
16+
// [1]: http://www.jshint.com/
17+
// [2]: https://github.com/jshint/node-jshint/blob/master/example/config.json
18+
// [3]: https://github.com/oryband/dotfiles/blob/master/jshintrc
19+
//
20+
// @author http://michael.haschke.biz/
21+
// @license http://unlicense.org/
22+
23+
// == Enforcing Options ===============================================
24+
//
25+
// These options tell JSHint to be more strict towards your code. Use
26+
// them if you want to allow only a safe subset of JavaScript, very
27+
// useful when your codebase is shared with a big number of developers
28+
// with different skill levels.
29+
30+
"bitwise": true, // Prohibit bitwise operators (&, |, ^, etc.).
31+
"curly": true, // Require {} for every new block or scope.
32+
"eqeqeq": true, // Require triple equals i.e. `===`.
33+
"forin": true, // Tolerate `for in` loops without `hasOwnPrototype`.
34+
"immed": true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );`
35+
"latedef": true, // Prohibit variable use before definition.
36+
"newcap": true, // Require capitalization of all constructor functions e.g. `new F()`.
37+
"noarg": true, // Prohibit use of `arguments.caller` and `arguments.callee`.
38+
"noempty": true, // Prohibit use of empty blocks.
39+
"nonew": true, // Prohibit use of constructors for side-effects.
40+
"plusplus": true, // Prohibit use of `++` & `--`.
41+
"regexp": true, // Prohibit `.` and `[^...]` in regular expressions.
42+
"undef": true, // Require all non-global variables be declared before they are used.
43+
"strict": true, // Require `use strict` pragma in every file.
44+
"trailing": true, // Prohibit trailing whitespaces.
45+
46+
// == Relaxing Options ================================================
47+
//
48+
// These options allow you to suppress certain types of warnings. Use
49+
// them only if you are absolutely positive that you know what you are
50+
// doing.
51+
52+
"asi": false, // Tolerate Automatic Semicolon Insertion (no semicolons).
53+
"boss": false, // Tolerate assignments inside if, for & while. Usually conditions & loops are for comparison, not assignments.
54+
"debug": false, // Allow debugger statements e.g. browser breakpoints.
55+
"eqnull": false, // Tolerate use of `== null`.
56+
"es5": false, // Allow EcmaScript 5 syntax.
57+
"esnext": false, // Allow ES.next specific features such as `const` and `let`.
58+
"evil": false, // Tolerate use of `eval`.
59+
"expr": false, // Tolerate `ExpressionStatement` as Programs.
60+
"funcscope": false, // Tolerate declarations of variables inside of control structures while accessing them later from the outside.
61+
"globalstrict": false, // Allow global "use strict" (also enables 'strict').
62+
"iterator": false, // Allow usage of __iterator__ property.
63+
"lastsemic": false, // Tolerat missing semicolons when the it is omitted for the last statement in a one-line block.
64+
"laxbreak": false, // Tolerate unsafe line breaks e.g. `return [\n] x` without semicolons.
65+
"laxcomma": false, // Suppress warnings about comma-first coding style.
66+
"loopfunc": false, // Allow functions to be defined within loops.
67+
"multistr": false, // Tolerate multi-line strings.
68+
"onecase": false, // Tolerate switches with just one case.
69+
"proto": false, // Tolerate __proto__ property. This property is deprecated.
70+
"regexdash": false, // Tolerate unescaped last dash i.e. `[-...]`.
71+
"scripturl": false, // Tolerate script-targeted URLs.
72+
"smarttabs": false, // Tolerate mixed tabs and spaces when the latter are used for alignmnent only.
73+
"shadow": false, // Allows re-define variables later in code e.g. `var x=1; x=2;`.
74+
"sub": false, // Tolerate all forms of subscript notation besides dot notation e.g. `dict['key']` instead of `dict.key`.
75+
"supernew": false, // Tolerate `new function () { ... };` and `new Object;`.
76+
"validthis": false, // Tolerate strict violations when the code is running in strict mode and you use this in a non-constructor function.
77+
78+
// == Environments ====================================================
79+
//
80+
// These options pre-define global variables that are exposed by
81+
// popular JavaScript libraries and runtime environments—such as
82+
// browser or node.js.
83+
84+
"browser": false, // Standard browser globals e.g. `window`, `document`.
85+
"couch": false, // Enable globals exposed by CouchDB.
86+
"devel": false, // Allow development statements e.g. `console.log();`.
87+
"dojo": false, // Enable globals exposed by Dojo Toolkit.
88+
"jquery": false, // Enable globals exposed by jQuery JavaScript library.
89+
"mootools": false, // Enable globals exposed by MooTools JavaScript framework.
90+
"node": true, // Enable globals available when code is running inside of the NodeJS runtime environment.
91+
"nonstandard": false, // Define non-standard but widely adopted globals such as escape and unescape.
92+
"prototypejs": false, // Enable globals exposed by Prototype JavaScript framework.
93+
"rhino": false, // Enable globals available when your code is running inside of the Rhino runtime environment.
94+
"wsh": false, // Enable globals available when your code is running as a script for the Windows Script Host.
95+
96+
// == JSLint Legacy ===================================================
97+
//
98+
// These options are legacy from JSLint. Aside from bug fixes they will
99+
// not be improved in any way and might be removed at any point.
100+
101+
"nomen": false, // Prohibit use of initial or trailing underbars in names.
102+
"onevar": true, // Allow only one `var` statement per function.
103+
"passfail": false, // Stop on first error.
104+
"white": true, // Check against strict whitespace and indentation rules.
105+
106+
// == Undocumented Options ============================================
107+
//
108+
// While I've found these options in [example1][2] and [example2][3]
109+
// they are not described in the [JSHint Options documentation][4].
110+
//
111+
// [4]: http://www.jshint.com/options/
112+
113+
"maxerr": 100, // Maximum errors before stopping.
114+
"predef": [ // Extra globals.
115+
//"exampleVar",
116+
"it",
117+
"describe"
118+
],
119+
"indent": 4 // Specify indentation spacing
120+
}

.travis.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
language: node_js
2+
node_js:
3+
- "7"
4+
- "6"
5+
- "4"
6+
before_script:
7+
- npm install -g gulp mocha gulp-cli codecov istanbul
8+
install:
9+
- npm install
10+
script:
11+
- istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && codecov

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
# snipe
2+
3+
[![Build Status](https://travis-ci.org/EnsembleLab/snipe.svg?branch=master)](https://travis-ci.org/EnsembleLab/snipe) [![codecov](https://codecov.io/gh/EnsembleLab/snipe/branch/master/graph/badge.svg)](https://codecov.io/gh/EnsembleLab/snipe)
4+
5+
6+
27
Freelance Platform

app.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
"use strict";
2+
var cluster = require('cluster');
3+
var config = require('./config');
4+
var log = require('./services/logger');
5+
6+
if (cluster.isMaster && config.env === 'production') {
7+
// Count the machine's CPUs
8+
var cpuCount = require('os').cpus().length;
9+
10+
// Create a worker for each CPU
11+
for (var i = 0; i < cpuCount; i += 1) {
12+
cluster.fork();
13+
}
14+
15+
// Listen for dying workers
16+
cluster.on('exit', function (worker) {
17+
// Replace the dead worker,
18+
// we're not sentimental
19+
log.info('Worker %d died', worker.id);
20+
cluster.fork();
21+
});
22+
23+
} else {
24+
var express = require('express');
25+
var app = express();
26+
var router = require('./routes');
27+
28+
if(config.trustProxy === 'yes'){
29+
app.enable('trust proxy');
30+
}
31+
32+
app.use('/',router);
33+
34+
if(config.env === 'production'){
35+
log.info('Worker %d running!', cluster.worker.id);
36+
}
37+
38+
39+
app.listen(config.port, function () {
40+
log.info('listening on port '+config.port+'!');
41+
});
42+
43+
}

config/.gitkeep

Whitespace-only changes.

config/development.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
"use strict";
2+
module.exports = {
3+
env: process.env.NODE_ENV || 'development',
4+
port: process.env.PORT || 3000,
5+
trustProxy: process.env.TRUST_PROXY || 'no',
6+
bugsnagKey: process.env.BUGSNAG_KEY || false,
7+
secureMode: process.env.SECURE_MODE || false,
8+
secret: process.env.SECRET || 'lakikihdgdfdjjjdgd67264664vdjhjdyncmxuei8336%%^#%gdvdhj????jjhdghduue'
9+
};

config/index.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
"use strict";
2+
var development = require('./development');
3+
var production = require('./production');
4+
5+
if(process.env.NODE_ENV === 'development'){
6+
module.exports = development;
7+
}else if(process.env.NODE_ENV === 'production'){
8+
module.exports = production;
9+
}else{
10+
module.exports = development;
11+
}

config/production.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
"use strict";
2+
module.exports = {
3+
env: process.env.NODE_ENV || 'production',
4+
port: process.env.PORT || 3000,
5+
trustProxy: process.env.TRUST_PROXY || 'no',
6+
bugsnagKey: process.env.BUGSNAG_KEY || false,
7+
secureMode: process.env.SECURE_MODE || true,
8+
secret: process.env.SECRET || 'lakikihdgdfdjjjdgd67264660okjnbgtrdxswerfgytg373745ei8336%%^#%gdvdhj????jjhdghduue'
9+
};

0 commit comments

Comments
 (0)