Skip to content

Commit

Permalink
changes for run-auto@2
Browse files Browse the repository at this point in the history
  • Loading branch information
feross committed Jul 14, 2016
1 parent 43b5cde commit d2fa216
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions bin/postbuild.js
Expand Up @@ -40,13 +40,13 @@ auto({
},

// Copy the JS file to a file with a unique name, based on the MD5
jsRename: ['MD5_JS', 'removeOldJS', function (cb, r) {
jsRename: ['MD5_JS', 'removeOldJS', function (r, cb) {
var src = config.out + '/main.js'
var dest = config.out + '/main-' + r.MD5_JS + '.js'
cp.exec('cp ' + src + ' ' + dest, cb)
}],

cssRename: ['MD5_CSS', 'removeOldCSS', function (cb, r) {
cssRename: ['MD5_CSS', 'removeOldCSS', function (r, cb) {
var src = config.out + '/main.css'
var dest = config.out + '/main-' + r.MD5_CSS + '.css'
cp.exec('cp ' + src + ' ' + dest, cb)
Expand Down
2 changes: 1 addition & 1 deletion lib/pro.js
Expand Up @@ -43,7 +43,7 @@ exports.checkPro = function (req, res, next) {
.exec(cb)
},

linkOrderToUser: ['order', function (cb, r) {
linkOrderToUser: ['order', function (r, cb) {
console.log(r)
r.order.user = req.user.id
r.order.save(cb)
Expand Down
4 changes: 2 additions & 2 deletions liveupdater/index.js
Expand Up @@ -130,10 +130,10 @@ LiveUpdater.prototype.getTotalHits = function (cb) {
.select('hits -_id')
.exec(cb)
}
}), function (err, results) {
}), function (err, r) {
if (err) return cb(err)

self.totalHits = results.reduce(function (acc, docs) {
self.totalHits = r.reduce(function (acc, docs) {
return acc + docs.reduce(function (acc2, doc) {
return acc2 + (doc.hits || 0)
}, 0)
Expand Down
20 changes: 10 additions & 10 deletions routes/college.js
Expand Up @@ -21,13 +21,13 @@ module.exports = function (app) {
collegeCount: function (cb) {
model.College.count().exec(cb)
}
}, function (err, results) {
}, function (err, r) {
if (err) return next(err)

res.render('essays', {
collegeCount: results.collegeCount,
essays: results.essays,
title: 'College Essays - Top ' + results.essays.length + ' Essays That Worked',
collegeCount: r.collegeCount,
essays: r.essays,
title: 'College Essays - Top ' + r.essays.length + ' Essays That Worked',
forceTitle: true,
url: '/essays/',
hero: {
Expand Down Expand Up @@ -75,8 +75,8 @@ module.exports = function (app) {
.sort('-hits')
.exec(cb)
}
}, function (err, results) {
var essays = results.essays
}, function (err, r) {
var essays = r.essays
if (err) return next(err)

res.render('college-about', {
Expand Down Expand Up @@ -104,15 +104,15 @@ module.exports = function (app) {
.populate('user')
.exec(cb)
},
populateColleges: ['essays', function (cb, results) {
parallel(results.essays.map(function (essay) {
populateColleges: ['essays', function (r, cb) {
parallel(r.essays.map(function (essay) {
return function (cb) {
essay.user.populate('college', cb)
}
}), cb)
}]
}, function (err, results) {
var essays = results.essays
}, function (err, r) {
var essays = r.essays
if (err) return next(err)

res.render('college', {
Expand Down
4 changes: 2 additions & 2 deletions routes/essay.js
Expand Up @@ -20,8 +20,8 @@ module.exports = function (app) {
.populate('user')
.exec(cb)
},
populateCollege: ['essay', function (cb, results) {
var user = results.essay && results.essay.user
populateCollege: ['essay', function (r, cb) {
var user = r.essay && r.essay.user
if (user) {
user.populate('college', cb)
} else {
Expand Down
6 changes: 3 additions & 3 deletions routes/notetype.js
Expand Up @@ -46,10 +46,10 @@ module.exports = function (app) {
}
})
}
}, function (err, results) {
}, function (err, r) {
if (err) return next(err)
var notes = results.notes
var courseNotetype = results.courseNotetype
var notes = r.notes
var courseNotetype = r.courseNotetype

if (notetype.hasChapters) {
notes.sort(sort.sortChapters)
Expand Down
2 changes: 1 addition & 1 deletion routes/order.js
Expand Up @@ -26,7 +26,7 @@ module.exports = function (app) {
}, cb)
},

order: ['stripeCharge', function (cb, r) {
order: ['stripeCharge', function (r, cb) {
var order = new model.Order({
stripeEmail: email,
stripeToken: req.body.id,
Expand Down
8 changes: 4 additions & 4 deletions routes/submit.js
Expand Up @@ -41,7 +41,7 @@ module.exports = function (app) {
cb(null, new model.Essay())
}
},
permission: ['essay', function (cb, r) {
permission: ['essay', function (r, cb) {
if (!r.essay) return cb(new Error('No essay with id ' + req.body._id))

if (!r.essay.user || // new note, no permission needed
Expand All @@ -52,7 +52,7 @@ module.exports = function (app) {
cb(new Error('Cannot edit another user\'s essay'))
}
}],
save: ['permission', function (cb, r) {
save: ['permission', function (r, cb) {
var essay = r.essay

essay.name = req.body.name
Expand Down Expand Up @@ -125,7 +125,7 @@ module.exports = function (app) {
cb(null, new model.Note())
}
},
permission: ['note', function (cb, r) {
permission: ['note', function (r, cb) {
if (!r.note) return cb(new Error('No note with id ' + req.body._id))

if (!r.note.user || // new note, no permission needed
Expand All @@ -136,7 +136,7 @@ module.exports = function (app) {
cb(new Error('Cannot edit another user\'s note'))
}
}],
save: ['permission', function (cb, r) {
save: ['permission', function (r, cb) {
var note = r.note

note.name = req.body.name
Expand Down

0 comments on commit d2fa216

Please sign in to comment.