mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-27 22:49:56 -05:00
using grunt validate for npm test, fixing random jslint errors
This commit is contained in:
parent
a3d2fb7aa9
commit
4a318e9a6a
10 changed files with 23 additions and 23 deletions
|
@ -64,7 +64,7 @@
|
||||||
console.log('user found: ', user);
|
console.log('user found: ', user);
|
||||||
req.session.user = "ghostadmin";
|
req.session.user = "ghostadmin";
|
||||||
res.redirect(req.query.redirect || '/ghost/');
|
res.redirect(req.query.redirect || '/ghost/');
|
||||||
}, function(err) {
|
}, function (err) {
|
||||||
// Do something here to signal the reason for an error
|
// Do something here to signal the reason for an error
|
||||||
console.log(err.stack);
|
console.log(err.stack);
|
||||||
res.redirect('/ghost/login/');
|
res.redirect('/ghost/login/');
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(function() {
|
(function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var _ = require('underscore'),
|
var _ = require('underscore'),
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
* Basic error handling helpers
|
* Basic error handling helpers
|
||||||
*/
|
*/
|
||||||
errors = {
|
errors = {
|
||||||
throwError: function(err) {
|
throwError: function (err) {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,11 +20,11 @@
|
||||||
// Simple bootstraping of the data model for now.
|
// Simple bootstraping of the data model for now.
|
||||||
var migration = require('../data/migration/001');
|
var migration = require('../data/migration/001');
|
||||||
|
|
||||||
migration.down().then(function() {
|
return migration.down().then(function () {
|
||||||
migration.up().then(function () {
|
return migration.up();
|
||||||
console.log('all done....');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
}).then(function () {
|
||||||
|
console.log('all done....');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(function() {
|
(function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var util = require('util'),
|
var util = require('util'),
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(function() {
|
(function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var _ = require('underscore'),
|
var _ = require('underscore'),
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
util.inherits(SettingsProvider, BaseProvider);
|
util.inherits(SettingsProvider, BaseProvider);
|
||||||
|
|
||||||
SettingsProvider.prototype.read = function(_key) {
|
SettingsProvider.prototype.read = function (_key) {
|
||||||
// Allow for just passing the key instead of attributes
|
// Allow for just passing the key instead of attributes
|
||||||
if (_.isString(_key)) {
|
if (_.isString(_key)) {
|
||||||
_key = { key: _key };
|
_key = { key: _key };
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
return BaseProvider.prototype.read.call(this, _key);
|
return BaseProvider.prototype.read.call(this, _key);
|
||||||
};
|
};
|
||||||
|
|
||||||
SettingsProvider.prototype.edit = function(_data) {
|
SettingsProvider.prototype.edit = function (_data) {
|
||||||
return when.all(_.map(_data, function (value, key) {
|
return when.all(_.map(_data, function (value, key) {
|
||||||
return this.model.forge({ key: key }).fetch().then(function (setting) {
|
return this.model.forge({ key: key }).fetch().then(function (setting) {
|
||||||
return setting.set('value', value).save();
|
return setting.set('value', value).save();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(function() {
|
(function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var util = require('util'),
|
var util = require('util'),
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
// Clone the _user so we don't expose the hashed password unnecessarily
|
// Clone the _user so we don't expose the hashed password unnecessarily
|
||||||
userData = _.extend({}, _user);
|
userData = _.extend({}, _user);
|
||||||
|
|
||||||
return nodefn.call(bcrypt.hash, _user.password, 10).then(function(hash) {
|
return nodefn.call(bcrypt.hash, _user.password, 10).then(function (hash) {
|
||||||
userData.password = hash;
|
userData.password = hash;
|
||||||
return BaseProvider.prototype.add.call(self, userData);
|
return BaseProvider.prototype.add.call(self, userData);
|
||||||
});
|
});
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
return this.model.forge({
|
return this.model.forge({
|
||||||
email_address: _userdata.email
|
email_address: _userdata.email
|
||||||
}).fetch().then(function (user) {
|
}).fetch().then(function (user) {
|
||||||
return nodefn.call(bcrypt.compare, _userdata.pw, user.get('password')).then(function(matched) {
|
return nodefn.call(bcrypt.compare, _userdata.pw, user.get('password')).then(function (matched) {
|
||||||
if (!matched) {
|
if (!matched) {
|
||||||
return when.reject(new Error('Password does not match'));
|
return when.reject(new Error('Password does not match'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
DataProvider.prototype.globals.data = [];
|
DataProvider.prototype.globals.data = [];
|
||||||
|
|
||||||
|
|
||||||
DataProvider.prototype.globals.findAll = function() {
|
DataProvider.prototype.globals.findAll = function () {
|
||||||
return when(this.data);
|
return when(this.data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
errors.throwError(toThrow);
|
errors.throwError(toThrow);
|
||||||
};
|
};
|
||||||
|
|
||||||
runThrowError.should.throw("test1");
|
runThrowError.should['throw']("test1");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("throws error strings", function () {
|
it("throws error strings", function () {
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
errors.throwError(toThrow);
|
errors.throwError(toThrow);
|
||||||
};
|
};
|
||||||
|
|
||||||
runThrowError.should.throw("test2");
|
runThrowError.should['throw']("test2");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("logs errors", function () {
|
it("logs errors", function () {
|
||||||
|
@ -52,7 +52,7 @@
|
||||||
logStub.restore();
|
logStub.restore();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("logs promise errors with custom messages", function(done) {
|
it("logs promise errors with custom messages", function (done) {
|
||||||
var def = when.defer(),
|
var def = when.defer(),
|
||||||
prom = def.promise,
|
prom = def.promise,
|
||||||
logStub = sinon.stub(console, "log");
|
logStub = sinon.stub(console, "log");
|
||||||
|
@ -71,12 +71,12 @@
|
||||||
def.reject();
|
def.reject();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("logs promise errors and redirects", function(done) {
|
it("logs promise errors and redirects", function (done) {
|
||||||
var def = when.defer(),
|
var def = when.defer(),
|
||||||
prom = def.promise,
|
prom = def.promise,
|
||||||
req = null,
|
req = null,
|
||||||
res = {
|
res = {
|
||||||
redirect: function() {
|
redirect: function () {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(function() {
|
(function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// Use 'testing' Ghost config
|
// Use 'testing' Ghost config
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
resetData: function () {
|
resetData: function () {
|
||||||
return migrations.one.down().then(function () {
|
return migrations.one.down().then(function () {
|
||||||
return migrations.one.up();
|
return migrations.one.up();
|
||||||
}, function() {
|
}, function () {
|
||||||
throw new Error("Failed to reset data");
|
throw new Error("Failed to reset data");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node app",
|
"start": "node app",
|
||||||
"test": "mocha core/test/ghost"
|
"test": "grunt validate"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"express": "3.1.x",
|
"express": "3.1.x",
|
||||||
|
|
Loading…
Add table
Reference in a new issue