This repository has been archived by the owner on Aug 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
39 changed files
with
1,086 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Module dependencies. | ||
*/ | ||
exports.index = function(req, res) { | ||
res.render('index.html', { | ||
user: req.user || null | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
'use strict'; | ||
|
||
module.exports = function(app) { | ||
// Root routing | ||
var core = require('../../app/controllers/core'); | ||
app.get('/', core.index); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Module dependencies. | ||
*/ | ||
var should = require('should'), | ||
mongoose = require('mongoose'), | ||
User = mongoose.model('User'), | ||
Article = mongoose.model('Article'); | ||
|
||
//Globals | ||
var user; | ||
var article; | ||
|
||
//The tests | ||
describe('<Unit Test>', function() { | ||
describe('Model Article:', function() { | ||
beforeEach(function(done) { | ||
user = new User({ | ||
firstName: 'Full', | ||
lastName: 'Name', | ||
displayName: 'Full Name', | ||
email: 'test@test.com', | ||
username: 'username', | ||
password: 'password' | ||
}); | ||
|
||
user.save(function() { | ||
article = new Article({ | ||
title: 'Article Title', | ||
content: 'Article Content', | ||
user: user | ||
}); | ||
|
||
done(); | ||
}); | ||
}); | ||
|
||
describe('Method Save', function() { | ||
it('should be able to save without problems', function(done) { | ||
return article.save(function(err) { | ||
should.not.exist(err); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('should be able to show an error when try to save without title', function(done) { | ||
article.title = ''; | ||
|
||
return article.save(function(err) { | ||
should.exist(err); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
|
||
afterEach(function(done) { | ||
Article.remove().exec(); | ||
User.remove().exec(); | ||
done(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Module dependencies. | ||
*/ | ||
var should = require('should'), | ||
mongoose = require('mongoose'), | ||
User = mongoose.model('User'); | ||
|
||
//Globals | ||
var user, user2; | ||
|
||
//The tests | ||
describe('<Unit Test>', function() { | ||
describe('Model User:', function() { | ||
before(function(done) { | ||
user = new User({ | ||
firstName: 'Full', | ||
lastName: 'Name', | ||
displayName: 'Full Name', | ||
email: 'test@test.com', | ||
username: 'username', | ||
password: 'password', | ||
provider: 'local' | ||
}); | ||
user2 = new User({ | ||
firstName: 'Full', | ||
lastName: 'Name', | ||
displayName: 'Full Name', | ||
email: 'test@test.com', | ||
username: 'username', | ||
password: 'password', | ||
provider: 'local' | ||
}); | ||
|
||
done(); | ||
}); | ||
|
||
describe('Method Save', function() { | ||
it('should begin with no users', function(done) { | ||
User.find({}, function(err, users) { | ||
users.should.have.length(0); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('should be able to save whithout problems', function(done) { | ||
user.save(done); | ||
}); | ||
|
||
it('should fail to save an existing user again', function(done) { | ||
user.save(); | ||
return user2.save(function(err) { | ||
should.exist(err); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('should be able to show an error when try to save without first name', function(done) { | ||
user.firstName = ''; | ||
return user.save(function(err) { | ||
should.exist(err); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
|
||
after(function(done) { | ||
User.remove().exec(); | ||
done(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"> | ||
|
||
<head> | ||
<title>{{title}}</title> | ||
|
||
<!-- General META --> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="Content-type" content="text/html;charset=UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
<meta name="viewport" content="width=device-width,initial-scale=1"> | ||
|
||
<!-- Semantic META --> | ||
<meta name="keywords" content="{{keywords}}"> | ||
<meta name="description" content="{{description}}"> | ||
|
||
<!-- Social META --> | ||
<meta property="fb:app_id" content="{{facebookAppId}}"> | ||
<meta property="og:site_name" content="{{title}}"> | ||
<meta property="og:title" content="{{title}}"> | ||
<meta property="og:description" content="{{description}}"> | ||
<meta property="og:url" content="{{url}}"> | ||
<meta property="og:image" content="/img/brand/logo.png"> | ||
<meta property="og:type" content="website"> | ||
|
||
<!-- Fav Icon --> | ||
<link href="/img/brand/favicon.ico" rel="shortcut icon" type="image/x-icon"> | ||
|
||
<!-- Bootstrap CSS --> | ||
<link rel="stylesheet" href="/lib/bootstrap/dist/css/bootstrap.css"> | ||
<link rel="stylesheet" href="/lib/bootstrap/dist/css/bootstrap-theme.css"> | ||
|
||
<!-- Application CSS --> | ||
<link rel="stylesheet" href="/css/common.css"> | ||
|
||
<!--Application Modules CSS--> | ||
{% for modulesCSSFile in modulesCSSFiles %} | ||
<link rel="stylesheet" href="{{modulesCSSFile}}"> | ||
{% endfor %} | ||
|
||
<!-- HTML5 Shim --> | ||
<!--[if lt IE 9]> | ||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> | ||
<![endif]--> | ||
</head> | ||
|
||
<body> | ||
<header data-ng-include="'/modules/core/views/header.html'" class="navbar navbar-fixed-top navbar-inverse"></header> | ||
<section class="content"> | ||
<section class="container"> | ||
{% block content %}{% endblock %} | ||
</section> | ||
</section> | ||
|
||
<!--Embedding The User Object--> | ||
<script type="text/javascript"> | ||
var user = {{user | json | safe}}; | ||
</script> | ||
|
||
<!--AngularJS--> | ||
<script type="text/javascript" src="/lib/angular/angular.js"></script> | ||
<script type="text/javascript" src="/lib/angular-route/angular-route.js"></script> | ||
<script type="text/javascript" src="/lib/angular-resource/angular-resource.js"></script> | ||
<script type="text/javascript" src="/lib/angular-cookies/angular-cookies.js"></script> | ||
<script type="text/javascript" src="/lib/angular-animate/angular-animate.js"></script> | ||
|
||
<!--Angular UI--> | ||
<script type="text/javascript" src="/lib/angular-bootstrap/ui-bootstrap.js"></script> | ||
<script type="text/javascript" src="/lib/angular-ui-utils/ui-utils.js"></script> | ||
|
||
<!--AngularJS Application Init--> | ||
<script type="text/javascript" src="/js/config.js"></script> | ||
<script type="text/javascript" src="/js/application.js"></script> | ||
|
||
<!--Application Modules--> | ||
{% for modulesJSFile in modulesJSFiles %} | ||
<script type="text/javascript" src="{{modulesJSFile}}"></script> | ||
{% endfor %} | ||
|
||
{% if process.env.NODE_ENV === 'development' %} | ||
<!--Livereload script rendered --> | ||
<script type="text/javascript" src="http://localhost:35729/livereload.js"></script> | ||
{% endif %} | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
db: 'mongodb://localhost/mean-travis', | ||
port: 3001, | ||
app: { | ||
title: 'MEAN.JS - Travis Environment' | ||
}, | ||
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' | ||
}, | ||
google: { | ||
clientID: 'APP_ID', | ||
clientSecret: 'APP_SECRET', | ||
callbackURL: 'http://localhost:3000/auth/google/callback' | ||
}, | ||
linkedin: { | ||
clientID: 'APP_ID', | ||
clientSecret: 'APP_SECRET', | ||
callbackURL: 'http://localhost:3000/auth/linkedin/callback' | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Module dependencies. | ||
*/ | ||
var fs = require('fs'); | ||
|
||
// Walk function to recursively get files | ||
var _walk = function(root, regex, exclude, removePath) { | ||
var output = []; | ||
var directories = []; | ||
|
||
// First read through files | ||
fs.readdirSync(root).forEach(function(file) { | ||
var newPath = root + '/' + file; | ||
var stat = fs.statSync(newPath); | ||
|
||
if (stat.isFile()) { | ||
if (regex.test(file) && (!exclude || !exclude.test(file))) { | ||
output.push(newPath.replace(removePath, '')); | ||
} | ||
} else if (stat.isDirectory()) { | ||
directories.push(newPath); | ||
} | ||
}); | ||
|
||
// Then recursively add directories | ||
directories.forEach(function(directory) { | ||
output = output.concat(_walk(directory, regex, exclude, removePath)); | ||
}); | ||
|
||
return output; | ||
}; | ||
|
||
/** | ||
* Exposing the walk function | ||
*/ | ||
exports.walk = _walk; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Module dependencies. | ||
*/ | ||
var utilities = require('./config/utilities'); | ||
|
||
// Grabbing module files using the walk function | ||
var modulesJSFiles = utilities.walk('./public/modules', /(.*)\.(js)/, null, null); | ||
|
||
// Karma configuration | ||
module.exports = function(config) { | ||
config.set({ | ||
// Frameworks to use | ||
frameworks: ['jasmine'], | ||
|
||
// List of files / patterns to load in the browser | ||
files: [ | ||
'public/lib/angular/angular.js', | ||
'public/lib/angular-mocks/angular-mocks.js', | ||
'public/lib/angular-cookies/angular-cookies.js', | ||
'public/lib/angular-resource/angular-resource.js', | ||
'public/lib/angular-route/angular-route.js', | ||
'public/lib/angular-bootstrap/ui-bootstrap.js', | ||
'public/lib/angular-ui-utils/ui-utils.js', | ||
'public/js/config.js', | ||
'public/js/application.js', | ||
].concat(modulesJSFiles), | ||
|
||
// Test results reporter to use | ||
// Possible values: 'dots', 'progress', 'junit', 'growl', 'coverage' | ||
//reporters: ['progress'], | ||
reporters: ['progress'], | ||
|
||
// Web server port | ||
port: 9876, | ||
|
||
// Enable / disable colors in the output (reporters and logs) | ||
colors: true, | ||
|
||
// Level of logging | ||
// Possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG | ||
logLevel: config.LOG_INFO, | ||
|
||
// Enable / disable watching file and executing tests whenever any file changes | ||
autoWatch: true, | ||
|
||
// Start these browsers, currently available: | ||
// - Chrome | ||
// - ChromeCanary | ||
// - Firefox | ||
// - Opera | ||
// - Safari (only Mac) | ||
// - PhantomJS | ||
// - IE (only Windows) | ||
browsers: ['PhantomJS'], | ||
|
||
// If browser does not capture in given timeout [ms], kill it | ||
captureTimeout: 60000, | ||
|
||
// Continuous Integration mode | ||
// If true, it capture browsers, run tests and exit | ||
singleRun: true | ||
}); | ||
}; |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.