13 строки
404 B
CoffeeScript
13 строки
404 B
CoffeeScript
fs = require 'fs'
|
|
path = require 'path'
|
|
|
|
module.exports = (robot, scripts) ->
|
|
scriptsPath = path.resolve(__dirname, 'src', 'scripts')
|
|
fs.exists scriptsPath, (exists) ->
|
|
if exists
|
|
for script in fs.readdirSync(scriptsPath)
|
|
if scripts? and '*' not in scripts
|
|
robot.loadFile(scriptsPath, script) if script in scripts
|
|
else
|
|
robot.loadFile(scriptsPath, script)
|