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

Commit

Permalink
Merge from gabrielmanchini - issue #50
Browse files Browse the repository at this point in the history
  • Loading branch information
rschwabco committed Sep 10, 2013
1 parent 84874bc commit 014d941
Show file tree
Hide file tree
Showing 18 changed files with 303 additions and 147 deletions.
41 changes: 41 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// http://www.jshint.com/docs/
{
"node": true, // Enable globals available when code is running inside of the NodeJS runtime environment.
"browser": true, // Standard browser globals e.g. `window`, `document`.
"es5": true, // Allow EcmaScript 5 syntax.
"esnext": true, // Allow ES.next specific features such as `const` and `let`.
"bitwise": false, // Prohibit bitwise operators (&, |, ^, etc.).
"camelcase": false, // Permit only camelcase for `var` and `object indexes`.
"curly": false, // Require {} for every new block or scope.
"eqeqeq": true, // Require triple equals i.e. `===`.
"immed": true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );`
"latedef": true, // Prohibit variable use before definition.
"newcap": true, // Require capitalization of all constructor functions e.g. `new F()`.
"noarg": true, // Prohibit use of `arguments.caller` and `arguments.callee`.
"quotmark": "single", // Define quotes to string values.
"regexp": true, // Prohibit `.` and `[^...]` in regular expressions.
"undef": true, // Require all non-global variables be declared before they are used.
"unused": true, // Warn unused variables.
"strict": false, // Require `use strict` pragma in every file.
"trailing": true, // Prohibit trailing whitespaces.
"smarttabs": false, // Suppresses warnings about mixed tabs and spaces
"globals": { // Globals variables.
"angular": false
},
"predef": [ // Extra globals.
"define",
"require",
"exports",
"module",
"describe",
"before",
"beforeEach",
"after",
"afterEach",
"it"
],
"indent": 2, // Specify indentation spacing
"maxlen": 120, // Max line lenght
"devel": false, // Allow development statements e.g. `console.log();`.
"noempty": true // Prohibit use of empty blocks.
}
1 change: 1 addition & 0 deletions .slugignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/test
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
language: node_js
node_js:
- "0.10"
- "0.10"
env:
- NODE_ENV=travis
services:
- mongodb
19 changes: 19 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
REPORTER = spec
NODEARGS =
test:
# @./node_modules/grunt-contrib-jshint/node_modules/.bin/jshint ./**/*.js --config .jshintrc &2> /dev/null
@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

start:
@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

mocha:
NODE_PATH=lib ./node_modules/.bin/mocha -R $(REPORTER) -t 15000 --recursive test $(NODEARGS)

repl:
@NODE_ENV=development NODE_PATH=lib node --debug $(NODEARGS)

webtest:
@NODE_ENV=test NODE_PATH=lib ./node_modules/.bin/web-mocha test $(NODEARGS)

.PHONY: jshint test repl webtest mocha
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ MEAN is a boilerplate that provides a nice starting point for [MongoDB](http://w

$ npm install

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

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

When not using grunt you can use:
Expand Down
3 changes: 1 addition & 2 deletions app/models/article.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
* Module dependencies.
*/
var mongoose = require('mongoose'),
env = process.env.NODE_ENV || 'development',
config = require('../../config/config')[env],
config = require('../../config/config'),
Schema = mongoose.Schema;


Expand Down
91 changes: 6 additions & 85 deletions config/config.js
Original file line number Diff line number Diff line change
@@ -1,86 +1,7 @@
var path = require('path'),
rootPath = path.normalize(__dirname + '/..');
var _ = require('underscore');

module.exports = {
development: {
db: 'mongodb://localhost/mean-dev',
root: rootPath,
app: {
name: 'MEAN - A Modern Stack - Development'
},
facebook: {
clientID: "APP_ID",
clientSecret: "APP_SECRET",
callbackURL: "http://localhost:3000/auth/facebook/callback"
},
twitter: {
clientID: "CONSUMER_KEY",
clientSecret: "CONSUMER_SECRET",
callbackURL: "http://localhost:3000/auth/twitter/callback"
},
github: {
clientID: 'APP_ID',
clientSecret: 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/github/callback'
},
google: {
clientID: "APP_ID",
clientSecret: "APP_SECRET",
callbackURL: "http://localhost:3000/auth/google/callback"
}
},
test: {
db: 'mongodb://localhost/mean-test',
root: rootPath,
app: {
name: 'MEAN - A Modern Stack - Test'
},
facebook: {
clientID: "APP_ID",
clientSecret: "APP_SECRET",
callbackURL: "http://localhost:3000/auth/facebook/callback"
},
twitter: {
clientID: "CONSUMER_KEY",
clientSecret: "CONSUMER_SECRET",
callbackURL: "http://localhost:3000/auth/twitter/callback"
},
github: {
clientID: 'APP_ID',
clientSecret: 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/github/callback'
},
google: {
clientID: "APP_ID",
clientSecret: "APP_SECRET",
callbackURL: "http://localhost:3000/auth/google/callback"
}
},
production: {
db: 'mongodb://localhost/mean',
root: rootPath,
app: {
name: 'MEAN - A Modern Stack - Production'
},
facebook: {
clientID: "APP_ID",
clientSecret: "APP_SECRET",
callbackURL: "http://localhost:3000/auth/facebook/callback"
},
twitter: {
clientID: "CONSUMER_KEY",
clientSecret: "CONSUMER_SECRET",
callbackURL: "http://localhost:3000/auth/twitter/callback"
},
github: {
clientID: 'APP_ID',
clientSecret: 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/github/callback'
},
google: {
clientID: "APP_ID",
clientSecret: "APP_SECRET",
callbackURL: "http://localhost:3000/auth/google/callback"
}
}
};
// Load app configuration

module.exports = _.extend(
require(__dirname + '/../config/env/all.js'),
require(__dirname + '/../config/env/' + process.env.NODE_ENV + '.json') || {}) ;
8 changes: 8 additions & 0 deletions config/env/all.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
var path = require('path'),
rootPath = path.normalize(__dirname + '/../..');

module.exports = {
root: rootPath,
port: process.env.PORT || 3000,
db: process.env.MONGOHQ_URL
}
26 changes: 26 additions & 0 deletions config/env/development.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"db": "mongodb://localhost/mean-dev",
"app": {
"name": "MEAN - A Modern Stack - Development"
},
"facebook": {
"clientID": "APP_ID",
"clientSecret": "APP_SECRET",
"callbackURL": "http://localhost:3000/auth/facebook/callback"
},
"twitter": {
"clientID": "CONSUMER_KEY",
"clientSecret": "CONSUMER_SECRET",
"callbackURL": "http://localhost:3000/auth/twitter/callback"
},
"github": {
"clientID": "APP_ID",
"clientSecret": "APP_SECRET",
"callbackURL": "http://localhost:3000/auth/github/callback"
},
"google": {
"clientID": "APP_ID",
"clientSecret": "APP_SECRET",
"callbackURL": "http://localhost:3000/auth/google/callback"
}
}
26 changes: 26 additions & 0 deletions config/env/production.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"db": "mongodb://localhost/mean",
"app": {
"name": "MEAN - A Modern Stack - Production"
},
"facebook": {
"clientID": "APP_ID",
"clientSecret": "APP_SECRET",
"callbackURL": "http://localhost:3000/auth/facebook/callback"
},
"twitter": {
"clientID": "CONSUMER_KEY",
"clientSecret": "CONSUMER_SECRET",
"callbackURL": "http://localhost:3000/auth/twitter/callback"
},
"github": {
"clientID": "APP_ID",
"clientSecret": "APP_SECRET",
"callbackURL": "http://localhost:3000/auth/github/callback"
},
"google": {
"clientID": "APP_ID",
"clientSecret": "APP_SECRET",
"callbackURL": "http://localhost:3000/auth/google/callback"
}
}
27 changes: 27 additions & 0 deletions config/env/test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"db": "mongodb://localhost/mean-test",
"port": 3001,
"app": {
"name": "MEAN - A Modern Stack - Test"
},
"facebook": {
"clientID": "APP_ID",
"clientSecret": "APP_SECRET",
"callbackURL": "http://localhost:3000/auth/facebook/callback"
},
"twitter": {
"clientID": "CONSUMER_KEY",
"clientSecret": "CONSUMER_SECRET",
"callbackURL": "http://localhost:3000/auth/twitter/callback"
},
"github": {
"clientID": "APP_ID",
"clientSecret": "APP_SECRET",
"callbackURL": "http://localhost:3000/auth/github/callback"
},
"google": {
"clientID": "APP_ID",
"clientSecret": "APP_SECRET",
"callbackURL": "http://localhost:3000/auth/google/callback"
}
}
27 changes: 27 additions & 0 deletions config/env/travis.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"db": "mongodb://localhost/mean-travis",
"port": 3001,
"app": {
"name": "MEAN - A Modern Stack - Test on travis"
},
"facebook": {
"clientID": "APP_ID",
"clientSecret": "APP_SECRET",
"callbackURL": "http://localhost:3000/auth/facebook/callback"
},
"twitter": {
"clientID": "CONSUMER_KEY",
"clientSecret": "CONSUMER_SECRET",
"callbackURL": "http://localhost:3000/auth/twitter/callback"
},
"github": {
"clientID": "APP_ID",
"clientSecret": "APP_SECRET",
"callbackURL": "http://localhost:3000/auth/github/callback"
},
"google": {
"clientID": "APP_ID",
"clientSecret": "APP_SECRET",
"callbackURL": "http://localhost:3000/auth/google/callback"
}
}
5 changes: 3 additions & 2 deletions config/express.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
var express = require('express'),
mongoStore = require('connect-mongo')(express),
flash = require('connect-flash'),
helpers = require('view-helpers');
helpers = require('view-helpers'),
config = require('./config');

module.exports = function(app, config, passport) {
module.exports = function(app, passport) {
app.set('showStackError', true);

//Should be placed before express.static
Expand Down
11 changes: 6 additions & 5 deletions config/passport.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ var mongoose = require('mongoose'),
TwitterStrategy = require('passport-twitter').Strategy,
FacebookStrategy = require('passport-facebook').Strategy,
GitHubStrategy = require('passport-github').Strategy,
GoogleStrategy = require('passport-google-oauth').OAuth2Strategy,
User = mongoose.model('User');
GoogleStrategy = require('passport-google-oauth').Strategy,
User = mongoose.model('User'),
config = require('./config');


module.exports = function(passport, config) {
module.exports = function(passport) {
//Serialize sessions
passport.serializeUser(function(user, done) {
done(null, user.id);
Expand Down Expand Up @@ -142,8 +143,8 @@ module.exports = function(passport, config) {

//Use google strategy
passport.use(new GoogleStrategy({
clientID: config.google.clientID,
clientSecret: config.google.clientSecret,
consumerKey: config.google.clientID,
consumerSecret: config.google.clientSecret,
callbackURL: config.google.callbackURL
},
function(accessToken, refreshToken, profile, done) {
Expand Down
2 changes: 1 addition & 1 deletion gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ module.exports = function(grunt) {
},
exec: {
options: {
exec: 'less'
exec: 'less'
}
}
},
Expand Down
Loading

0 comments on commit 014d941

Please sign in to comment.