index.coffee 393 B

12345678910111213
  1. fs = require 'fs'
  2. path = require 'path'
  3. module.exports = (robot, scripts) ->
  4. scriptsPath = path.resolve(__dirname, 'src')
  5. fs.exists scriptsPath, (exists) ->
  6. if exists
  7. for script in fs.readdirSync(scriptsPath)
  8. if scripts? and '*' not in scripts
  9. robot.loadFile(scriptsPath, script) if script in scripts
  10. else
  11. robot.loadFile(scriptsPath, script)