Created
February 11, 2012 21:53
-
-
Save topfunky/1804467 to your computer and use it in GitHub Desktop.
Run tasks sequentially in a Cakefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task 'sample_task', sample_task = (callback) -> | |
doSomethingAndRunCallbackAfter callback | |
task 'setup', 'All: Import all data and run webserver', -> | |
tasks = [install, pre_populate, populate_couch, graph_sync, server] | |
runSequentially = (currentTask, otherTasks...) -> | |
currentTask -> | |
if otherTasks.length | |
runSequentially otherTasks... | |
runSequentially tasks... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
All the tasks (install, pre_populate, etc.) are implemented as named functions as arguments to "task" and take a callback that will be executed after they complete.
I like the Lisp-style way of using a splat to get the first and next tasks.