Skip to content
Permalink
Browse files

Remove MongoDB/Mongoose references

- Add "fs-extra"
- Fix Gulp/Grunt test runner tasks
- Fix User server routes test error
- Remove references to MongoDB/Mongoose from docs
- Remove "reset-password" script
  • Loading branch information...
francisdaigle committed Jan 16, 2016
1 parent dac8494 commit a9a7c488e4619f7775b336b1c3de5808ed1642b2
@@ -10,8 +10,6 @@ env:
matrix:
allow_failures:
- node_js: 5
services:
- mongodb
# gcc 4.8 requires ubuntu-toolchain-r-test
addons:
apt:
@@ -232,8 +232,6 @@ for hosting applications in the cloud. After you have an account follow the bel
* If you are using Pivotal Web Services run `$ cf login -a api.run.pivotal.io`.
* If you are using IBM Bluemix run `$ cf login -a api.ng.bluemix.net`.
* Create a Mongo DB service.
+ * If you are using Pivotal Web Services run `$ cf create-service mongolab sandbox pean-mongo`
+ * If you are using IBM Bluemix run `$ cf create-service mongodb 100 pean-mongo`
* Clone the GitHub repo for PEANJS if you have not already done so
* `$ git clone https://github.com/StetSolutions/pean.git && cd pean`
* Run `$ npm install`
@@ -19,10 +19,10 @@
module.exports = {
db: {
uri: 'mongodb://localhost/local-dev',
options: {
user: '',
pass: ''
name: '',
pass: '',
user: ''
}
},
sessionSecret: process.env.SESSION_SECRET || 'youshouldchangethistosomethingsecret',
@@ -1,20 +1,13 @@
'use strict';

module.exports = {
secure: {
ssl: true,
privateKey: './config/sslcerts/key.pem',
certificate: './config/sslcerts/cert.pem'
},
port: process.env.PORT || 8443,
db: {
uri: process.env.MONGOHQ_URL || process.env.MONGOLAB_URI || 'mongodb://' + (process.env.DB_1_PORT_27017_TCP_ADDR || 'localhost') + '/mean',
options: {
user: '',
pass: ''
name: '',
password: '',
user: ''
},
// Enable mongoose debug mode
debug: process.env.MONGODB_DEBUG || false
sync: true
},
log: {
// logging with Morgan - https://github.com/expressjs/morgan
@@ -35,6 +28,12 @@ module.exports = {
}
}
},
port: process.env.PORT || 8443,
secure: {
ssl: true,
privateKey: './config/sslcerts/key.pem',
certificate: './config/sslcerts/cert.pem'
},
facebook: {
clientID: process.env.FACEBOOK_ID || 'APP_ID',
clientSecret: process.env.FACEBOOK_SECRET || 'APP_SECRET',
@@ -251,40 +251,6 @@ module.exports = function (grunt) {
done();
});

// Connect to the MongoDB instance and load the models
grunt.task.registerTask('mongoose', 'Task that connects to the MongoDB instance and loads the application models.', function () {
// Get the callback
var done = this.async();

// Use mongoose configuration
var mongoose = require('./config/lib/mongoose.js');

// Connect to database
mongoose.connect(function (db) {
done();
});
});

// Drops the MongoDB database, used in e2e testing
grunt.task.registerTask('dropdb', 'drop the database', function () {
// async mode
var done = this.async();

// Use mongoose configuration
var mongoose = require('./config/lib/mongoose.js');

mongoose.connect(function (db) {
db.connection.db.dropDatabase(function (err) {
if (err) {
console.log(err);
} else {
console.log('Successfully dropped db: ', db.connection.db.databaseName);
}
db.connection.db.close(done);
});
});
});

grunt.task.registerTask('server', 'Starting the server', function () {
// Get the callback
var done = this.async();
@@ -306,7 +272,7 @@ module.exports = function (grunt) {
grunt.registerTask('test', ['env:test', 'lint', 'mkdir:upload', 'copy:localConfig', 'server', 'mochaTest', 'karma:unit', 'protractor']);
grunt.registerTask('test:server', ['env:test', 'lint', 'server', 'mochaTest']);
grunt.registerTask('test:client', ['env:test', 'lint', 'karma:unit']);
grunt.registerTask('test:e2e', ['env:test', 'lint', 'dropdb', 'server', 'protractor']);
grunt.registerTask('test:e2e', ['env:test', 'lint', 'server', 'protractor']);
// Run project coverage
grunt.registerTask('coverage', ['env:test', 'lint', 'mocha_istanbul:coverage', 'karma:unit']);

@@ -179,31 +179,21 @@ gulp.task('templatecache', function () {

// Mocha tests task
gulp.task('mocha', function (done) {
// Open mongoose connections
var mongoose = require('./config/lib/mongoose.js');
var error;

// Connect mongoose
mongoose.connect(function () {
mongoose.loadModels();
// Run the tests
gulp.src(testAssets.tests.server)
.pipe(plugins.mocha({
reporter: 'spec',
timeout: 10000
}))
.on('error', function (err) {
// If an error occurs, save it
error = err;
})
.on('end', function () {
// When the tests are done, disconnect mongoose and pass the error state back to gulp
mongoose.disconnect(function () {
done(error);
});
});
});

// Run the tests
gulp.src(testAssets.tests.server)
.pipe(plugins.mocha({
reporter: 'spec',
timeout: 10000
}))
.on('error', function (err) {
// If an error occurs, save it
error = err;
})
.on('end', function () {
done(error);
});
});

// Karma test runner task
@@ -214,23 +204,6 @@ gulp.task('karma', function (done) {
}, done).start();
});

// Drops the MongoDB database, used in e2e testing
gulp.task('dropdb', function (done) {
// Use mongoose configuration
var mongoose = require('./config/lib/mongoose.js');

mongoose.connect(function (db) {
db.connection.db.dropDatabase(function (err) {
if(err) {
console.log(err);
} else {
console.log('Successfully dropped db: ', db.connection.db.databaseName);
}
db.connection.db.close(done);
});
});
});

// Downloads the selenium webdriver
gulp.task('webdriver_update', webdriver_update);

@@ -280,7 +253,7 @@ gulp.task('test:client', function (done) {
});

gulp.task('test:e2e', function (done) {
runSequence('env:test', 'lint', 'dropdb', 'nodemon', 'protractor', done);
runSequence('env:test', 'lint', 'nodemon', 'protractor', done);
});

// Run the project in development mode
@@ -1,13 +1,7 @@
---
declared-services:
mean-mongo:
label: mongodb
plan: 100
applications:
- name: mean
host: mean-${random-word}
- name: pean
host: pean-${random-word}
memory: 128M
services:
- mean-mongo
env:
NODE_ENV: cloud-foundry
NODE_ENV: cloud-foundry
@@ -44,7 +44,7 @@ <h2>Congrats! You've configured and run the sample application.</h2>
<div class="row">
<div class="col-md-3">
<h2><strong>P</strong>ostgreSQL</h2>
<p><a target="_blank" href="http://mongodb.org/">PostgreSQL</a> is an SQL database engine. PostgreSQL's <a target="_blank" href="http://www.postgresql.org/docs/manuals/">manual</a> is the place to get started with PostgreSQL.</p>
<p><a target="_blank" href="http://www.postgresql.org/">PostgreSQL</a> is an SQL database engine. PostgreSQL's <a target="_blank" href="http://www.postgresql.org/docs/manuals/">manual</a> is the place to get started with PostgreSQL.
</div>
<div class="col-md-3">
<h2><strong>E</strong>xpress</h2>
@@ -44,8 +44,6 @@ describe('User "routes" tests', function() {
.catch(function(err) {
return done(err);
});

done();
});

beforeEach(function(done) {
@@ -36,6 +36,7 @@
"express-session": "^1.11.3",
"file-stream-rotator": "~0.0.6",
"forever": "~0.14.2",
"fs-extra": "^0.26.4",
"generate-password": "^1.1.1",
"glob": "^5.0.13",
"grunt": "0.4.5",

This file was deleted.

0 comments on commit a9a7c48

Please sign in to comment.
You can’t perform that action at this time.