Skip to content
This repository was archived by the owner on Aug 30, 2021. It is now read-only.

Commit 014d941

Browse files
committed
Merge from gabrielmanchini - issue #50
1 parent 84874bc commit 014d941

18 files changed

+303
-147
lines changed

.jshintrc

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// http://www.jshint.com/docs/
2+
{
3+
"node": true, // Enable globals available when code is running inside of the NodeJS runtime environment.
4+
"browser": true, // Standard browser globals e.g. `window`, `document`.
5+
"es5": true, // Allow EcmaScript 5 syntax.
6+
"esnext": true, // Allow ES.next specific features such as `const` and `let`.
7+
"bitwise": false, // Prohibit bitwise operators (&, |, ^, etc.).
8+
"camelcase": false, // Permit only camelcase for `var` and `object indexes`.
9+
"curly": false, // Require {} for every new block or scope.
10+
"eqeqeq": true, // Require triple equals i.e. `===`.
11+
"immed": true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );`
12+
"latedef": true, // Prohibit variable use before definition.
13+
"newcap": true, // Require capitalization of all constructor functions e.g. `new F()`.
14+
"noarg": true, // Prohibit use of `arguments.caller` and `arguments.callee`.
15+
"quotmark": "single", // Define quotes to string values.
16+
"regexp": true, // Prohibit `.` and `[^...]` in regular expressions.
17+
"undef": true, // Require all non-global variables be declared before they are used.
18+
"unused": true, // Warn unused variables.
19+
"strict": false, // Require `use strict` pragma in every file.
20+
"trailing": true, // Prohibit trailing whitespaces.
21+
"smarttabs": false, // Suppresses warnings about mixed tabs and spaces
22+
"globals": { // Globals variables.
23+
"angular": false
24+
},
25+
"predef": [ // Extra globals.
26+
"define",
27+
"require",
28+
"exports",
29+
"module",
30+
"describe",
31+
"before",
32+
"beforeEach",
33+
"after",
34+
"afterEach",
35+
"it"
36+
],
37+
"indent": 2, // Specify indentation spacing
38+
"maxlen": 120, // Max line lenght
39+
"devel": false, // Allow development statements e.g. `console.log();`.
40+
"noempty": true // Prohibit use of empty blocks.
41+
}

.slugignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/test

.travis.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
language: node_js
22
node_js:
3-
- "0.10"
3+
- "0.10"
4+
env:
5+
- NODE_ENV=travis
6+
services:
7+
- mongodb

Makefile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
REPORTER = spec
2+
NODEARGS =
3+
test:
4+
# @./node_modules/grunt-contrib-jshint/node_modules/.bin/jshint ./**/*.js --config .jshintrc &2> /dev/null
5+
@if [ ! -n "$(NODE_ENV)" ]; then NODE_ENV=test NODE_PATH=lib ./node_modules/grunt-nodemon/node_modules/.bin/nodemon -x ./node_modules/.bin/mocha -R $(REPORTER) -t 15000 --recursive test $(NODEARGS); else NODE_PATH=lib ./node_modules/.bin/mocha -R $(REPORTER) -t 15000 --recursive test $(NODEARGS); fi
6+
7+
start:
8+
@if [ ! -n "$(NODE_ENV)" ]; then NODE_ENV=development NODE_PATH=lib ./node_modules/grunt-nodemon/node_modules/.bin/nodemon server.js $(NODEARGS) ; else NODE_PATH=lib ./node_modules/.bin/foreman start; fi
9+
10+
mocha:
11+
NODE_PATH=lib ./node_modules/.bin/mocha -R $(REPORTER) -t 15000 --recursive test $(NODEARGS)
12+
13+
repl:
14+
@NODE_ENV=development NODE_PATH=lib node --debug $(NODEARGS)
15+
16+
webtest:
17+
@NODE_ENV=test NODE_PATH=lib ./node_modules/.bin/web-mocha test $(NODEARGS)
18+
19+
.PHONY: jshint test repl webtest mocha

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ MEAN is a boilerplate that provides a nice starting point for [MongoDB](http://w
2828

2929
$ npm install
3030

31-
We recommend using [Grunt](https://github.com/gruntjs/grunt-cli) to start the server:
31+
Export the node Path to load your lib into project (default in HEROKU)
32+
$ export NODE_PATH=lib
3233

34+
We recommend using [Grunt](https://github.com/gruntjs/grunt-cli) to start the server:
3335
$ grunt
3436

3537
When not using grunt you can use:

app/models/article.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
* Module dependencies.
33
*/
44
var mongoose = require('mongoose'),
5-
env = process.env.NODE_ENV || 'development',
6-
config = require('../../config/config')[env],
5+
config = require('../../config/config'),
76
Schema = mongoose.Schema;
87

98

config/config.js

Lines changed: 6 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,7 @@
1-
var path = require('path'),
2-
rootPath = path.normalize(__dirname + '/..');
1+
var _ = require('underscore');
32

4-
module.exports = {
5-
development: {
6-
db: 'mongodb://localhost/mean-dev',
7-
root: rootPath,
8-
app: {
9-
name: 'MEAN - A Modern Stack - Development'
10-
},
11-
facebook: {
12-
clientID: "APP_ID",
13-
clientSecret: "APP_SECRET",
14-
callbackURL: "http://localhost:3000/auth/facebook/callback"
15-
},
16-
twitter: {
17-
clientID: "CONSUMER_KEY",
18-
clientSecret: "CONSUMER_SECRET",
19-
callbackURL: "http://localhost:3000/auth/twitter/callback"
20-
},
21-
github: {
22-
clientID: 'APP_ID',
23-
clientSecret: 'APP_SECRET',
24-
callbackURL: 'http://localhost:3000/auth/github/callback'
25-
},
26-
google: {
27-
clientID: "APP_ID",
28-
clientSecret: "APP_SECRET",
29-
callbackURL: "http://localhost:3000/auth/google/callback"
30-
}
31-
},
32-
test: {
33-
db: 'mongodb://localhost/mean-test',
34-
root: rootPath,
35-
app: {
36-
name: 'MEAN - A Modern Stack - Test'
37-
},
38-
facebook: {
39-
clientID: "APP_ID",
40-
clientSecret: "APP_SECRET",
41-
callbackURL: "http://localhost:3000/auth/facebook/callback"
42-
},
43-
twitter: {
44-
clientID: "CONSUMER_KEY",
45-
clientSecret: "CONSUMER_SECRET",
46-
callbackURL: "http://localhost:3000/auth/twitter/callback"
47-
},
48-
github: {
49-
clientID: 'APP_ID',
50-
clientSecret: 'APP_SECRET',
51-
callbackURL: 'http://localhost:3000/auth/github/callback'
52-
},
53-
google: {
54-
clientID: "APP_ID",
55-
clientSecret: "APP_SECRET",
56-
callbackURL: "http://localhost:3000/auth/google/callback"
57-
}
58-
},
59-
production: {
60-
db: 'mongodb://localhost/mean',
61-
root: rootPath,
62-
app: {
63-
name: 'MEAN - A Modern Stack - Production'
64-
},
65-
facebook: {
66-
clientID: "APP_ID",
67-
clientSecret: "APP_SECRET",
68-
callbackURL: "http://localhost:3000/auth/facebook/callback"
69-
},
70-
twitter: {
71-
clientID: "CONSUMER_KEY",
72-
clientSecret: "CONSUMER_SECRET",
73-
callbackURL: "http://localhost:3000/auth/twitter/callback"
74-
},
75-
github: {
76-
clientID: 'APP_ID',
77-
clientSecret: 'APP_SECRET',
78-
callbackURL: 'http://localhost:3000/auth/github/callback'
79-
},
80-
google: {
81-
clientID: "APP_ID",
82-
clientSecret: "APP_SECRET",
83-
callbackURL: "http://localhost:3000/auth/google/callback"
84-
}
85-
}
86-
};
3+
// Load app configuration
4+
5+
module.exports = _.extend(
6+
require(__dirname + '/../config/env/all.js'),
7+
require(__dirname + '/../config/env/' + process.env.NODE_ENV + '.json') || {}) ;

config/env/all.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
var path = require('path'),
2+
rootPath = path.normalize(__dirname + '/../..');
3+
4+
module.exports = {
5+
root: rootPath,
6+
port: process.env.PORT || 3000,
7+
db: process.env.MONGOHQ_URL
8+
}

config/env/development.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"db": "mongodb://localhost/mean-dev",
3+
"app": {
4+
"name": "MEAN - A Modern Stack - Development"
5+
},
6+
"facebook": {
7+
"clientID": "APP_ID",
8+
"clientSecret": "APP_SECRET",
9+
"callbackURL": "http://localhost:3000/auth/facebook/callback"
10+
},
11+
"twitter": {
12+
"clientID": "CONSUMER_KEY",
13+
"clientSecret": "CONSUMER_SECRET",
14+
"callbackURL": "http://localhost:3000/auth/twitter/callback"
15+
},
16+
"github": {
17+
"clientID": "APP_ID",
18+
"clientSecret": "APP_SECRET",
19+
"callbackURL": "http://localhost:3000/auth/github/callback"
20+
},
21+
"google": {
22+
"clientID": "APP_ID",
23+
"clientSecret": "APP_SECRET",
24+
"callbackURL": "http://localhost:3000/auth/google/callback"
25+
}
26+
}

config/env/production.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"db": "mongodb://localhost/mean",
3+
"app": {
4+
"name": "MEAN - A Modern Stack - Production"
5+
},
6+
"facebook": {
7+
"clientID": "APP_ID",
8+
"clientSecret": "APP_SECRET",
9+
"callbackURL": "http://localhost:3000/auth/facebook/callback"
10+
},
11+
"twitter": {
12+
"clientID": "CONSUMER_KEY",
13+
"clientSecret": "CONSUMER_SECRET",
14+
"callbackURL": "http://localhost:3000/auth/twitter/callback"
15+
},
16+
"github": {
17+
"clientID": "APP_ID",
18+
"clientSecret": "APP_SECRET",
19+
"callbackURL": "http://localhost:3000/auth/github/callback"
20+
},
21+
"google": {
22+
"clientID": "APP_ID",
23+
"clientSecret": "APP_SECRET",
24+
"callbackURL": "http://localhost:3000/auth/google/callback"
25+
}
26+
}

config/env/test.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"db": "mongodb://localhost/mean-test",
3+
"port": 3001,
4+
"app": {
5+
"name": "MEAN - A Modern Stack - Test"
6+
},
7+
"facebook": {
8+
"clientID": "APP_ID",
9+
"clientSecret": "APP_SECRET",
10+
"callbackURL": "http://localhost:3000/auth/facebook/callback"
11+
},
12+
"twitter": {
13+
"clientID": "CONSUMER_KEY",
14+
"clientSecret": "CONSUMER_SECRET",
15+
"callbackURL": "http://localhost:3000/auth/twitter/callback"
16+
},
17+
"github": {
18+
"clientID": "APP_ID",
19+
"clientSecret": "APP_SECRET",
20+
"callbackURL": "http://localhost:3000/auth/github/callback"
21+
},
22+
"google": {
23+
"clientID": "APP_ID",
24+
"clientSecret": "APP_SECRET",
25+
"callbackURL": "http://localhost:3000/auth/google/callback"
26+
}
27+
}

config/env/travis.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"db": "mongodb://localhost/mean-travis",
3+
"port": 3001,
4+
"app": {
5+
"name": "MEAN - A Modern Stack - Test on travis"
6+
},
7+
"facebook": {
8+
"clientID": "APP_ID",
9+
"clientSecret": "APP_SECRET",
10+
"callbackURL": "http://localhost:3000/auth/facebook/callback"
11+
},
12+
"twitter": {
13+
"clientID": "CONSUMER_KEY",
14+
"clientSecret": "CONSUMER_SECRET",
15+
"callbackURL": "http://localhost:3000/auth/twitter/callback"
16+
},
17+
"github": {
18+
"clientID": "APP_ID",
19+
"clientSecret": "APP_SECRET",
20+
"callbackURL": "http://localhost:3000/auth/github/callback"
21+
},
22+
"google": {
23+
"clientID": "APP_ID",
24+
"clientSecret": "APP_SECRET",
25+
"callbackURL": "http://localhost:3000/auth/google/callback"
26+
}
27+
}

config/express.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
var express = require('express'),
55
mongoStore = require('connect-mongo')(express),
66
flash = require('connect-flash'),
7-
helpers = require('view-helpers');
7+
helpers = require('view-helpers'),
8+
config = require('./config');
89

9-
module.exports = function(app, config, passport) {
10+
module.exports = function(app, passport) {
1011
app.set('showStackError', true);
1112

1213
//Should be placed before express.static

config/passport.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ var mongoose = require('mongoose'),
33
TwitterStrategy = require('passport-twitter').Strategy,
44
FacebookStrategy = require('passport-facebook').Strategy,
55
GitHubStrategy = require('passport-github').Strategy,
6-
GoogleStrategy = require('passport-google-oauth').OAuth2Strategy,
7-
User = mongoose.model('User');
6+
GoogleStrategy = require('passport-google-oauth').Strategy,
7+
User = mongoose.model('User'),
8+
config = require('./config');
89

910

10-
module.exports = function(passport, config) {
11+
module.exports = function(passport) {
1112
//Serialize sessions
1213
passport.serializeUser(function(user, done) {
1314
done(null, user.id);
@@ -142,8 +143,8 @@ module.exports = function(passport, config) {
142143

143144
//Use google strategy
144145
passport.use(new GoogleStrategy({
145-
clientID: config.google.clientID,
146-
clientSecret: config.google.clientSecret,
146+
consumerKey: config.google.clientID,
147+
consumerSecret: config.google.clientSecret,
147148
callbackURL: config.google.callbackURL
148149
},
149150
function(accessToken, refreshToken, profile, done) {

gruntfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ module.exports = function(grunt) {
6666
},
6767
exec: {
6868
options: {
69-
exec: 'less'
69+
exec: 'less'
7070
}
7171
}
7272
},

0 commit comments

Comments
 (0)