xmake: A JavaScript make-like Utility
Update This article likely requires a bit of updating to work the the newest version of xmake and xjs. The general ideas are still as described below.
xmake is a make-like utility modeled after Ruby's Rake.
xmake is an xjs package. If you've been following along the xjs saga you can cd xjs; svn up; make install;. If you haven't installed xjs yet, the start of this article will help.
After it is installed you can run xmake from the command line
xmake [-f filename] taskname
If you haven't specified the filename option then xmake looks for a file
named Xmakefile.js which contains any JavaScript you want. This file will likely contain some task definitions
An example Xmakefile.js file:
// defines println
require('helpers');
xmake.task('low', function() {
println('low');
});
xmake.task('mid1', ['low'], function() {
println('mid1');
});
xmake.task('mid2', ['low'], function() {
println('mid2');
});
xmake.task('high', ['mid1', 'mid2'], function() {
println('high');
});
Note the second parameter to xmake.task is an optional list of dependencies.
You can then run a task from the command line. If you are currently in the same directory as the Xmakefile.js file then you can just run.
$ xmake high
low
mid1
mid2
high
$ xmake mid2
low
mid2
If you are in a different directory than the Xmakefile.js file or the file defining the tasks is named something different than Xmakefile.js then you can pass an option to the xmake utility
$ xmake -f path/to/taskfile.js taskname
The name xmake isn't exactly a thriller so if you can think of a better name please comment and it can be changed before we're stuck with xmake.
Comments
Have something to write? Comment on this article.
How about xake, pronounced shake?
'jake' and 'scrake' are my faves...
The name doesn't necessarily need to match /^[A-Za-z]+ake$/.
Have something to write? Comment on this article.
feed
Looks pretty cool :)
What about jake ? (I've always love giving first names to programs, and in this case, it works out pretty well)