Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

Commit

Permalink
Adjusted glob (#228)
Browse files Browse the repository at this point in the history
Adjusted the glob pattern to search recursive and already search for the _codemap.js file.

This made the following function a lot simpler as glob does al the work for us.

With this change the structure inside the \extensions\ folder does not matter anymore.
  • Loading branch information
Fjuxx authored and DeviaVir committed Jun 6, 2017
1 parent 5238e77 commit aacfb1e
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@ module.exports = function (cb) {
zenbot.set('@zenbot:conf', c)

function withMongo () {
glob('extensions/*', {cwd: __dirname, absolute: true}, function (err, results) {
//searches all directorys in {workingdir}/extensions/ for files called '_codemap.js'
glob('extensions/**/_codemap.js', {cwd: __dirname, absolute: true}, function (err, results) {
if (err) return cb(err)
results.forEach(function (result) {
if (path.basename(result) === 'README.md') {
return
}
var ext = require(path.join(result, '_codemap'))
zenbot.use(ext)
var ext = require(result) //load the _codemap for the extension
zenbot.use(ext) //load the extension into zenbot
})
cb(null, zenbot)
})
Expand Down

0 comments on commit aacfb1e

Please sign in to comment.