-
Notifications
You must be signed in to change notification settings - Fork 6
/
Jakefile.coffee
30 lines (28 loc) · 993 Bytes
/
Jakefile.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
###
add current path to requires in first order
###
require.paths.unshift __dirname
###
require some modules
###
FS = require 'fs'
FS.basename = require( 'path' ).basename
FS.readdirSync( "scripts/jake" ).map (pth)->
pthstat = FS.statSync "scripts/jake/#{pth}"
tasks = {}
if pthstat.isDirectory()
tasks[pth] ||= []
FS.readdirSync( "scripts/jake/#{pth}" ).map (filename)->
try
def = require "scripts/jake/#{pth}/#{filename}"
catch E
def =
desc: "Show what when wrong when loading this task."
task: ()-> console.log( E )
def.name = FS.basename filename, '.coffee'
tasks[pth].push def
for ns, set of tasks
namespace ns, ->
set.forEach (def)->
desc( def.desc || 'No description provided' )
task def.name, def.deps||[], def.task|| ()-> console.log( 'No task provided' )