-
Notifications
You must be signed in to change notification settings - Fork 4
/
Jakefile.js
87 lines (60 loc) · 2.08 KB
/
Jakefile.js
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
var builder = require("./build-files/jsbuilder"),
sys = require("sys"),
fs = require("fs"),
util = require("util"),
config = (function(){
var file = fs.readFileSync("./config.json", "utf-8");
var obj = JSON.parse( file );
return Object.freeze( obj );
})()
;
desc( "Default operation" );
task( "default", function(){
var rs = fs.createReadStream("./build-files/help.txt", {encoding: 'utf-8'});
rs.pipe(process.stdout);
} );
desc("Help screen");
task("help",["default"], function(){});
desc( "displays FunctionSack version" );
task("version", function(){
sys.puts( "FunctionSack Source version " +config.version );
sys.puts( "Copyright (c) 2011 David de Rosier. All rights reserved." );
});
desc( "Display module names" );
task( "modules", function(){
console.log( config.modules.join("\n") );
});
desc( "Displays modules and their dependencies" );
task( "dependencies", function(){
Object.keys(config.dependencies).forEach(function(dep){
var deps = builder.getDependentModules(config, dep);
console.log( dep.concat(": \t" + deps.join(", ") ) );
});
});
desc( "Build specified file(s)" );
task( "build", function(file){
var mods = Array.prototype.slice.call(arguments,1).filter(function(module){
if( config.modules.indexOf(module) < 0 ) {
console.log( "Cannot find module: " + module );
return false;
}
return true;
});
mods.sort(function(a,b){
return config.modules.indexOf(a) - config.modules.indexOf(b);
});
file = file.indexOf(".js") > 0 ? file : file+".js";
builder.build( config, mods, file );
});
desc( "Builds all files" );
task( "buildall", function(){
builder.build( config, config.modules, "fnsack-full.js" );
});
desc( "Builds a module (considering the dependencies)" );
task( "buildmod", function(){
Array.prototype.slice.call(arguments).forEach(function(mod){
var mods = builder.getDependentModules(config, mod);
mods.push( mod );
builder.build( config, mods, config.FILE_PREFIX+mod+"-full.js" );
});
});