grunt-recurse
Version:
Helpers to load and use recursive Gruntfiles.
39 lines (32 loc) • 1.2 kB
text/coffeescript
Path = require 'path'
module.exports = (grunt, root)->
grunt.pkg = grunt.file.readJSON('package.json')
grunt.grunt = (path)->
other = require Path.join root, path, 'Gruntfile'
other(grunt)
Object.defineProperty grunt, 'Config', do->
_config = {}
get: -> _config
set: (val)->
for t, c of val
if typeof c is 'object'
_config[t] = _config[t] || {}
for k, v of c
_config[t][k] = v
else
_config[t] = c
grunt
Object.defineProperty grunt, 'NpmTasks', do->
_tasks = []
get: -> _tasks
set: (val)->
_tasks = _tasks.concat val
grunt.finalize = ->
grunt.initConfig grunt.Config
pattern = ['grunt-*', '!grunt-recurse']
require('load-grunt-tasks')(grunt, {pattern})
grunt.loadNpmTasks task for task in grunt.NpmTasks