{"_id":"sake","_rev":"102-432844c154661165aa48ce4eaf6eca5e","name":"sake","description":"[S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.","dist-tags":{"latest":"0.1.32"},"versions":{"0.0.1":{"name":"sake","description":"A Rake-like application for managing builds and for Stitching JavaScript, CSS, HTML, and other sundry files together for web development.","version":"0.0.1","keywords":["packager","css","javascript","html","web","development"],"main":"./lib/app.js","bin":{"sake":"./bin/sake"},"directories":{"lib":"lib"},"dependencies":{"proteus":">=0.0.7","nomnom":">=1.5.1","glob":">=2.1.0"},"devDependencies":{"expresso":"0.9.2","should":"*"},"licenses":[{"type":"MIT","url":"http://github.com/jhamlet/sake-node/raw/master/LICENSE"}],"repository":{"type":"git","url":"git://github.com/jhamlet/sake-node.git"},"engines":{"node":">= 0.5.9"},"preferGlobal":true,"_npmUser":{"name":"jhamlet","email":"jerry@hamletink.com"},"_id":"sake@0.0.1","contributors":[{"name":"Jerry Hamlet","email":"jerry@hamletink.com","url":"http://hamletink.com/"}],"_engineSupported":true,"_npmVersion":"1.1.0-alpha-2","_nodeVersion":"v0.6.3","_defaultsLoaded":true,"dist":{"shasum":"885aa4d1e6a61063e2f4ba4204836fe42b778985","tarball":"https://registry.npmjs.org/sake/-/sake-0.0.1.tgz","integrity":"sha512-jSxzboPupCw5Cdy4eLyqhK2Ww9yC1M8gRppFWz9UlbUKwvSjb0uNP+5aUv6xiPhG5cNeH23tZ1kbl0RVmMKwOw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBRRmKBb05AAlEl5WRGW+cVBYnU8PApInVTiO9K4WlKoAiEA5fnWqe/B+YIZInkE1L9bOsK6qPzHDdrIcCIp1fX9va8="}]},"maintainers":[{"name":"jhamlet","email":"jerry@hamletink.com"}],"deprecated":"New api in v0.1.0"},"0.0.2":{"name":"sake","description":"A Rake-like application for managing builds and for Stitching JavaScript, CSS, HTML, and other sundry files together for web development.","version":"0.0.2","keywords":["packager","css","javascript","html","web","development"],"main":"./lib/app.js","bin":{"sake":"./bin/sake"},"directories":{"lib":"lib"},"dependencies":{"proteus":">=0.0.7","nomnom":">=1.5.1","glob":">=2.1.0"},"devDependencies":{"should":"*"},"licenses":[{"type":"MIT","url":"http://github.com/jhamlet/sake-node/raw/master/LICENSE"}],"repository":{"type":"git","url":"git://github.com/jhamlet/sake-node.git"},"engines":{"node":">= 0.5.9"},"preferGlobal":true,"_npmUser":{"name":"jhamlet","email":"jerry@hamletink.com"},"_id":"sake@0.0.2","contributors":[{"name":"Jerry Hamlet","email":"jerry@hamletink.com","url":"http://hamletink.com/"}],"optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.12","_nodeVersion":"v0.6.10","_defaultsLoaded":true,"dist":{"shasum":"4d403916c7dab63f7bca3c8e32ffb2f5aa1b4507","tarball":"https://registry.npmjs.org/sake/-/sake-0.0.2.tgz","integrity":"sha512-JjBS334lbVCbh17Pb+oPk3Fq7i7TdkRzRQZr+RNA04aYrU6e48H+dnwlanbuREdjB+qFzVJkYK3oLykbRi+FTQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAaWrKrD5Imqmg90GrL3r4DrMMVBM5hSTJUtZ4TzY4cmAiA/Qq9kqp/E4m0x0G+K1jnXgp9aPkKiBXw7s4GAwgKcAA=="}]},"readme":"SAKÉ\n====\n\n**S**[titch from R]**ake**\n\nThis package contains **Saké**, a JavaScript build program that runs in node with capabilities similar to ruby's Rake, and with some extra **Stitch** tasks for building JavaScript, CSS, HTML, and other sundry files for web development.\n\nSaké has the following features:\n\n1.  Sakefiles (Saké’s version of Rakefiles) are completely defined in standard JavaScript (or CoffeeScript, for those who want an even more Rake-like feel).\n2.  Flexible FileLists that act like arrays but know about manipulating file names and paths.\n3.  Standard `clean` and `clobber` tasks\n4.  Handling of *Synchronous* and *Asynchronous* tasks.\n5.  Many utility methods for handling common build tasks (rm, rm_rf, mkdir, mkdir_p, sh, cat, etc...)\n6.  **Stitch** a set of utility methods that help build packages of JavaScript, CSS, HTML, etc...\n\n\nInstallation\n------------\n\n### Install with npm\n\nDownload and install with the following:\n\n    npm install -g sake\n\n\nSaké Command-Line Usage\n-----------------------\n\n~~~\n% sake [options] [task ...] [env=variable ...]\n~~~\n\n**Saké** will look within the current directory, and all parent directories, for the first `/^[sS]akefile(\\.(js|coffee))?$/` it can find, run that file, and then invoke the task passed on the command-line. If no task is given, it will try to invoke the task named `default`.\n\nIf additional arguments in the form of `[VARIABLE_NAME]=[VALUE]` are given on the command-line, **Saké** will set an environment variable `VARIABLE_NAME` with its value the JSON parsed value of `VALUE` (or a plain string, if it fails to JSON parse cleanly). These will then be accessible through the node's `process.env[ironment]` namespace.\n\n### Sake Command-Line Options\n\n~~~\n-f, --sakefile PATH      Specify PATH to Sakefile to run instead of searching for one.\n-T, --tasks              List tasks with descriptions and exit.\n-P, --prerequisites      List tasks and their prerequisites and exit.\n-d, --debug              Enable additional debugging output.\n-v, --verbose            Log messages to standard output.\n-V, --version            Print the version of sake and exit.\n-h, --help               Print this help information and exit.\n~~~\n\n### Stitch Specific Options ###\n\n~~~\n-o, --outfile PATH       Save Stitch output to file PATH.\n-F, --force              If outputing to a file, overwrite any existing file.\n-N, --no-minify          Set Stitch minification flag to false.\n--stitch-temp-dir PATH   Directory to use for temporary files\n~~~\n\n\nSakefile Usage\n--------------\n\nWithin a `Sakefile`, Saké's methods are exported to the global scope, so you can invoke them directly:\n\n~~~js\ntask(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n});\n~~~\n    \nor, the equivalent in a `Sakefile.coffee`:\n\n~~~js\ntask \"taskname\", [\"prereq1\", \"prereq2\"], (t)->\n    // task action...\n~~~\n\nWithin another node module you can `require(\"sake\")` and access the methods on the exported object:\n\n~~~js\nvar sake = require(\"sake\");\n    \nsake.task(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n});\n~~~\n\nThe remainder of this documentation will assume that we are calling the methods from within a `Sakefile`.\n\n\nDefining Tasks\n--------------\n\nThe various task methods take one, or more, of the following arguments:\n\n1.   `taskname`: `string` -- naming the task\n2.   `prerequisites`: an _optional_ `array` of `string` task names, `FileLists`, or `functions` that return a task name, an `array`, or a `FileList`. You can also pass a `FileList` in directly for `prerequisites`.\n3.   `action`: an _optional_ `function` that will be called when the task is invoked.\n\nAll task methods return the task *instance*.\n\nIf a task is already defined, it will be augmented by the additional arguments. So, this:\n\n~~~js\ntask(\"one\", [\"othertask\"], function (t) {\n    // do action one...\n});\n\ntask(\"one\", function (t) {\n    // do action two...\n});\n\ntask(\"othertask\");\n~~~\n\nWould result in a task \"othertask\" with no prerequisites, and no action, and a task \"one\" with \"othertask\" as a prerequisite and the two functions as its actions.\n\n**Note** how the dependent task was defined *after* it was required as a prerequisite. Task prerequisites are not resolved until the task is invoked. This leads to flexibility in how to compose your tasks and prerequisite tasks.\n\n### File Tasks\n\nFile tasks are created with the (appropriately named) `file` method. File tasks, however, are only triggered if the file doesn't exist, or the modification time of any of its prerequisites is newer than itself.\n\n~~~js\nfile(\"path/to/some/file\", function (t) {\n    cp(\"other/path\", t.name);\n});\n~~~\n\nThe above task would only be triggered if `path/to/some/file` did not exist.\n\nThe following:\n\n~~~js\nfile(\"combined/file/path\", [\"pathA\", \"pathB\", \"pathC\"], function (t) {\n    write(t.name, cat(t.prerequisites), \"utf8\");\n});\n~~~\n\nwould be triggered if `path/to/some/file` did not exist, or its modification time was earlier than any of its prerequisites (`pathA`, `pathB`, or  `pathC`).\n\n\n### Directory Tasks\n\nDirectory tasks, created with the `directory` method, are tasks that will only be called if they do not exist. A task will be created for the named directory (and for all directories along the way) with the action of creating the directory.\n\nDirectory tasks do not take any `prerequisites` or an `action` when first defined, however, they may be augmented with such after they are created:\n\n~~~js\ndirectory(\"dir/path/to/create\");\n\ntask(\"dir/path/to/create\", [\"othertask\"], action (t) {\n    //... do stuff\n});\n~~~\n\n\n### File Create Tasks\n\nA file create task is a file task, that when used as a prerequisite, will be needed if, and only if, the file has not been created. Once created, it is not re-triggered if any of its prerequisites are newer, nor does it trigger any rebuilds of tasks that depend on it whenever the file is updated.\n\n~~~js\nfileCreate(\"file/path/to/create.ext\", [\"pathA\", \"pathB\"], function (t) {\n    // create file...\n});\n~~~\n\n\n(A)Synchronicity and Tasks\n--------------------------\n\nIn Saké all task actions are assumed to be *synchronous*. However, many things in node require *asynchronous* callbacks. You can indicate that a task action is asynchronous by calling the tasks's, or the global `Task` class', `startAsyc` method when starting the task action, and the `clearAsync` method when it is complete. i.e:\n\n~~~js\ntask(\"asynctask\", function (t) {\n    t.startAsync(); // or, Task.startAsync()\n    sh(\"some long running shell command\", function (err, stdout, stderr) {\n        // do stuff...\n        t.clearAsync(); // or, Task.clearAsync()\n    });\n});\n~~~\n\nAlternatively, you can use the `atask` method to add an *asynchronous* task action. This will automatically set the async flag for that action. However, your task must still clear it when it is done. i.e:\n\n~~~js\natask(\"longtask\", function (t) {\n    sh(\"some long running shell command\", function (err, stdout, stderr) {\n        t.clearAsync(); // or, Task.clearAsync()\n    });\n});\n~~~\n\n\nFile Lists\n----------\n\nFileLists are lists (an `Array`) of files.\n\n~~~js\nnew FileList(\"*.scss\");\n~~~\n\nWould contain all the files with a \".scss\" extension in the top-level directory of your project.\n\nYou can use FileLists pretty much like an `Array`. You can iterate them (with `forEach, filter, reduce`, etc...), `concat` them, `splice` them, and you get back a new FileList object.\n\nTo add files, or glob patterns to them, use the `#include` method:\n\n~~~js\nvar fl = new FileList(\"*.scss\");\nfl.include(\"core.css\", \"reset.css\", \"*.css\");\n~~~\n\nYou can also `exlucude` files by Glob pattern, `Regular Expression` pattern, or by use of a `function` that takes the file path as an argument and returns a `truthy` value to exclude a file.\n\n~~~js\n// Exclude by RegExp\nfl.exclude(/^dev-.*\\.css/);\n\n// Exclude by Glob pattern\nfl.exclude(\"dev-*.css\");\n\n// Exclude by function\nfl.exclude(function (path) {\n    return FS.statSync(path).mtime.getTime() < (Date.now() - 60 * 60 * 1000);\n});\n~~~\n\nTo get to the actual items of the FileList, use the `#items` property, or the `#toArray` method, to get a plain array back. You can also use the `#get` or `#set` methods to retrieve or set an item.\n\nFileLists are *lazy*, in that the actual file paths are not determined from the include and exclude patterns until the individual items are requested. This allows you to define a FileList and incrementally add patterns to it in the Sakefile file. The FileList paths will not be resolved until the task that uses it as a prerequisite actually asks for the final paths.\n\n### FileList Utility Properties & Methods\n\n#### FileList#existing\n\nWill return a new `FileList` with all of the files that actually exist.\n\n#### FileList#notExisting\n\nWill return a new `FileList` all of the files that do not exist.\n\n#### FileList#extension(ext)\n\nReturns a new `FileList` with all paths that match the given extension.\n\n~~~js\nfl.extension(\".scss\").forEach(function (path) {\n    //...\n});\n~~~\n\n#### FileList#grep(pattern)\n\nGet a `FileList` of all the files that match the given `pattern`. `pattern` can be a plain `String`, a `Glob` pattern, a `RegExp`, or a `function`.\n\n#### FileList#clearExcludes()\n\nClear all exclude patterns/functions.\n\n#### FileList#clearIncludes()\n\nClear all include patterns.\n\n#### FileList#add()\n\nAlias for `#include`\n\n\nSaké Utility Functions\n----------------------\n\nSaké defines a few utility functions to make life a little easier in an asynchronous world. Most of these are just wrappers for `node`'s File System (`require(\"fs\")`) utility methods.\n\n### mkdir(dirpath, mode=\"755\")\n### mkdir_p(dirpath, mode=\"755\"])\n\nCreate the `dirpath` directory, if it doesn't already exist. `mkdir_p` will create all intermediate directories as needed.\n    \n### rm(path, [path1, ..., pathN])\n### rm_rf(path, [path1, ..., pathN])\n\nRemove one or more paths from the file system. `rm_rf` will remove directories and their contents.\n    \n### cp(from, to)\n\nCopy a file from `from` path to `to` path.\n    \n### mv(from, to)\n\nMove a file from `from` path to `to` path.\n    \n### ln(from, to)\n\nCreate a hard link from `from` path to `to` path.\n    \n### ln_s(from, to)\n\nCreate a symlink from `from` path to `to` path.\n    \n### cat(path, [path1, ..., pathN])\n\nSynchronously read all supplied paths and return their contents as a string. If an argument is an `Array` it will be expanded and those paths will be read.\n    \n### read(path, [enc])\n\nSynchronously read the supplied file path. Returns a `buffer`, or a `string` if `enc` is given.\n    \n### write(path, data, [enc], mode=\"w\")\n\nSynchronously write the `data` to the supplied file `path`. `data` should be a `buffer` or a `string` if `enc` is given. `mode` is a `string` of either \"w\", for over write,  or \"a\" for append.\n\n### sh(cmd, success, [failure])\n\nExecute shell `cmd`. On success the `success` handler will be called, on error, the `failure` function.\n\nThis method is *asynchronous*, and if used in a task, one should call `Task.startAsync` or the `task#startAsync` to indicate that the task is asynchronous. Clear the *asynchronous* flag by calling `Task.clearAsync`, or the `task#clearAsync` method in the `success` or `failure` handler.\n\n\nStitch Usage\n------------\n\n`stitch` provides various methods and core tasks to help define tasks that enable bundling of resources for web-development. (It's also where the **S** in **S**aké comes from.)\n\n### stitch([namespace], function)\n\nDefine a stitch configuration. If `namespace` is omitted, it defaults to \"default\".\n\nThe first argument to the `function` will be a reference to the current `stitch` driver; in addition, the `this` context of the function will be set to the stitch configuration driver.\n\n~~~js\nstitch.aliasType(\"text/stylesheet\", \"scss\");\n\nstitch(function (cfg) {\n    cfg.bundle(\"core\", function (core) {\n        core.javascript(function () {\n            core.add(\"src/js/core.js\");\n        });\n        \n        core.stylesheet(function () {\n            this.add(\"src/css/core.scss\");\n            this.add(\"src/css/reset.scss\");\n        });\n    });\n    \n    this.bundle(\"sub-module\", function (sub) {\n        sub.include(\"core\");\n        \n        this.js(\"src/js/sub-module.js\");\n        this.scss(\"src/css/sub-module.scss\");\n    });\n});\n~~~\n\nor the equivalent *CoffeeScript*:\n\n~~~js\nstitch.aliasType \"text/stylesheet\", \"scss\"\n\nstitch (cfg)->\n    cfg.bundle \"core\", (core)->\n        core.javascript ->\n            core.add \"src/js/core.js\"\n        \n        core.stylesheet ->\n            @add \"src/css/core.scss\"\n            @add \"src/css/reset.scss\"\n        \n    @bundle \"sub-module\", (sub)->\n        sub.include \"core\"\n        \n        @js \"src/js/sub-module.js\"\n        @scss \"src/css/sub-module.scss\"\n~~~\n\n### Types\n\n### Bundles\n\n","maintainers":[{"name":"jhamlet","email":"jerry@hamletink.com"}],"deprecated":"New api in v0.1.0"},"0.0.3":{"name":"sake","description":"A Rake-like application for managing builds and for Stitching JavaScript, CSS, HTML, and other sundry files together for web development.","version":"0.0.3","keywords":["packager","css","javascript","html","web","development"],"main":"./lib/app.js","bin":{"sake":"./bin/sake"},"directories":{"lib":"lib"},"dependencies":{"proteus":">=0.0.7","nomnom":">=1.5.1","glob":">=2.1.0"},"devDependencies":{"should":"*"},"licenses":[{"type":"MIT","url":"http://github.com/jhamlet/sake-node/raw/master/LICENSE"}],"repository":{"type":"git","url":"git://github.com/jhamlet/sake-node.git"},"engines":{"node":">= 0.5.9"},"preferGlobal":true,"_npmUser":{"name":"jhamlet","email":"jerry@hamletink.com"},"_id":"sake@0.0.3","contributors":[{"name":"Jerry Hamlet","email":"jerry@hamletink.com","url":"http://hamletink.com/"}],"optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.12","_nodeVersion":"v0.6.10","_defaultsLoaded":true,"dist":{"shasum":"f5d984ab85a974899db9c86c8489e417982b468b","tarball":"https://registry.npmjs.org/sake/-/sake-0.0.3.tgz","integrity":"sha512-efgb61N98SWDYeYEaEz/rRDsa9iHO9/OPM75NX73Kf2AU76n576/yjL8MJu7p9jUolymHjdyO6FwyO21Un0ttw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAce+Ev1cm+j604LccoDJZofkyzc4WWkjdkV/nSeai4cAiEAz1IrgkUpYOSuoUGOZ5DimFly8XweQvuSu27bbUO+IQk="}]},"readme":"SAKÉ\n====\n\n**S**[titch from R]**ake**\n\nThis package contains **Saké**, a JavaScript build program that runs in node with capabilities similar to ruby's Rake, and with some extra **Stitch** tasks for building JavaScript, CSS, HTML, and other sundry files for web development.\n\nSaké has the following features:\n\n1.  Sakefiles (Saké’s version of Rakefiles) are completely defined in standard JavaScript (or CoffeeScript, for those who want an even more Rake-like feel).\n2.  Flexible FileLists that act like arrays but know about manipulating file names and paths.\n3.  Standard `clean` and `clobber` tasks\n4.  Handling of *Synchronous* and *Asynchronous* tasks.\n5.  Many utility methods for handling common build tasks (rm, rm_rf, mkdir, mkdir_p, sh, cat, etc...)\n6.  **Stitch** a set of utility methods that help build packages of JavaScript, CSS, HTML, etc...\n\n\nInstallation\n------------\n\n### Install with npm\n\nDownload and install with the following:\n\n    npm install -g sake\n\n\nSaké Command-Line Usage\n-----------------------\n\n~~~\n% sake [options] [task ...] [env=variable ...]\n~~~\n\n**Saké** will look within the current directory, and all parent directories, for the first `/^[sS]akefile(\\.(js|coffee))?$/` it can find, run that file, and then invoke the task passed on the command-line. If no task is given, it will try to invoke the task named `default`.\n\nIf additional arguments in the form of `[VARIABLE_NAME]=[VALUE]` are given on the command-line, **Saké** will set an environment variable `VARIABLE_NAME` with its value the JSON parsed value of `VALUE` (or a plain string, if it fails to JSON parse cleanly). These will then be accessible through the node's `process.env[ironment]` namespace.\n\n### Sake Command-Line Options\n\n~~~\n-f, --sakefile PATH      Specify PATH to Sakefile to run instead of searching for one.\n-T, --tasks              List tasks with descriptions and exit.\n-P, --prerequisites      List tasks and their prerequisites and exit.\n-d, --debug              Enable additional debugging output.\n-v, --verbose            Log messages to standard output.\n-V, --version            Print the version of sake and exit.\n-h, --help               Print this help information and exit.\n~~~\n\n### Stitch Specific Options ###\n\n~~~\n-o, --outfile PATH       Save Stitch output to file PATH.\n-F, --force              If outputing to a file, overwrite any existing file.\n-N, --no-minify          Set Stitch minification flag to false.\n--stitch-temp-dir PATH   Directory to use for temporary files\n~~~\n\n\nSakefile Usage\n--------------\n\nWithin a `Sakefile`, Saké's methods are exported to the global scope, so you can invoke them directly:\n\n~~~js\ntask(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n});\n~~~\n    \nor, the equivalent in a `Sakefile.coffee`:\n\n~~~js\ntask \"taskname\", [\"prereq1\", \"prereq2\"], (t)->\n    // task action...\n~~~\n\nWithin another node module you can `require(\"sake\")` and access the methods on the exported object:\n\n~~~js\nvar sake = require(\"sake\");\n    \nsake.task(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n});\n~~~\n\nThe remainder of this documentation will assume that we are calling the methods from within a `Sakefile`.\n\n\nDefining Tasks\n--------------\n\nThe various task methods take one, or more, of the following arguments:\n\n1.   `taskname`: `string` -- naming the task\n2.   `prerequisites`: an _optional_ `array` of `string` task names, `FileLists`, or `functions` that return a task name, an `array`, or a `FileList`. You can also pass a `FileList` in directly for `prerequisites`.\n3.   `action`: an _optional_ `function` that will be called when the task is invoked.\n\nAll task methods return the task *instance*.\n\nIf a task is already defined, it will be augmented by the additional arguments. So, this:\n\n~~~js\ntask(\"one\", [\"othertask\"], function (t) {\n    // do action one...\n});\n\ntask(\"one\", function (t) {\n    // do action two...\n});\n\ntask(\"othertask\");\n~~~\n\nWould result in a task \"othertask\" with no prerequisites, and no action, and a task \"one\" with \"othertask\" as a prerequisite and the two functions as its actions.\n\n**Note** how the dependent task was defined *after* it was required as a prerequisite. Task prerequisites are not resolved until the task is invoked. This leads to flexibility in how to compose your tasks and prerequisite tasks.\n\n### File Tasks\n\nFile tasks are created with the (appropriately named) `file` method. File tasks, however, are only triggered if the file doesn't exist, or the modification time of any of its prerequisites is newer than itself.\n\n~~~js\nfile(\"path/to/some/file\", function (t) {\n    cp(\"other/path\", t.name);\n});\n~~~\n\nThe above task would only be triggered if `path/to/some/file` did not exist.\n\nThe following:\n\n~~~js\nfile(\"combined/file/path\", [\"pathA\", \"pathB\", \"pathC\"], function (t) {\n    write(t.name, cat(t.prerequisites), \"utf8\");\n});\n~~~\n\nwould be triggered if `path/to/some/file` did not exist, or its modification time was earlier than any of its prerequisites (`pathA`, `pathB`, or  `pathC`).\n\n\n### Directory Tasks\n\nDirectory tasks, created with the `directory` method, are tasks that will only be called if they do not exist. A task will be created for the named directory (and for all directories along the way) with the action of creating the directory.\n\nDirectory tasks do not take any `prerequisites` or an `action` when first defined, however, they may be augmented with such after they are created:\n\n~~~js\ndirectory(\"dir/path/to/create\");\n\ntask(\"dir/path/to/create\", [\"othertask\"], action (t) {\n    //... do stuff\n});\n~~~\n\n\n### File Create Tasks\n\nA file create task is a file task, that when used as a prerequisite, will be needed if, and only if, the file has not been created. Once created, it is not re-triggered if any of its prerequisites are newer, nor does it trigger any rebuilds of tasks that depend on it whenever the file is updated.\n\n~~~js\nfileCreate(\"file/path/to/create.ext\", [\"pathA\", \"pathB\"], function (t) {\n    // create file...\n});\n~~~\n\n\n(A)Synchronicity and Tasks\n--------------------------\n\nIn Saké all task actions are assumed to be *synchronous*. However, many things in node require *asynchronous* callbacks. You can indicate that a task action is asynchronous by calling the tasks's, or the global `Task` class', `startAsyc` method when starting the task action, and the `clearAsync` method when it is complete. i.e:\n\n~~~js\ntask(\"asynctask\", function (t) {\n    t.startAsync(); // or, Task.startAsync()\n    sh(\"some long running shell command\", function (err, stdout, stderr) {\n        // do stuff...\n        t.clearAsync(); // or, Task.clearAsync()\n    });\n});\n~~~\n\nAlternatively, you can use the `atask` method to add an *asynchronous* task action. This will automatically set the async flag for that action. However, your task must still clear it when it is done. i.e:\n\n~~~js\natask(\"longtask\", function (t) {\n    sh(\"some long running shell command\", function (err, stdout, stderr) {\n        t.clearAsync(); // or, Task.clearAsync()\n    });\n});\n~~~\n\n\nFile Lists\n----------\n\nFileLists are lists (an `Array`) of files.\n\n~~~js\nnew FileList(\"*.scss\");\n~~~\n\nWould contain all the files with a \".scss\" extension in the top-level directory of your project.\n\nYou can use FileLists pretty much like an `Array`. You can iterate them (with `forEach, filter, reduce`, etc...), `concat` them, `splice` them, and you get back a new FileList object.\n\nTo add files, or glob patterns to them, use the `#include` method:\n\n~~~js\nvar fl = new FileList(\"*.scss\");\nfl.include(\"core.css\", \"reset.css\", \"*.css\");\n~~~\n\nYou can also `exlucude` files by Glob pattern, `Regular Expression` pattern, or by use of a `function` that takes the file path as an argument and returns a `truthy` value to exclude a file.\n\n~~~js\n// Exclude by RegExp\nfl.exclude(/^dev-.*\\.css/);\n\n// Exclude by Glob pattern\nfl.exclude(\"dev-*.css\");\n\n// Exclude by function\nfl.exclude(function (path) {\n    return FS.statSync(path).mtime.getTime() < (Date.now() - 60 * 60 * 1000);\n});\n~~~\n\nTo get to the actual items of the FileList, use the `#items` property, or the `#toArray` method, to get a plain array back. You can also use the `#get` or `#set` methods to retrieve or set an item.\n\nFileLists are *lazy*, in that the actual file paths are not determined from the include and exclude patterns until the individual items are requested. This allows you to define a FileList and incrementally add patterns to it in the Sakefile file. The FileList paths will not be resolved until the task that uses it as a prerequisite actually asks for the final paths.\n\n### FileList Utility Properties & Methods\n\n#### FileList#existing\n\nWill return a new `FileList` with all of the files that actually exist.\n\n#### FileList#notExisting\n\nWill return a new `FileList` all of the files that do not exist.\n\n#### FileList#extension(ext)\n\nReturns a new `FileList` with all paths that match the given extension.\n\n~~~js\nfl.extension(\".scss\").forEach(function (path) {\n    //...\n});\n~~~\n\n#### FileList#grep(pattern)\n\nGet a `FileList` of all the files that match the given `pattern`. `pattern` can be a plain `String`, a `Glob` pattern, a `RegExp`, or a `function`.\n\n#### FileList#clearExcludes()\n\nClear all exclude patterns/functions.\n\n#### FileList#clearIncludes()\n\nClear all include patterns.\n\n#### FileList#add()\n\nAlias for `#include`\n\n\nSaké Utility Functions\n----------------------\n\nSaké defines a few utility functions to make life a little easier in an asynchronous world. Most of these are just wrappers for `node`'s File System (`require(\"fs\")`) utility methods.\n\n### mkdir(dirpath, mode=\"755\")\n### mkdir_p(dirpath, mode=\"755\"])\n\nCreate the `dirpath` directory, if it doesn't already exist. `mkdir_p` will create all intermediate directories as needed.\n    \n### rm(path, [path1, ..., pathN])\n### rm_rf(path, [path1, ..., pathN])\n\nRemove one or more paths from the file system. `rm_rf` will remove directories and their contents.\n    \n### cp(from, to)\n\nCopy a file from `from` path to `to` path.\n    \n### mv(from, to)\n\nMove a file from `from` path to `to` path.\n    \n### ln(from, to)\n\nCreate a hard link from `from` path to `to` path.\n    \n### ln_s(from, to)\n\nCreate a symlink from `from` path to `to` path.\n    \n### cat(path, [path1, ..., pathN])\n\nSynchronously read all supplied paths and return their contents as a string. If an argument is an `Array` it will be expanded and those paths will be read.\n    \n### read(path, [enc])\n\nSynchronously read the supplied file path. Returns a `buffer`, or a `string` if `enc` is given.\n    \n### write(path, data, [enc], mode=\"w\")\n\nSynchronously write the `data` to the supplied file `path`. `data` should be a `buffer` or a `string` if `enc` is given. `mode` is a `string` of either \"w\", for over write,  or \"a\" for append.\n\n### sh(cmd, success, [failure])\n\nExecute shell `cmd`. On success the `success` handler will be called, on error, the `failure` function.\n\nThis method is *asynchronous*, and if used in a task, one should call `Task.startAsync` or the `task#startAsync` to indicate that the task is asynchronous. Clear the *asynchronous* flag by calling `Task.clearAsync`, or the `task#clearAsync` method in the `success` or `failure` handler.\n\n\nStitch Usage\n------------\n\n`stitch` provides various methods and core tasks to help define tasks that enable bundling of resources for web-development. (It's also where the **S** in **S**aké comes from.)\n\n### stitch([namespace], function)\n\nDefine a stitch configuration. If `namespace` is omitted, it defaults to \"default\".\n\nThe first argument to the `function` will be a reference to the current `stitch` driver; in addition, the `this` context of the function will be set to the stitch configuration driver.\n\n~~~js\nstitch.aliasType(\"text/stylesheet\", \"scss\");\n\nstitch(function (cfg) {\n    cfg.bundle(\"core\", function (core) {\n        core.javascript(function () {\n            core.add(\"src/js/core.js\");\n        });\n        \n        core.stylesheet(function () {\n            this.add(\"src/css/core.scss\");\n            this.add(\"src/css/reset.scss\");\n        });\n    });\n    \n    this.bundle(\"sub-module\", function (sub) {\n        sub.include(\"core\");\n        \n        this.js(\"src/js/sub-module.js\");\n        this.scss(\"src/css/sub-module.scss\");\n    });\n});\n~~~\n\nor the equivalent *CoffeeScript*:\n\n~~~js\nstitch.aliasType \"text/stylesheet\", \"scss\"\n\nstitch (cfg)->\n    cfg.bundle \"core\", (core)->\n        core.javascript ->\n            core.add \"src/js/core.js\"\n        \n        core.stylesheet ->\n            @add \"src/css/core.scss\"\n            @add \"src/css/reset.scss\"\n        \n    @bundle \"sub-module\", (sub)->\n        sub.include \"core\"\n        \n        @js \"src/js/sub-module.js\"\n        @scss \"src/css/sub-module.scss\"\n~~~\n\n### Types\n\n### Bundles\n\n","maintainers":[{"name":"jhamlet","email":"jerry@hamletink.com"}],"deprecated":"New api in v0.1.0"},"0.0.4":{"name":"sake","description":"A Rake-like application for managing builds and for Stitching JavaScript, CSS, HTML, and other sundry files together for web development.","version":"0.0.4","keywords":["packager","css","javascript","html","web","development"],"main":"./lib/app.js","bin":{"sake":"./bin/sake"},"directories":{"lib":"lib"},"dependencies":{"proteus":">=0.0.x","nomnom":">=1.5.x","glob":">=2.1.0"},"devDependencies":{"should":"*"},"licenses":[{"type":"MIT","url":"http://github.com/jhamlet/sake-node/raw/master/LICENSE"}],"repository":{"type":"git","url":"git://github.com/jhamlet/sake-node.git"},"preferGlobal":true,"_npmUser":{"name":"jhamlet","email":"jerry@hamletink.com"},"_id":"sake@0.0.4","contributors":[{"name":"Jerry Hamlet","email":"jerry@hamletink.com","url":"http://hamletink.com/"}],"optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.12","_nodeVersion":"v0.6.10","_defaultsLoaded":true,"dist":{"shasum":"e4f9e18b4a19b825e3a1dc46f1f93b37263d6cd1","tarball":"https://registry.npmjs.org/sake/-/sake-0.0.4.tgz","integrity":"sha512-s74+HBCN/SxBxWhztsP6toTVgJLz1npr3K3MIRakMul74Wf9quIPv7s1AxVlbUEk7izANLSf6kkqnhqloTtI5A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD3z75I9UvhwbPo9VBDnXPP4Kh1nEtzkJZnSXvCIN9ZJQIgQfUI4jH1VDbm4xAxCcmNlh06bEp0nHWvgiXsvhhzM/w="}]},"readme":"SAKÉ\n====\n\n**S**[titch from R]**ake**\n\nThis package contains **Saké**, a JavaScript build program that runs in node with capabilities similar to ruby's Rake, and with some extra **Stitch** tasks for building JavaScript, CSS, HTML, and other sundry files for web development.\n\nSaké has the following features:\n\n1.  Sakefiles (Saké’s version of Rakefiles) are completely defined in standard JavaScript (or CoffeeScript, for those who want an even more Rake-like feel).\n2.  Flexible FileLists that act like arrays but know about manipulating file names and paths.\n3.  Standard `clean` and `clobber` tasks\n4.  Handling of *Synchronous* and *Asynchronous* tasks.\n5.  Many utility methods for handling common build tasks (rm, rm_rf, mkdir, mkdir_p, sh, cat, etc...)\n6.  **Stitch** a set of utility methods that help build packages of JavaScript, CSS, HTML, etc...\n\n\nInstallation\n------------\n\n### Install with npm\n\nDownload and install with the following:\n\n    npm install -g sake\n\n\nSaké Command-Line Usage\n-----------------------\n\n~~~\n% sake [options] [task ...] [env=variable ...]\n~~~\n\n**Saké** will look within the current directory, and all parent directories, for the first `/^[sS]akefile(\\.(js|coffee))?$/` it can find, run that file, and then invoke the task passed on the command-line. If no task is given, it will try to invoke the task named `default`.\n\nIf additional arguments in the form of `[VARIABLE_NAME]=[VALUE]` are given on the command-line, **Saké** will set an environment variable `VARIABLE_NAME` with its value the JSON parsed value of `VALUE` (or a plain string, if it fails to JSON parse cleanly). These will then be accessible through the node's `process.env[ironment]` namespace.\n\n### Sake Command-Line Options\n\n~~~\n-f, --sakefile PATH      Specify PATH to Sakefile to run instead of searching for one.\n-T, --tasks              List tasks with descriptions and exit.\n-P, --prerequisites      List tasks and their prerequisites and exit.\n-d, --debug              Enable additional debugging output.\n-v, --verbose            Log messages to standard output.\n-V, --version            Print the version of sake and exit.\n-h, --help               Print this help information and exit.\n~~~\n\n### Stitch Specific Options ###\n\n~~~\n-o, --outfile PATH       Save Stitch output to file PATH.\n-F, --force              If outputing to a file, overwrite any existing file.\n-N, --no-minify          Set Stitch minification flag to false.\n--stitch-temp-dir PATH   Directory to use for temporary files\n~~~\n\n\nSakefile Usage\n--------------\n\nWithin a `Sakefile`, Saké's methods are exported to the global scope, so you can invoke them directly:\n\n~~~js\ntask(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n});\n~~~\n    \nor, the equivalent in a `Sakefile.coffee`:\n\n~~~js\ntask \"taskname\", [\"prereq1\", \"prereq2\"], (t)->\n    // task action...\n~~~\n\nWithin another node module you can `require(\"sake\")` and access the methods on the exported object:\n\n~~~js\nvar sake = require(\"sake\");\n    \nsake.task(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n});\n~~~\n\nThe remainder of this documentation will assume that we are calling the methods from within a `Sakefile`.\n\n\nDefining Tasks\n--------------\n\nThe various task methods take one, or more, of the following arguments:\n\n1.   `taskname`: `string` -- naming the task\n2.   `prerequisites`: an _optional_ `array` of `string` task names, `FileLists`, or `functions` that return a task name, an `array`, or a `FileList`. You can also pass a `FileList` in directly for `prerequisites`.\n3.   `action`: an _optional_ `function` that will be called when the task is invoked.\n\nAll task methods return the task *instance*.\n\nIf a task is already defined, it will be augmented by the additional arguments. So, this:\n\n~~~js\ntask(\"one\", [\"othertask\"], function (t) {\n    // do action one...\n});\n\ntask(\"one\", function (t) {\n    // do action two...\n});\n\ntask(\"othertask\");\n~~~\n\nWould result in a task \"othertask\" with no prerequisites, and no action, and a task \"one\" with \"othertask\" as a prerequisite and the two functions as its actions.\n\n**Note** how the dependent task was defined *after* it was required as a prerequisite. Task prerequisites are not resolved until the task is invoked. This leads to flexibility in how to compose your tasks and prerequisite tasks.\n\n### File Tasks\n\nFile tasks are created with the (appropriately named) `file` method. File tasks, however, are only triggered if the file doesn't exist, or the modification time of any of its prerequisites is newer than itself.\n\n~~~js\nfile(\"path/to/some/file\", function (t) {\n    cp(\"other/path\", t.name);\n});\n~~~\n\nThe above task would only be triggered if `path/to/some/file` did not exist.\n\nThe following:\n\n~~~js\nfile(\"combined/file/path\", [\"pathA\", \"pathB\", \"pathC\"], function (t) {\n    write(t.name, cat(t.prerequisites), \"utf8\");\n});\n~~~\n\nwould be triggered if `path/to/some/file` did not exist, or its modification time was earlier than any of its prerequisites (`pathA`, `pathB`, or  `pathC`).\n\n\n### Directory Tasks\n\nDirectory tasks, created with the `directory` method, are tasks that will only be called if they do not exist. A task will be created for the named directory (and for all directories along the way) with the action of creating the directory.\n\nDirectory tasks do not take any `prerequisites` or an `action` when first defined, however, they may be augmented with such after they are created:\n\n~~~js\ndirectory(\"dir/path/to/create\");\n\ntask(\"dir/path/to/create\", [\"othertask\"], action (t) {\n    //... do stuff\n});\n~~~\n\n\n### File Create Tasks\n\nA file create task is a file task, that when used as a prerequisite, will be needed if, and only if, the file has not been created. Once created, it is not re-triggered if any of its prerequisites are newer, nor does it trigger any rebuilds of tasks that depend on it whenever the file is updated.\n\n~~~js\nfileCreate(\"file/path/to/create.ext\", [\"pathA\", \"pathB\"], function (t) {\n    // create file...\n});\n~~~\n\n\n(A)Synchronicity and Tasks\n--------------------------\n\nIn Saké all task actions are assumed to be *synchronous*. However, many things in node require *asynchronous* callbacks. You can indicate that a task action is asynchronous by calling the tasks's, or the global `Task` class', `startAsyc` method when starting the task action, and the `clearAsync` method when it is complete. i.e:\n\n~~~js\ntask(\"asynctask\", function (t) {\n    t.startAsync(); // or, Task.startAsync()\n    sh(\"some long running shell command\", function (err, stdout, stderr) {\n        // do stuff...\n        t.clearAsync(); // or, Task.clearAsync()\n    });\n});\n~~~\n\nAlternatively, you can use the `atask` method to add an *asynchronous* task action. This will automatically set the async flag for that action. However, your task must still clear it when it is done. i.e:\n\n~~~js\natask(\"longtask\", function (t) {\n    sh(\"some long running shell command\", function (err, stdout, stderr) {\n        t.clearAsync(); // or, Task.clearAsync()\n    });\n});\n~~~\n\n\nFile Lists\n----------\n\nFileLists are lists (an `Array`) of files.\n\n~~~js\nnew FileList(\"*.scss\");\n~~~\n\nWould contain all the files with a \".scss\" extension in the top-level directory of your project.\n\nYou can use FileLists pretty much like an `Array`. You can iterate them (with `forEach, filter, reduce`, etc...), `concat` them, `splice` them, and you get back a new FileList object.\n\nTo add files, or glob patterns to them, use the `#include` method:\n\n~~~js\nvar fl = new FileList(\"*.scss\");\nfl.include(\"core.css\", \"reset.css\", \"*.css\");\n~~~\n\nYou can also `exlucude` files by Glob pattern, `Regular Expression` pattern, or by use of a `function` that takes the file path as an argument and returns a `truthy` value to exclude a file.\n\n~~~js\n// Exclude by RegExp\nfl.exclude(/^dev-.*\\.css/);\n\n// Exclude by Glob pattern\nfl.exclude(\"dev-*.css\");\n\n// Exclude by function\nfl.exclude(function (path) {\n    return FS.statSync(path).mtime.getTime() < (Date.now() - 60 * 60 * 1000);\n});\n~~~\n\nTo get to the actual items of the FileList, use the `#items` property, or the `#toArray` method, to get a plain array back. You can also use the `#get` or `#set` methods to retrieve or set an item.\n\nFileLists are *lazy*, in that the actual file paths are not determined from the include and exclude patterns until the individual items are requested. This allows you to define a FileList and incrementally add patterns to it in the Sakefile file. The FileList paths will not be resolved until the task that uses it as a prerequisite actually asks for the final paths.\n\n### FileList Utility Properties & Methods\n\n#### FileList#existing\n\nWill return a new `FileList` with all of the files that actually exist.\n\n#### FileList#notExisting\n\nWill return a new `FileList` all of the files that do not exist.\n\n#### FileList#extension(ext)\n\nReturns a new `FileList` with all paths that match the given extension.\n\n~~~js\nfl.extension(\".scss\").forEach(function (path) {\n    //...\n});\n~~~\n\n#### FileList#grep(pattern)\n\nGet a `FileList` of all the files that match the given `pattern`. `pattern` can be a plain `String`, a `Glob` pattern, a `RegExp`, or a `function`.\n\n#### FileList#clearExcludes()\n\nClear all exclude patterns/functions.\n\n#### FileList#clearIncludes()\n\nClear all include patterns.\n\n#### FileList#add()\n\nAlias for `#include`\n\n\nSaké Utility Functions\n----------------------\n\nSaké defines a few utility functions to make life a little easier in an asynchronous world. Most of these are just wrappers for `node`'s File System (`require(\"fs\")`) utility methods.\n\n### mkdir(dirpath, mode=\"755\")\n### mkdir_p(dirpath, mode=\"755\"])\n\nCreate the `dirpath` directory, if it doesn't already exist. `mkdir_p` will create all intermediate directories as needed.\n    \n### rm(path, [path1, ..., pathN])\n### rm_rf(path, [path1, ..., pathN])\n\nRemove one or more paths from the file system. `rm_rf` will remove directories and their contents.\n    \n### cp(from, to)\n\nCopy a file from `from` path to `to` path.\n    \n### mv(from, to)\n\nMove a file from `from` path to `to` path.\n    \n### ln(from, to)\n\nCreate a hard link from `from` path to `to` path.\n    \n### ln_s(from, to)\n\nCreate a symlink from `from` path to `to` path.\n    \n### cat(path, [path1, ..., pathN])\n\nSynchronously read all supplied paths and return their contents as a string. If an argument is an `Array` it will be expanded and those paths will be read.\n    \n### read(path, [enc])\n\nSynchronously read the supplied file path. Returns a `buffer`, or a `string` if `enc` is given.\n    \n### write(path, data, [enc], mode=\"w\")\n\nSynchronously write the `data` to the supplied file `path`. `data` should be a `buffer` or a `string` if `enc` is given. `mode` is a `string` of either \"w\", for over write,  or \"a\" for append.\n\n### sh(cmd, success, [failure])\n\nExecute shell `cmd`. On success the `success` handler will be called, on error, the `failure` function.\n\nThis method is *asynchronous*, and if used in a task, one should call `Task.startAsync` or the `task#startAsync` to indicate that the task is asynchronous. Clear the *asynchronous* flag by calling `Task.clearAsync`, or the `task#clearAsync` method in the `success` or `failure` handler.\n\n\nStitch Usage\n------------\n\n`stitch` provides various methods and core tasks to help define tasks that enable bundling of resources for web-development. (It's also where the **S** in **S**aké comes from.)\n\n### stitch([namespace], function)\n\nDefine a stitch configuration. If `namespace` is omitted, it defaults to \"default\".\n\nThe first argument to the `function` will be a reference to the current `stitch` driver; in addition, the `this` context of the function will be set to the stitch configuration driver.\n\n~~~js\nstitch.aliasType(\"text/stylesheet\", \"scss\");\n\nstitch(function (cfg) {\n    cfg.bundle(\"core\", function (core) {\n        core.javascript(function () {\n            core.add(\"src/js/core.js\");\n        });\n        \n        core.stylesheet(function () {\n            this.add(\"src/css/core.scss\");\n            this.add(\"src/css/reset.scss\");\n        });\n    });\n    \n    this.bundle(\"sub-module\", function (sub) {\n        sub.include(\"core\");\n        \n        this.js(\"src/js/sub-module.js\");\n        this.scss(\"src/css/sub-module.scss\");\n    });\n});\n~~~\n\nor the equivalent *CoffeeScript*:\n\n~~~js\nstitch.aliasType \"text/stylesheet\", \"scss\"\n\nstitch (cfg)->\n    cfg.bundle \"core\", (core)->\n        core.javascript ->\n            core.add \"src/js/core.js\"\n        \n        core.stylesheet ->\n            @add \"src/css/core.scss\"\n            @add \"src/css/reset.scss\"\n        \n    @bundle \"sub-module\", (sub)->\n        sub.include \"core\"\n        \n        @js \"src/js/sub-module.js\"\n        @scss \"src/css/sub-module.scss\"\n~~~\n\n### Types\n\n### Bundles\n\n","maintainers":[{"name":"jhamlet","email":"jerry@hamletink.com"}],"deprecated":"New api in v0.1.0"},"0.1.0":{"name":"sake","description":"[S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.","version":"0.1.0","keywords":["build","make","rake","jake"],"main":"./lib/node_modules/sake/index.js","bin":{"sake":"./bin/sake"},"directories":{"lib":"lib"},"dependencies":{"nomnom":">=1.5.x","async":">=0.1.18","resolve":">=0.2.x","proteus":">=0.0.x","wordwrap":">=0.0.2"},"devDependencies":{"mocha":">=0.3.x","should":">=0.5.x","underscore":">=1.3.x"},"scripts":{"test":"mocha test/test-*"},"licenses":[{"type":"MIT","url":"http://github.com/jhamlet/node-sake/raw/master/LICENSE"}],"repository":{"type":"git","url":"git://github.com/jhamlet/node-sake.git"},"bugs":{"url":"http://github.com/jhamlet/node-sake/issues"},"preferGlobal":true,"_npmUser":{"name":"jhamlet","email":"jerry@hamletink.com"},"_id":"sake@0.1.0","contributors":[{"name":"Jerry Hamlet","email":"jerry@hamletink.com"}],"optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.12","_nodeVersion":"v0.6.10","_defaultsLoaded":true,"dist":{"shasum":"10eb5fdf0de37d229f049bb0e3d860a4774dba4b","tarball":"https://registry.npmjs.org/sake/-/sake-0.1.0.tgz","integrity":"sha512-DcNFFHIQ7s73rioVCJkTpPoUhelZW19KchB3vacxr6YodURnFsoAM69tlsV3Bc4rLtrDR7CrUv+6Z9LU04z4sA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCRGQUvhZxNZf8FnIlbFk4FL0YDKfaDjpGkd2ZkC7HXNAIgKx5lAPPiCNL7MFVEw7Mg/1TlP20+NPF6COLq3Ct36jI="}]},"readme":"\nSaké\n====\n\n> [S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.\n\nThis package contains **saké**, a JavaScript build program that runs in node with capabilities similar to ruby's Rake.\n\nSaké has the following features:\n\n1.  `Sakefiles` (saké’s version of Rakefiles) are completely defined in standard JavaScript (or CoffeeScript, for those who want an even more Rake-like feel).\n2.  Flexible `FileLists` that act like arrays but know about manipulating file names and paths.\n3.  `clean` and `clobber` tasks are available for tidying up.\n4.  _Asynchronous_ task handling, with easy options for secifying _synchronous_ tasks.\n5.  Many utility methods for handling common build tasks (rm, rm_rf, mkdir, mkdir_p, sh, cat, etc...)\n\n\nInstallation\n------------\n\n### Install with npm\n\nDownload and install with the following:\n\n~~~\nnpm install -g sake\n~~~\n\nCommand-Line Usage\n------------------\n\n~~~\n% sake -h\n\nusage: sake [TASK] [ARGUMENTS ...] [ENV=VALUE ...] [options]\n\n[TASK]       Name of the task to run. Defaults to 'default'.\n[ARGUMENTS ...]     Zero or more arguments to pass to the task invoked.\n[ENV=VALUE ...]     Zero or more arguments to translate into environment variables.\n\noptions:\n   -f, --sakefile PATH    PATH to Sakefile to run instead of searching for one.\n   -n, --dry-run          Do a dry run without executing actions.\n   -T, --tasks            List tasks with descriptions and exit.\n   -P, --prerequisites    List tasks and their prerequisites and exit.\n   -r, --require MODULE   Require MODULE before executing Sakefile and expose the\n                          MODULE under a sanitized namespace (i.e.: coffee-script =>\n                          [sake.]coffeeScript).\n   -S, --synchronous      Make all standard tasks 'synchronous' by default.\n   -d, --debug            Enable additional debugging output.\n   -q, --quiet            Suppress informational messages.\n   -V, --version          Print the version of sake and exit.\n   -h, --help             Print this help information and exit.\n\nSake will look within the current directory, and all parent directories, for the first `Sakefile`\nit can find, and then invoke the TASK. If no task is given, it will try to invoke the task named\n\"default\".\n\n`Sakefile` can be one of \"Sakefile\", \"sakefile\", \"Sakefile.js\", \"sakefile.js\", \"Sakefile.coffee\",\nor \"sakefile.js\"\n~~~\n\n### Dependencies ###\n\nThese are installed when **sake** is installed.\n\n~~~\nnomnom:   >=1.5.x\nasync:    >=0.1.18\nresolve:  >=0.2.x\nproteus:  >=0.0.x\nwordwrap: >=0.0.2\n~~~\n\n\n### Development Dependencies ###\n\nInstalled when you run `npm link` in the package directory.\n\n~~~\nmocha:      >=0.3.x\nshould:     >=0.5.x\nunderscore: >=1.3.x\n~~~\n\n\nSakefile Usage\n--------------\n\nWithin a `Sakefile`, Saké's methods are exported to the global scope, so you can invoke them directly:\n\n~~~js\ntask(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n~~~\n    \nWithin another node module you can `require(\"sake\")` and access the methods on the exported object:\n\n~~~js\nvar sake = require(\"sake\");\n    \nsake.task(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n~~~\n\nThe remainder of this documentation will assume that we are calling the methods from within a `Sakefile`.\n\n\nDefining Tasks\n--------------\n\nThe various task methods take the following arguments:\n\n1.   `taskname`: `string` &mdash; naming the task\n2.   `prerequisites`: _optional_ \n    *   an `array` of:\n        *   `string` task name, or\n        *   a `FileLists`, or \n        *   a `function` that returns one of the above.\n    *   or, you can also pass a `FileList` in directly for `prerequisites`.\n3.   `action`: an _optional_ `function` that will be called when the task is invoked.\n\nAll task methods return the task *instance*.\n\nIf a task is already defined, it will be augmented by the additional arguments. So, this:\n\n~~~js\ntask(\"one\", [\"othertask\"], function (t) {\n    // do action one...\n    t.done();\n});\n\ntask(\"one\", function (t) {\n    // do action two...\n    t.done();\n});\n\ntask(\"othertask\");\n~~~\n\nWould result in a task \"othertask\" with no prerequisites, and no action, and a task \"one\" with \"othertask\" as a prerequisite and the two functions as its actions.\n\n**Note** how the dependent task was defined *after* it was required as a prerequisite. Task prerequisites are not resolved until the task is invoked. This leads to flexibility in how to compose your tasks and prerequisite tasks.\n\n\n### File Tasks ###\n\nFile tasks are created with the (appropriately named) `file` method. File tasks, however, are only triggered if the file doesn't exist, or the modification time of any of its prerequisites is newer than itself.\n\n~~~js\nfile(\"path/to/some/file\", function (t) {\n    cp(\"other/path\", t.name);\n    t.done();\n});\n~~~\n\nThe above task would only be triggered if `path/to/some/file` did not exist.\n\nThe following:\n\n~~~js\nfile(\"combined/file/path\", [\"pathA\", \"pathB\", \"pathC\"], function (t) {\n    write(t.name, cat(t.prerequisites), \"utf8\");\n    t.done();\n});\n~~~\n\nwould be triggered if `path/to/some/file` did not exist, or its modification time was earlier than any of its prerequisites (`pathA`, `pathB`, or  `pathC`).\n\n\n### Directory Tasks ###\n\nDirectory tasks, created with the `directory` method, are tasks that will only be called if they do not exist. A task will be created for the named directory (and for all directories along the way) with the action of creating the directory.\n\nDirectory tasks do not take any `prerequisites` or an `action` when first defined, however, they may be augmented with such after they are created:\n\n~~~js\ndirectory(\"dir/path/to/create\");\n\ntask(\"dir/path/to/create\", [\"othertask\"], action (t) {\n    //... do stuff\n    t.done();\n});\n~~~\n\n\n### File Create Tasks ###\n\nA file create task is a file task, that when used as a prerequisite, will be needed if, and only if, the file has not been created. Once created, it is not re-triggered if any of its prerequisites are newer, nor does it trigger any rebuilds of tasks that depend on it whenever the file is updated.\n\n~~~js\nfileCreate(\"file/path/to/create.ext\", [\"pathA\", \"pathB\"], function (t) {\n    // create file...\n    t.done();\n});\n~~~\n\n\n(A)Synchronicity and Tasks\n--------------------------\n\nIn **saké** all task actions are assumed to be *asynchronous* and an action must call its task's `done` method to tell **saké** that it is done processing stuff.\n\n~~~js\ntask(\"long task\", function (t) {\n    sh(\"some long running shell command\", function (err, result) {\n        // do stuff...\n        t.done();\n    });\n});\n~~~\n\nAlternatively, you can use the `Sync` version of a task to add an *synchronous* action, and `done` will be called for you.\n\n~~~js\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n~~~\n\nThere are `Sync` versions of all the core tasks: `taskSync`, `fileSync`, and `fileCreateSync` as well as `Async` versions also: `taskAsync`, `fileAsync`, and `fileCreateAsync`. `directory` tasks are always initially *synchronous*. You can add *asynchronous* task actions after the initial definition.\n\nThirdly, you can just specify that all task actions are *synchronous* by setting saké's \"synchronous\" option to `true`, or by use of the command-line options `-S, --synchronous`.\n\n~~~js\nsake.options.synchronous = true;\n\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n\n//... define more synchronous tasks\n\n//... and then revert to async\nsake.options.synchronous = false;\n~~~\n\n\nFile Lists\n----------\n\nFileLists are lists (an `Array`) of files.\n\n~~~js\nnew FileList(\"*.scss\");\n~~~\n\nWould contain all the files with a \".scss\" extension in the top-level directory of your project.\n\nYou can use FileLists pretty much like an `Array`. You can iterate them (with `forEach, filter, reduce`, etc...), `concat` them, `splice` them, and you get back a new FileList object.\n\nTo add files, or glob patterns to them, use the `#include` method:\n\n~~~js\nvar fl = new FileList(\"*.scss\");\nfl.include(\"core.css\", \"reset.css\", \"*.css\");\n~~~\n\nYou can also `exlucude` files by Glob pattern, `Regular Expression` pattern, or by use of a `function` that takes the file path as an argument and returns a `truthy` value to exclude a file.\n\n~~~js\n// Exclude by RegExp\nfl.exclude(/^dev-.*\\.css/);\n\n// Exclude by Glob pattern\nfl.exclude(\"dev-*.css\");\n\n// Exclude by function\nfl.exclude(function (path) {\n    return FS.statSync(path).mtime.getTime() < (Date.now() - 60 * 60 * 1000);\n});\n~~~\n\nTo get to the actual items of the FileList, use the `#items` property, or the `#toArray` method, to get a plain array back. You can also use the `#get` or `#set` methods to retrieve or set an item.\n\nFileLists are *lazy*, in that the actual file paths are not determined from the include and exclude patterns until the individual items are requested. This allows you to define a FileList and incrementally add patterns to it in the Sakefile file. The FileList paths will not be resolved until the task that uses it as a prerequisite actually asks for the final paths.\n\n\n### FileList Utility Properties & Methods ###\n\n*   `existing` &mdash; will return a new `FileList` with all of the files that actually exist.\n*   `notExisting` &mdash; will return a new `FileList` all of the files that do not exist.\n*   `extension(ext)` &mdash; returns a new `FileList` with all paths that match the given extension.\n\n~~~js\nfl.extension(\".scss\").forEach(function (path) {\n    //...\n});\n~~~\n\n*   `grep(pattern)` &mdash; get a `FileList` of all the files that match the given `pattern`. `pattern` can be a plain `String`, a `Glob` pattern, a `RegExp`, or a `function` that receives each path and can return a truthy value include it.\n*   `clearExcludes()` &mdash; clear all exclude patterns/functions.\n*   `clearIncludes()` &mdash; clear all include patterns.\n\n\nSaké Utility Functions\n----------------------\n\nSaké defines a few utility functions to make life a little easier in an asynchronous world. Most of these are just wrappers for `node`'s File System (`require(\"fs\")`) utility methods.\n\n### Synchronous Utilities ###\n\n*   `mkdir(dirpath, mode=\"755\")` &mdash; create the `dirpath` directory, if it doesn't already exist.\n*   `mkdir_p(dirpath, mode=\"755\"])` &mdash; as above, but create all intermediate directories as needed.\n*   `rm(path, [path1, ..., pathN])` &mdash; remove one or more paths from the file system.\n*   `rm_rf(path, [path1, ..., pathN])` &mdash; as above, and remove directories and their contents.\n*   `cp(from, to)` &mdash; copy a file from `from` path to `to` path\n*   `mv(from, to)` &mdash; move a file from `from` path to `to` path.\n*   `ln(from, to)` &mdash; create a hard link from `from` path to `to` path.\n*   `ln_s(from, to)` &mdash; create a symlink from `from` path to `to` path.\n*   `cat(path, [path1, ..., pathN])` &mdash; read all supplied paths and return their contents as a string. If an argument is an `Array` it will be expanded and those paths will be read.\n*   `read(path, [enc])` &mdash; read the supplied file path. Returns a `buffer`, or a `string` if `enc` is given.\n*   `write(path, data, [enc], mode=\"w\")` &mdash; write the `data` to the supplied file `path`. `data` should be a `buffer` or a `string` if `enc` is given. `mode` is a `string` of either \"w\", for over write,  or \"a\" for append.\n*   `slurp(path, [env])` &mdash; alias for `read`\n*   `spit(path, data, [enc], mode=\"w\")` &mdash; alias for `write`\n\n\n### Asynchronous Utilities ###\n\n*   `sh(cmd, fn(error, result))` &mdash; execute shell `cmd`. In the callback function, `error` will be a truthy value if there was an error, and `result` will contain the STDERR returned from `cmd`. Otherwise, `result` will contain the STDOUT from the `cmd`.\n","maintainers":[{"name":"jhamlet","email":"jerry@hamletink.com"}]},"0.1.1":{"name":"sake","description":"[S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.","version":"0.1.1","keywords":["build","make","rake","jake"],"main":"./lib/node_modules/sake/index.js","bin":{"sake":"./bin/sake"},"directories":{"lib":"lib"},"dependencies":{"nomnom":">=1.5.x","async":">=0.1.18","resolve":">=0.2.x","proteus":">=0.0.x","wordwrap":">=0.0.2"},"devDependencies":{"mocha":">=0.3.x","should":">=0.5.x","underscore":">=1.3.x"},"scripts":{"test":"mocha test/test-*"},"licenses":[{"type":"MIT","url":"http://github.com/jhamlet/node-sake/raw/master/LICENSE"}],"repository":{"type":"git","url":"git://github.com/jhamlet/node-sake.git"},"bugs":{"url":"http://github.com/jhamlet/node-sake/issues"},"preferGlobal":true,"_npmUser":{"name":"jhamlet","email":"jerry@hamletink.com"},"_id":"sake@0.1.1","contributors":[{"name":"Jerry Hamlet","email":"jerry@hamletink.com"}],"optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.12","_nodeVersion":"v0.6.10","_defaultsLoaded":true,"dist":{"shasum":"915303bc0c375b554006f6cacf66ff149e7ea772","tarball":"https://registry.npmjs.org/sake/-/sake-0.1.1.tgz","integrity":"sha512-9cOYYTRB6n8a7xxRRbsvBeoTMSGoNSwpKM3a9AVVGWZMQXhrMAxQ717O4cEOI3NR0u1MMVxDzEvwcBsKToeo1A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFVTlhbesij7axkZL5Zg33ilfD6OCWJR7CbEnoQIu04CAiAbX3eBEE7WYCMB9CBoid8BRFTc65tDVqFLnODfKi5Tfg=="}]},"readme":"\nSaké\n====\n\n> [S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.\n\nThis package contains **saké**, a JavaScript build program that runs in node with capabilities similar to ruby's Rake.\n\nSaké has the following features:\n\n1.  `Sakefiles` (saké’s version of Rakefiles) are completely defined in standard JavaScript (or CoffeeScript, for those who want an even more Rake-like feel).\n2.  Flexible `FileLists` that act like arrays but know about manipulating file names and paths.\n3.  `clean` and `clobber` tasks are available for tidying up.\n4.  _Asynchronous_ task handling, with easy options for secifying _synchronous_ tasks.\n5.  Many utility methods for handling common build tasks (rm, rm_rf, mkdir, mkdir_p, sh, cat, etc...)\n\n\nInstallation\n------------\n\n### Install with npm\n\nDownload and install with the following:\n\n~~~\nnpm install -g sake\n~~~\n\nCommand-Line Usage\n------------------\n\n~~~\n% sake -h\n\nusage: sake [TASK] [ARGUMENTS ...] [ENV=VALUE ...] [options]\n\n[TASK]       Name of the task to run. Defaults to 'default'.\n[ARGUMENTS ...]     Zero or more arguments to pass to the task invoked.\n[ENV=VALUE ...]     Zero or more arguments to translate into environment variables.\n\noptions:\n   -f, --sakefile PATH    PATH to Sakefile to run instead of searching for one.\n   -n, --dry-run          Do a dry run without executing actions.\n   -T, --tasks            List tasks with descriptions and exit.\n   -P, --prerequisites    List tasks and their prerequisites and exit.\n   -r, --require MODULE   Require MODULE before executing Sakefile and expose the\n                          MODULE under a sanitized namespace (i.e.: coffee-script =>\n                          [sake.]coffeeScript).\n   -S, --synchronous      Make all standard tasks 'synchronous' by default.\n   -d, --debug            Enable additional debugging output.\n   -q, --quiet            Suppress informational messages.\n   -V, --version          Print the version of sake and exit.\n   -h, --help             Print this help information and exit.\n\nSake will look within the current directory, and all parent directories, for the first `Sakefile`\nit can find, and then invoke the TASK. If no task is given, it will try to invoke the task named\n\"default\".\n\n`Sakefile` can be one of \"Sakefile\", \"sakefile\", \"Sakefile.js\", \"sakefile.js\", \"Sakefile.coffee\",\nor \"sakefile.js\"\n~~~\n\n### Dependencies ###\n\nThese are installed when **sake** is installed.\n\n~~~\nnomnom:   >=1.5.x\nasync:    >=0.1.18\nresolve:  >=0.2.x\nproteus:  >=0.0.x\nwordwrap: >=0.0.2\n~~~\n\n\n### Development Dependencies ###\n\nInstalled when you run `npm link` in the package directory.\n\n~~~\nmocha:      >=0.3.x\nshould:     >=0.5.x\nunderscore: >=1.3.x\n~~~\n\n\nSakefile Usage\n--------------\n\nWithin a `Sakefile`, Saké's methods are exported to the global scope, so you can invoke them directly:\n\n~~~js\ntask(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n~~~\n    \nWithin another node module you can `require(\"sake\")` and access the methods on the exported object:\n\n~~~js\nvar sake = require(\"sake\");\n    \nsake.task(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n~~~\n\nThe remainder of this documentation will assume that we are calling the methods from within a `Sakefile`.\n\n\nDefining Tasks\n--------------\n\nThe various task methods take the following arguments:\n\n1.   `taskname`: `string` &mdash; naming the task\n2.   `prerequisites`: _optional_ \n    *   an `array` of:\n        *   `string` task name, or\n        *   a `FileLists`, or \n        *   a `function` that returns one of the above.\n    *   or, you can also pass a `FileList` in directly for `prerequisites`.\n3.   `action`: an _optional_ `function` that will be called when the task is invoked.\n\nAll task methods return the task *instance*.\n\nIf a task is already defined, it will be augmented by the additional arguments. So, this:\n\n~~~js\ntask(\"one\", [\"othertask\"], function (t) {\n    // do action one...\n    t.done();\n});\n\ntask(\"one\", function (t) {\n    // do action two...\n    t.done();\n});\n\ntask(\"othertask\");\n~~~\n\nWould result in a task \"othertask\" with no prerequisites, and no action, and a task \"one\" with \"othertask\" as a prerequisite and the two functions as its actions.\n\n**Note** how the dependent task was defined *after* it was required as a prerequisite. Task prerequisites are not resolved until the task is invoked. This leads to flexibility in how to compose your tasks and prerequisite tasks.\n\n\n### File Tasks ###\n\nFile tasks are created with the (appropriately named) `file` method. File tasks, however, are only triggered if the file doesn't exist, or the modification time of any of its prerequisites is newer than itself.\n\n~~~js\nfile(\"path/to/some/file\", function (t) {\n    cp(\"other/path\", t.name);\n    t.done();\n});\n~~~\n\nThe above task would only be triggered if `path/to/some/file` did not exist.\n\nThe following:\n\n~~~js\nfile(\"combined/file/path\", [\"pathA\", \"pathB\", \"pathC\"], function (t) {\n    write(t.name, cat(t.prerequisites), \"utf8\");\n    t.done();\n});\n~~~\n\nwould be triggered if `path/to/some/file` did not exist, or its modification time was earlier than any of its prerequisites (`pathA`, `pathB`, or  `pathC`).\n\n\n### Directory Tasks ###\n\nDirectory tasks, created with the `directory` method, are tasks that will only be called if they do not exist. A task will be created for the named directory (and for all directories along the way) with the action of creating the directory.\n\nDirectory tasks do not take any `prerequisites` or an `action` when first defined, however, they may be augmented with such after they are created:\n\n~~~js\ndirectory(\"dir/path/to/create\");\n\ntask(\"dir/path/to/create\", [\"othertask\"], action (t) {\n    //... do stuff\n    t.done();\n});\n~~~\n\n\n### File Create Tasks ###\n\nA file create task is a file task, that when used as a prerequisite, will be needed if, and only if, the file has not been created. Once created, it is not re-triggered if any of its prerequisites are newer, nor does it trigger any rebuilds of tasks that depend on it whenever the file is updated.\n\n~~~js\nfileCreate(\"file/path/to/create.ext\", [\"pathA\", \"pathB\"], function (t) {\n    // create file...\n    t.done();\n});\n~~~\n\n\n(A)Synchronicity and Tasks\n--------------------------\n\nIn **saké** all task actions are assumed to be *asynchronous* and an action must call its task's `done` method to tell **saké** that it is done processing stuff.\n\n~~~js\ntask(\"long task\", function (t) {\n    sh(\"some long running shell command\", function (err, result) {\n        // do stuff...\n        t.done();\n    });\n});\n~~~\n\nAlternatively, you can use the `Sync` version of a task to add an *synchronous* action, and `done` will be called for you.\n\n~~~js\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n~~~\n\nThere are `Sync` versions of all the core tasks: `taskSync`, `fileSync`, and `fileCreateSync` as well as `Async` versions also: `taskAsync`, `fileAsync`, and `fileCreateAsync`. `directory` tasks are always initially *synchronous*. You can add *asynchronous* task actions after the initial definition.\n\nThirdly, you can just specify that all task actions are *synchronous* by setting saké's \"synchronous\" option to `true`, or by use of the command-line options `-S, --synchronous`.\n\n~~~js\nsake.options.synchronous = true;\n\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n\n//... define more synchronous tasks\n\n//... and then revert to async\nsake.options.synchronous = false;\n~~~\n\n\nFile Lists\n----------\n\nFileLists are lists (an `Array`) of files.\n\n~~~js\nnew FileList(\"*.scss\");\n~~~\n\nWould contain all the files with a \".scss\" extension in the top-level directory of your project.\n\nYou can use FileLists pretty much like an `Array`. You can iterate them (with `forEach, filter, reduce`, etc...), `concat` them, `splice` them, and you get back a new FileList object.\n\nTo add files, or glob patterns to them, use the `#include` method:\n\n~~~js\nvar fl = new FileList(\"*.scss\");\nfl.include(\"core.css\", \"reset.css\", \"*.css\");\n~~~\n\nYou can also `exlucude` files by Glob pattern, `Regular Expression` pattern, or by use of a `function` that takes the file path as an argument and returns a `truthy` value to exclude a file.\n\n~~~js\n// Exclude by RegExp\nfl.exclude(/^dev-.*\\.css/);\n\n// Exclude by Glob pattern\nfl.exclude(\"dev-*.css\");\n\n// Exclude by function\nfl.exclude(function (path) {\n    return FS.statSync(path).mtime.getTime() < (Date.now() - 60 * 60 * 1000);\n});\n~~~\n\nTo get to the actual items of the FileList, use the `#items` property, or the `#toArray` method, to get a plain array back. You can also use the `#get` or `#set` methods to retrieve or set an item.\n\nFileLists are *lazy*, in that the actual file paths are not determined from the include and exclude patterns until the individual items are requested. This allows you to define a FileList and incrementally add patterns to it in the Sakefile file. The FileList paths will not be resolved until the task that uses it as a prerequisite actually asks for the final paths.\n\n\n### FileList Utility Properties & Methods ###\n\n*   `existing` &mdash; will return a new `FileList` with all of the files that actually exist.\n*   `notExisting` &mdash; will return a new `FileList` all of the files that do not exist.\n*   `extension(ext)` &mdash; returns a new `FileList` with all paths that match the given extension.\n\n~~~js\nfl.extension(\".scss\").forEach(function (path) {\n    //...\n});\n~~~\n\n*   `grep(pattern)` &mdash; get a `FileList` of all the files that match the given `pattern`. `pattern` can be a plain `String`, a `Glob` pattern, a `RegExp`, or a `function` that receives each path and can return a truthy value include it.\n*   `clearExcludes()` &mdash; clear all exclude patterns/functions.\n*   `clearIncludes()` &mdash; clear all include patterns.\n\n\nSaké Utility Functions\n----------------------\n\nSaké defines a few utility functions to make life a little easier in an asynchronous world. Most of these are just wrappers for `node`'s File System (`require(\"fs\")`) utility methods.\n\n### Synchronous Utilities ###\n\n*   `mkdir(dirpath, mode=\"755\")` &mdash; create the `dirpath` directory, if it doesn't already exist.\n*   `mkdir_p(dirpath, mode=\"755\"])` &mdash; as above, but create all intermediate directories as needed.\n*   `rm(path, [path1, ..., pathN])` &mdash; remove one or more paths from the file system.\n*   `rm_rf(path, [path1, ..., pathN])` &mdash; as above, and remove directories and their contents.\n*   `cp(from, to)` &mdash; copy a file from `from` path to `to` path\n*   `mv(from, to)` &mdash; move a file from `from` path to `to` path.\n*   `ln(from, to)` &mdash; create a hard link from `from` path to `to` path.\n*   `ln_s(from, to)` &mdash; create a symlink from `from` path to `to` path.\n*   `cat(path, [path1, ..., pathN])` &mdash; read all supplied paths and return their contents as a string. If an argument is an `Array` it will be expanded and those paths will be read.\n*   `read(path, [enc])` &mdash; read the supplied file path. Returns a `buffer`, or a `string` if `enc` is given.\n*   `write(path, data, [enc], mode=\"w\")` &mdash; write the `data` to the supplied file `path`. `data` should be a `buffer` or a `string` if `enc` is given. `mode` is a `string` of either \"w\", for over write,  or \"a\" for append.\n*   `slurp(path, [env])` &mdash; alias for `read`\n*   `spit(path, data, [enc], mode=\"w\")` &mdash; alias for `write`\n\n\n### Asynchronous Utilities ###\n\n*   `sh(cmd, fn(error, result))` &mdash; execute shell `cmd`. In the callback function, `error` will be a truthy value if there was an error, and `result` will contain the STDERR returned from `cmd`. Otherwise, `result` will contain the STDOUT from the `cmd`.\n","maintainers":[{"name":"jhamlet","email":"jerry@hamletink.com"}]},"0.1.2":{"name":"sake","description":"[S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.","version":"0.1.2","keywords":["build","make","rake","jake"],"main":"./lib/node_modules/sake/index.js","bin":{"sake":"./bin/sake"},"directories":{"lib":"lib"},"dependencies":{"nomnom":">=1.5.x","async":">=0.1.18","resolve":">=0.2.x","proteus":">=0.0.x","wordwrap":">=0.0.2"},"devDependencies":{"mocha":">=0.3.x","should":">=0.5.x","underscore":">=1.3.x"},"scripts":{"test":"mocha test/test-*"},"licenses":[{"type":"MIT","url":"http://github.com/jhamlet/node-sake/raw/master/LICENSE"}],"repository":{"type":"git","url":"git://github.com/jhamlet/node-sake.git"},"bugs":{"url":"http://github.com/jhamlet/node-sake/issues"},"preferGlobal":true,"_npmUser":{"name":"jhamlet","email":"jerry@hamletink.com"},"_id":"sake@0.1.2","contributors":[{"name":"Jerry Hamlet","email":"jerry@hamletink.com"}],"optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.12","_nodeVersion":"v0.6.10","_defaultsLoaded":true,"dist":{"shasum":"ce68ce6ff7d55f185c926434cfb37e9f70fadb91","tarball":"https://registry.npmjs.org/sake/-/sake-0.1.2.tgz","integrity":"sha512-Yh/HBi9zkD4zOGv86VzvVMlvkRFPeA8wsgaf3dbORO5Bu827Y9PNFqYgQts/Cta/fU3EnB/v08OcdHknO8wJRw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBx6OtWL0kMamzBONMoo5wxXxRY2GREhiwePy49e4EebAiEAsKQQT4+PV31jFwsnTErdnCOj02JiwcH9J5uxR5HdRgQ="}]},"readme":"\nSaké\n====\n\n> [S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.\n\nThis package contains **saké**, a JavaScript build program that runs in node with capabilities similar to ruby's Rake.\n\nSaké has the following features:\n\n1.  `Sakefiles` (saké’s version of Rakefiles) are completely defined in standard JavaScript (or CoffeeScript, for those who want an even more Rake-like feel).\n2.  Flexible `FileLists` that act like arrays but know about manipulating file names and paths.\n3.  `clean` and `clobber` tasks are available for tidying up.\n4.  _Asynchronous_ task handling, with easy options for secifying _synchronous_ tasks.\n5.  Many utility methods for handling common build tasks (rm, rm_rf, mkdir, mkdir_p, sh, cat, etc...)\n\n\nInstallation\n------------\n\n### Install with npm\n\nDownload and install with the following:\n\n~~~\nnpm install -g sake\n~~~\n\nCommand-Line Usage\n------------------\n\n~~~\n% sake -h\n\nusage: sake [TASK] [ARGUMENTS ...] [ENV=VALUE ...] [options]\n\n[TASK]       Name of the task to run. Defaults to 'default'.\n[ARGUMENTS ...]     Zero or more arguments to pass to the task invoked.\n[ENV=VALUE ...]     Zero or more arguments to translate into environment variables.\n\noptions:\n   -f, --sakefile PATH    PATH to Sakefile to run instead of searching for one.\n   -n, --dry-run          Do a dry run without executing actions.\n   -T, --tasks            List tasks with descriptions and exit.\n   -P, --prerequisites    List tasks and their prerequisites and exit.\n   -r, --require MODULE   Require MODULE before executing Sakefile and expose the\n                          MODULE under a sanitized namespace (i.e.: coffee-script =>\n                          [sake.]coffeeScript).\n   -S, --synchronous      Make all standard tasks 'synchronous' by default.\n   -d, --debug            Enable additional debugging output.\n   -q, --quiet            Suppress informational messages.\n   -V, --version          Print the version of sake and exit.\n   -h, --help             Print this help information and exit.\n\nSake will look within the current directory, and all parent directories, for the first `Sakefile`\nit can find, and then invoke the TASK. If no task is given, it will try to invoke the task named\n\"default\".\n\n`Sakefile` can be one of \"Sakefile\", \"sakefile\", \"Sakefile.js\", \"sakefile.js\", \"Sakefile.coffee\",\nor \"sakefile.js\"\n~~~\n\n### Dependencies ###\n\nThese are installed when **sake** is installed.\n\n~~~\nnomnom:   >=1.5.x\nasync:    >=0.1.18\nresolve:  >=0.2.x\nproteus:  >=0.0.x\nwordwrap: >=0.0.2\n~~~\n\n\n### Development Dependencies ###\n\nInstalled when you run `npm link` in the package directory.\n\n~~~\nmocha:      >=0.3.x\nshould:     >=0.5.x\nunderscore: >=1.3.x\n~~~\n\n\nSakefile Usage\n--------------\n\nWithin a `Sakefile`, Saké's methods are exported to the global scope, so you can invoke them directly:\n\n~~~js\ntask(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n~~~\n    \nWithin another node module you can `require(\"sake\")` and access the methods on the exported object:\n\n~~~js\nvar sake = require(\"sake\");\n    \nsake.task(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n~~~\n\nThe remainder of this documentation will assume that we are calling the methods from within a `Sakefile`.\n\n\nDefining Tasks\n--------------\n\nThe various task methods take the following arguments:\n\n1.   `taskname`: `string` &mdash; naming the task\n2.   `prerequisites`: _optional_ \n    *   an `array` of:\n        *   `string` task name, or\n        *   a `FileLists`, or \n        *   a `function` that returns one of the above.\n    *   or, you can also pass a `FileList` in directly for `prerequisites`.\n3.   `action`: an _optional_ `function` that will be called when the task is invoked.\n\nAll task methods return the task *instance*.\n\nIf a task is already defined, it will be augmented by the additional arguments. So, this:\n\n~~~js\ntask(\"one\", [\"othertask\"], function (t) {\n    // do action one...\n    t.done();\n});\n\ntask(\"one\", function (t) {\n    // do action two...\n    t.done();\n});\n\ntask(\"othertask\");\n~~~\n\nWould result in a task \"othertask\" with no prerequisites, and no action, and a task \"one\" with \"othertask\" as a prerequisite and the two functions as its actions.\n\n**Note** how the dependent task was defined *after* it was required as a prerequisite. Task prerequisites are not resolved until the task is invoked. This leads to flexibility in how to compose your tasks and prerequisite tasks.\n\n\n### File Tasks ###\n\nFile tasks are created with the (appropriately named) `file` method. File tasks, however, are only triggered if the file doesn't exist, or the modification time of any of its prerequisites is newer than itself.\n\n~~~js\nfile(\"path/to/some/file\", function (t) {\n    cp(\"other/path\", t.name);\n    t.done();\n});\n~~~\n\nThe above task would only be triggered if `path/to/some/file` did not exist.\n\nThe following:\n\n~~~js\nfile(\"combined/file/path\", [\"pathA\", \"pathB\", \"pathC\"], function (t) {\n    write(t.name, cat(t.prerequisites), \"utf8\");\n    t.done();\n});\n~~~\n\nwould be triggered if `path/to/some/file` did not exist, or its modification time was earlier than any of its prerequisites (`pathA`, `pathB`, or  `pathC`).\n\n\n### Directory Tasks ###\n\nDirectory tasks, created with the `directory` method, are tasks that will only be called if they do not exist. A task will be created for the named directory (and for all directories along the way) with the action of creating the directory.\n\nDirectory tasks do not take any `prerequisites` or an `action` when first defined, however, they may be augmented with such after they are created:\n\n~~~js\ndirectory(\"dir/path/to/create\");\n\ntask(\"dir/path/to/create\", [\"othertask\"], action (t) {\n    //... do stuff\n    t.done();\n});\n~~~\n\n\n### File Create Tasks ###\n\nA file create task is a file task, that when used as a prerequisite, will be needed if, and only if, the file has not been created. Once created, it is not re-triggered if any of its prerequisites are newer, nor does it trigger any rebuilds of tasks that depend on it whenever the file is updated.\n\n~~~js\nfileCreate(\"file/path/to/create.ext\", [\"pathA\", \"pathB\"], function (t) {\n    // create file...\n    t.done();\n});\n~~~\n\n\n(A)Synchronicity and Tasks\n--------------------------\n\nIn **saké** all task actions are assumed to be *asynchronous* and an action must call its task's `done` method to tell **saké** that it is done processing stuff.\n\n~~~js\ntask(\"long task\", function (t) {\n    sh(\"some long running shell command\", function (err, result) {\n        // do stuff...\n        t.done();\n    });\n});\n~~~\n\nAlternatively, you can use the `Sync` version of a task to add an *synchronous* action, and `done` will be called for you.\n\n~~~js\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n~~~\n\nThere are `Sync` versions of all the core tasks: `taskSync`, `fileSync`, and `fileCreateSync` as well as `Async` versions also: `taskAsync`, `fileAsync`, and `fileCreateAsync`. `directory` tasks are always initially *synchronous*. You can add *asynchronous* task actions after the initial definition.\n\nThirdly, you can just specify that all task actions are *synchronous* by setting saké's \"synchronous\" option to `true`, or by use of the command-line options `-S, --synchronous`.\n\n~~~js\nsake.options.synchronous = true;\n\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n\n//... define more synchronous tasks\n\n//... and then revert to async\nsake.options.synchronous = false;\n~~~\n\n\nFile Lists\n----------\n\nFileLists are lists (an `Array`) of files.\n\n~~~js\nnew FileList(\"*.scss\");\n~~~\n\nWould contain all the files with a \".scss\" extension in the top-level directory of your project.\n\nYou can use FileLists pretty much like an `Array`. You can iterate them (with `forEach, filter, reduce`, etc...), `concat` them, `splice` them, and you get back a new FileList object.\n\nTo add files, or glob patterns to them, use the `#include` method:\n\n~~~js\nvar fl = new FileList(\"*.scss\");\nfl.include(\"core.css\", \"reset.css\", \"*.css\");\n~~~\n\nYou can also `exlucude` files by Glob pattern, `Regular Expression` pattern, or by use of a `function` that takes the file path as an argument and returns a `truthy` value to exclude a file.\n\n~~~js\n// Exclude by RegExp\nfl.exclude(/^dev-.*\\.css/);\n\n// Exclude by Glob pattern\nfl.exclude(\"dev-*.css\");\n\n// Exclude by function\nfl.exclude(function (path) {\n    return FS.statSync(path).mtime.getTime() < (Date.now() - 60 * 60 * 1000);\n});\n~~~\n\nTo get to the actual items of the FileList, use the `#items` property, or the `#toArray` method, to get a plain array back. You can also use the `#get` or `#set` methods to retrieve or set an item.\n\nFileLists are *lazy*, in that the actual file paths are not determined from the include and exclude patterns until the individual items are requested. This allows you to define a FileList and incrementally add patterns to it in the Sakefile file. The FileList paths will not be resolved until the task that uses it as a prerequisite actually asks for the final paths.\n\n\n### FileList Utility Properties & Methods ###\n\n*   `existing` &mdash; will return a new `FileList` with all of the files that actually exist.\n*   `notExisting` &mdash; will return a new `FileList` all of the files that do not exist.\n*   `extension(ext)` &mdash; returns a new `FileList` with all paths that match the given extension.\n\n~~~js\nfl.extension(\".scss\").forEach(function (path) {\n    //...\n});\n~~~\n\n*   `grep(pattern)` &mdash; get a `FileList` of all the files that match the given `pattern`. `pattern` can be a plain `String`, a `Glob` pattern, a `RegExp`, or a `function` that receives each path and can return a truthy value include it.\n*   `clearExcludes()` &mdash; clear all exclude patterns/functions.\n*   `clearIncludes()` &mdash; clear all include patterns.\n\n\nSaké Utility Functions\n----------------------\n\nSaké defines a few utility functions to make life a little easier in an asynchronous world. Most of these are just wrappers for `node`'s File System (`require(\"fs\")`) utility methods.\n\n### Synchronous Utilities ###\n\n*   `mkdir(dirpath, mode=\"755\")` &mdash; create the `dirpath` directory, if it doesn't already exist.\n*   `mkdir_p(dirpath, mode=\"755\"])` &mdash; as above, but create all intermediate directories as needed.\n*   `rm(path, [path1, ..., pathN])` &mdash; remove one or more paths from the file system.\n*   `rm_rf(path, [path1, ..., pathN])` &mdash; as above, and remove directories and their contents.\n*   `cp(from, to)` &mdash; copy a file from `from` path to `to` path\n*   `mv(from, to)` &mdash; move a file from `from` path to `to` path.\n*   `ln(from, to)` &mdash; create a hard link from `from` path to `to` path.\n*   `ln_s(from, to)` &mdash; create a symlink from `from` path to `to` path.\n*   `cat(path, [path1, ..., pathN])` &mdash; read all supplied paths and return their contents as a string. If an argument is an `Array` it will be expanded and those paths will be read.\n*   `read(path, [enc])` &mdash; read the supplied file path. Returns a `buffer`, or a `string` if `enc` is given.\n*   `write(path, data, [enc], mode=\"w\")` &mdash; write the `data` to the supplied file `path`. `data` should be a `buffer` or a `string` if `enc` is given. `mode` is a `string` of either \"w\", for over write,  or \"a\" for append.\n*   `slurp(path, [env])` &mdash; alias for `read`\n*   `spit(path, data, [enc], mode=\"w\")` &mdash; alias for `write`\n\n\n### Asynchronous Utilities ###\n\n*   `sh(cmd, fn(error, result))` &mdash; execute shell `cmd`. In the callback function, `error` will be a truthy value if there was an error, and `result` will contain the STDERR returned from `cmd`. Otherwise, `result` will contain the STDOUT from the `cmd`.\n","maintainers":[{"name":"jhamlet","email":"jerry@hamletink.com"}]},"0.1.3":{"name":"sake","description":"[S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.","version":"0.1.3","keywords":["build","make","rake","jake"],"main":"./lib/node_modules/sake/index.js","bin":{"sake":"./bin/sake"},"directories":{"lib":"lib"},"dependencies":{"nomnom":">=1.5.x","async":">=0.1.18","resolve":">=0.2.x","proteus":">=0.0.x","wordwrap":">=0.0.2"},"devDependencies":{"mocha":">=0.3.x","should":">=0.5.x","underscore":">=1.3.x"},"scripts":{"test":"mocha test/test-*"},"licenses":[{"type":"MIT","url":"http://github.com/jhamlet/node-sake/raw/master/LICENSE"}],"repository":{"type":"git","url":"git://github.com/jhamlet/node-sake.git"},"bugs":{"url":"http://github.com/jhamlet/node-sake/issues"},"preferGlobal":true,"_npmUser":{"name":"jhamlet","email":"jerry@hamletink.com"},"_id":"sake@0.1.3","contributors":[{"name":"Jerry Hamlet","email":"jerry@hamletink.com"}],"optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.12","_nodeVersion":"v0.6.10","_defaultsLoaded":true,"dist":{"shasum":"9b0630ac4ae7b474e3bda7e2b4302839ad3cff01","tarball":"https://registry.npmjs.org/sake/-/sake-0.1.3.tgz","integrity":"sha512-rgLS4BVHEGH1sUX6uiqn3VYN8ju+VIOYYn4J8/egxvdSXc/zIIxGBTFIQts0QotthY4n5odvvkJU+7dJUqIUjQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCKl7YXIs7KO2AOSsQ6SK76Sj8r78XVnURetYoVAmqvKwIhAO2AQ5PIZPAPOen4sRr2IMN1Yoe6r+G/AA7cO2c5hAtZ"}]},"readme":"\nSaké\n====\n\n> [S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.\n\nThis package contains **saké**, a JavaScript build program that runs in node with capabilities similar to ruby's Rake.\n\nSaké has the following features:\n\n1.  `Sakefiles` (saké’s version of Rakefiles) are completely defined in standard JavaScript (or CoffeeScript, for those who want an even more Rake-like feel).\n2.  Flexible `FileLists` that act like arrays but know about manipulating file names and paths.\n3.  `clean` and `clobber` tasks are available for tidying up.\n4.  _Asynchronous_ task handling, with easy options for secifying _synchronous_ tasks.\n5.  Many utility methods for handling common build tasks (rm, rm_rf, mkdir, mkdir_p, sh, cat, etc...)\n\n\nInstallation\n------------\n\n### Install with npm\n\nDownload and install with the following:\n\n~~~\nnpm install -g sake\n~~~\n\nCommand-Line Usage\n------------------\n\n~~~\n% sake -h\n\nusage: sake [TASK] [ARGUMENTS ...] [ENV=VALUE ...] [options]\n\n[TASK]       Name of the task to run. Defaults to 'default'.\n[ARGUMENTS ...]     Zero or more arguments to pass to the task invoked.\n[ENV=VALUE ...]     Zero or more arguments to translate into environment variables.\n\noptions:\n   -f, --sakefile PATH    PATH to Sakefile to run instead of searching for one.\n   -n, --dry-run          Do a dry run without executing actions.\n   -T, --tasks            List tasks with descriptions and exit.\n   -P, --prerequisites    List tasks and their prerequisites and exit.\n   -r, --require MODULE   Require MODULE before executing Sakefile and expose the\n                          MODULE under a sanitized namespace (i.e.: coffee-script =>\n                          [sake.]coffeeScript).\n   -S, --synchronous      Make all standard tasks 'synchronous' by default.\n   -d, --debug            Enable additional debugging output.\n   -q, --quiet            Suppress informational messages.\n   -V, --version          Print the version of sake and exit.\n   -h, --help             Print this help information and exit.\n\nSake will look within the current directory, and all parent directories, for the first `Sakefile`\nit can find, and then invoke the TASK. If no task is given, it will try to invoke the task named\n\"default\".\n\n`Sakefile` can be one of \"Sakefile\", \"sakefile\", \"Sakefile.js\", \"sakefile.js\", \"Sakefile.coffee\",\nor \"sakefile.js\"\n~~~\n\n### Dependencies ###\n\nThese are installed when **sake** is installed.\n\n~~~\nnomnom:   >=1.5.x\nasync:    >=0.1.18\nresolve:  >=0.2.x\nproteus:  >=0.0.x\nwordwrap: >=0.0.2\n~~~\n\n\n### Development Dependencies ###\n\nInstalled when you run `npm link` in the package directory.\n\n~~~\nmocha:      >=0.3.x\nshould:     >=0.5.x\nunderscore: >=1.3.x\n~~~\n\n\nSakefile Usage\n--------------\n\nWithin a `Sakefile`, Saké's methods are exported to the global scope, so you can invoke them directly:\n\n~~~js\ntask(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n~~~\n    \nWithin another node module you can `require(\"sake\")` and access the methods on the exported object:\n\n~~~js\nvar sake = require(\"sake\");\n    \nsake.task(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n~~~\n\nThe remainder of this documentation will assume that we are calling the methods from within a `Sakefile`.\n\n\nDefining Tasks\n--------------\n\nThe various task methods take the following arguments:\n\n1.   `taskname`: `string` &mdash; naming the task\n2.   `prerequisites`: _optional_ \n    *   an `array` of:\n        *   `string` task name, or\n        *   a `FileLists`, or \n        *   a `function` that returns one of the above.\n    *   or, you can also pass a `FileList` in directly for `prerequisites`.\n3.   `action`: an _optional_ `function` that will be called when the task is invoked.\n\nAll task methods return the task *instance*.\n\nIf a task is already defined, it will be augmented by the additional arguments. So, this:\n\n~~~js\ntask(\"one\", [\"othertask\"], function (t) {\n    // do action one...\n    t.done();\n});\n\ntask(\"one\", function (t) {\n    // do action two...\n    t.done();\n});\n\ntask(\"othertask\");\n~~~\n\nWould result in a task \"othertask\" with no prerequisites, and no action, and a task \"one\" with \"othertask\" as a prerequisite and the two functions as its actions.\n\n**Note** how the dependent task was defined *after* it was required as a prerequisite. Task prerequisites are not resolved until the task is invoked. This leads to flexibility in how to compose your tasks and prerequisite tasks.\n\n\n### File Tasks ###\n\nFile tasks are created with the (appropriately named) `file` method. File tasks, however, are only triggered if the file doesn't exist, or the modification time of any of its prerequisites is newer than itself.\n\n~~~js\nfile(\"path/to/some/file\", function (t) {\n    cp(\"other/path\", t.name);\n    t.done();\n});\n~~~\n\nThe above task would only be triggered if `path/to/some/file` did not exist.\n\nThe following:\n\n~~~js\nfile(\"combined/file/path\", [\"pathA\", \"pathB\", \"pathC\"], function (t) {\n    write(t.name, cat(t.prerequisites), \"utf8\");\n    t.done();\n});\n~~~\n\nwould be triggered if `path/to/some/file` did not exist, or its modification time was earlier than any of its prerequisites (`pathA`, `pathB`, or  `pathC`).\n\n\n### Directory Tasks ###\n\nDirectory tasks, created with the `directory` method, are tasks that will only be called if they do not exist. A task will be created for the named directory (and for all directories along the way) with the action of creating the directory.\n\nDirectory tasks do not take any `prerequisites` or an `action` when first defined, however, they may be augmented with such after they are created:\n\n~~~js\ndirectory(\"dir/path/to/create\");\n\ntask(\"dir/path/to/create\", [\"othertask\"], action (t) {\n    //... do stuff\n    t.done();\n});\n~~~\n\n\n### File Create Tasks ###\n\nA file create task is a file task, that when used as a prerequisite, will be needed if, and only if, the file has not been created. Once created, it is not re-triggered if any of its prerequisites are newer, nor does it trigger any rebuilds of tasks that depend on it whenever the file is updated.\n\n~~~js\nfileCreate(\"file/path/to/create.ext\", [\"pathA\", \"pathB\"], function (t) {\n    // create file...\n    t.done();\n});\n~~~\n\n\n(A)Synchronicity and Tasks\n--------------------------\n\nIn **saké** all task actions are assumed to be *asynchronous* and an action must call its task's `done` method to tell **saké** that it is done processing stuff.\n\n~~~js\ntask(\"long task\", function (t) {\n    sh(\"some long running shell command\", function (err, result) {\n        // do stuff...\n        t.done();\n    });\n});\n~~~\n\nAlternatively, you can use the `Sync` version of a task to add an *synchronous* action, and `done` will be called for you.\n\n~~~js\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n~~~\n\nThere are `Sync` versions of all the core tasks: `taskSync`, `fileSync`, and `fileCreateSync` as well as `Async` versions also: `taskAsync`, `fileAsync`, and `fileCreateAsync`. `directory` tasks are always initially *synchronous*. You can add *asynchronous* task actions after the initial definition.\n\nThirdly, you can just specify that all task actions are *synchronous* by setting saké's \"synchronous\" option to `true`, or by use of the command-line options `-S, --synchronous`.\n\n~~~js\nsake.options.synchronous = true;\n\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n\n//... define more synchronous tasks\n\n//... and then revert to async\nsake.options.synchronous = false;\n~~~\n\n\nFile Lists\n----------\n\nFileLists are lists (an `Array`) of files.\n\n~~~js\nnew FileList(\"*.scss\");\n~~~\n\nWould contain all the files with a \".scss\" extension in the top-level directory of your project.\n\nYou can use FileLists pretty much like an `Array`. You can iterate them (with `forEach, filter, reduce`, etc...), `concat` them, `splice` them, and you get back a new FileList object.\n\nTo add files, or glob patterns to them, use the `#include` method:\n\n~~~js\nvar fl = new FileList(\"*.scss\");\nfl.include(\"core.css\", \"reset.css\", \"*.css\");\n~~~\n\nYou can also `exlucude` files by Glob pattern, `Regular Expression` pattern, or by use of a `function` that takes the file path as an argument and returns a `truthy` value to exclude a file.\n\n~~~js\n// Exclude by RegExp\nfl.exclude(/^dev-.*\\.css/);\n\n// Exclude by Glob pattern\nfl.exclude(\"dev-*.css\");\n\n// Exclude by function\nfl.exclude(function (path) {\n    return FS.statSync(path).mtime.getTime() < (Date.now() - 60 * 60 * 1000);\n});\n~~~\n\nTo get to the actual items of the FileList, use the `#items` property, or the `#toArray` method, to get a plain array back. You can also use the `#get` or `#set` methods to retrieve or set an item.\n\nFileLists are *lazy*, in that the actual file paths are not determined from the include and exclude patterns until the individual items are requested. This allows you to define a FileList and incrementally add patterns to it in the Sakefile file. The FileList paths will not be resolved until the task that uses it as a prerequisite actually asks for the final paths.\n\n\n### FileList Utility Properties & Methods ###\n\n*   `existing` &mdash; will return a new `FileList` with all of the files that actually exist.\n*   `notExisting` &mdash; will return a new `FileList` all of the files that do not exist.\n*   `extension(ext)` &mdash; returns a new `FileList` with all paths that match the given extension.\n\n~~~js\nfl.extension(\".scss\").forEach(function (path) {\n    //...\n});\n~~~\n\n*   `grep(pattern)` &mdash; get a `FileList` of all the files that match the given `pattern`. `pattern` can be a plain `String`, a `Glob` pattern, a `RegExp`, or a `function` that receives each path and can return a truthy value include it.\n*   `clearExcludes()` &mdash; clear all exclude patterns/functions.\n*   `clearIncludes()` &mdash; clear all include patterns.\n\n\nSaké Utility Functions\n----------------------\n\nSaké defines a few utility functions to make life a little easier in an asynchronous world. Most of these are just wrappers for `node`'s File System (`require(\"fs\")`) utility methods.\n\n### Synchronous Utilities ###\n\n*   `mkdir(dirpath, mode=\"755\")` &mdash; create the `dirpath` directory, if it doesn't already exist.\n*   `mkdir_p(dirpath, mode=\"755\"])` &mdash; as above, but create all intermediate directories as needed.\n*   `rm(path, [path1, ..., pathN])` &mdash; remove one or more paths from the file system.\n*   `rm_rf(path, [path1, ..., pathN])` &mdash; as above, and remove directories and their contents.\n*   `cp(from, to)` &mdash; copy a file from `from` path to `to` path\n*   `mv(from, to)` &mdash; move a file from `from` path to `to` path.\n*   `ln(from, to)` &mdash; create a hard link from `from` path to `to` path.\n*   `ln_s(from, to)` &mdash; create a symlink from `from` path to `to` path.\n*   `cat(path, [path1, ..., pathN])` &mdash; read all supplied paths and return their contents as a string. If an argument is an `Array` it will be expanded and those paths will be read.\n*   `read(path, [enc])` &mdash; read the supplied file path. Returns a `buffer`, or a `string` if `enc` is given.\n*   `write(path, data, [enc], mode=\"w\")` &mdash; write the `data` to the supplied file `path`. `data` should be a `buffer` or a `string` if `enc` is given. `mode` is a `string` of either \"w\", for over write,  or \"a\" for append.\n*   `slurp(path, [env])` &mdash; alias for `read`\n*   `spit(path, data, [enc], mode=\"w\")` &mdash; alias for `write`\n\n\n### Asynchronous Utilities ###\n\n*   `sh(cmd, fn(error, result))` &mdash; execute shell `cmd`. In the callback function, `error` will be a truthy value if there was an error, and `result` will contain the STDERR returned from `cmd`. Otherwise, `result` will contain the STDOUT from the `cmd`.\n","maintainers":[{"name":"jhamlet","email":"jerry@hamletink.com"}]},"0.1.4":{"name":"sake","description":"[S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.","version":"0.1.4","keywords":["build","make","rake","jake"],"main":"./lib/node_modules/sake/index.js","bin":{"sake":"./bin/sake"},"directories":{"lib":"lib"},"dependencies":{"nomnom":">=1.5.x","async":">=0.1.18","resolve":">=0.2.x","proteus":">=0.0.x","wordwrap":">=0.0.2"},"devDependencies":{"mocha":">=0.3.x","should":">=0.5.x","underscore":">=1.3.x"},"scripts":{"test":"mocha test/test-*"},"licenses":[{"type":"MIT","url":"http://github.com/jhamlet/node-sake/raw/master/LICENSE"}],"repository":{"type":"git","url":"git://github.com/jhamlet/node-sake.git"},"bugs":{"url":"http://github.com/jhamlet/node-sake/issues"},"preferGlobal":true,"_npmUser":{"name":"jhamlet","email":"jerry@hamletink.com"},"_id":"sake@0.1.4","contributors":[{"name":"Jerry Hamlet","email":"jerry@hamletink.com"}],"optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.12","_nodeVersion":"v0.6.10","_defaultsLoaded":true,"dist":{"shasum":"71ffef37efc5a4f539cbd2cb79f8b9ec74e626a9","tarball":"https://registry.npmjs.org/sake/-/sake-0.1.4.tgz","integrity":"sha512-rnsJfy6lWJddwiBUVOOYcCcWQxExPOQ7ITzJKnMrujGQnfQ7ErfwI6Lc5d8mhg/Eh7jq3T8EPQf8u7ZKzITf8w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC1AOhGWmpIp1UTMQ0UHlj/qIjZWVeFPi/KF2pa2xroGAiEAjKwVpzGRZvhj6AA4A7w5V0MKIZf/tEfLJHTZbiVxfLs="}]},"readme":"\nSaké\n====\n\n> [S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.\n\nThis package contains **saké**, a JavaScript build program that runs in node with capabilities similar to ruby's Rake.\n\nSaké has the following features:\n\n1.  `Sakefiles` (saké’s version of Rakefiles) are completely defined in standard JavaScript (or CoffeeScript, for those who want an even more Rake-like feel).\n2.  Flexible `FileLists` that act like arrays but know about manipulating file names and paths.\n3.  `clean` and `clobber` tasks are available for tidying up.\n4.  _Asynchronous_ task handling, with easy options for secifying _synchronous_ tasks.\n5.  Many utility methods for handling common build tasks (rm, rm_rf, mkdir, mkdir_p, sh, cat, etc...)\n\n\nInstallation\n------------\n\n### Install with npm\n\nDownload and install with the following:\n\n~~~\nnpm install -g sake\n~~~\n\nCommand-Line Usage\n------------------\n\n~~~\n% sake -h\n\nusage: sake [TASK] [ARGUMENTS ...] [ENV=VALUE ...] [options]\n\n[TASK]       Name of the task to run. Defaults to 'default'.\n[ARGUMENTS ...]     Zero or more arguments to pass to the task invoked.\n[ENV=VALUE ...]     Zero or more arguments to translate into environment variables.\n\noptions:\n   -f, --sakefile PATH    PATH to Sakefile to run instead of searching for one.\n   -n, --dry-run          Do a dry run without executing actions.\n   -T, --tasks            List tasks with descriptions and exit.\n   -P, --prereqs          List tasks and their prerequisites and exit.\n   -r, --require MODULE   Require MODULE before executing Sakefile and expose the\n                          MODULE under a sanitized namespace (i.e.: coffee-script =>\n                          [sake.]coffeeScript).\n   -S, --sync             Make all standard tasks 'synchronous' by default.\n   -d, --debug            Enable additional debugging output.\n   -q, --quiet            Suppress informational messages.\n   -V, --version          Print the version of sake and exit.\n   -h, --help             Print this help information and exit.\n\nSake will look within the current directory, and all parent directories, for the first `Sakefile`\nit can find, and then invoke the TASK. If no task is given, it will try to invoke the task named\n\"default\".\n\n`Sakefile` can be one of \"Sakefile\", \"sakefile\", \"Sakefile.js\", \"sakefile.js\", \"Sakefile.coffee\",\nor \"sakefile.coffee\"\n~~~\n\n### Dependencies ###\n\nThese are installed when **sake** is installed.\n\n~~~\nnomnom:   >=1.5.x\nasync:    >=0.1.18\nresolve:  >=0.2.x\nproteus:  >=0.0.x\nwordwrap: >=0.0.2\n~~~\n\n\n### Development Dependencies ###\n\nInstalled when you run `npm link` in the package directory.\n\n~~~\nmocha:      >=0.3.x\nshould:     >=0.5.x\nunderscore: >=1.3.x\n~~~\n\n\nSakefile Usage\n--------------\n\nWithin a `Sakefile`, Saké's methods are exported to the global scope, so you can invoke them directly:\n\n~~~js\ntask(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n~~~\n    \nWithin another node module you can `require(\"sake\")` and access the methods on the exported object:\n\n~~~js\nvar sake = require(\"sake\");\n    \nsake.task(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n~~~\n\nThe remainder of this documentation will assume that we are calling the methods from within a `Sakefile`.\n\n\nDefining Tasks\n--------------\n\nThe various task methods take the following arguments:\n\n1.   `taskname`: `string` &mdash; naming the task\n2.   `prerequisites`: _optional_ \n    *   an `array` of:\n        *   `string` task name, or\n        *   a `FileLists`, or \n        *   a `function` that returns one of the above.\n    *   or, you can also pass a `FileList` in directly for `prerequisites`.\n3.   `action`: an _optional_ `function` that will be called when the task is invoked.\n\nAll task methods return the task *instance*.\n\nIf a task is already defined, it will be augmented by the additional arguments. So, this:\n\n~~~js\ntask(\"one\", [\"othertask\"], function (t) {\n    // do action one...\n    t.done();\n});\n\ntask(\"one\", function (t) {\n    // do action two...\n    t.done();\n});\n\ntask(\"othertask\");\n~~~\n\nWould result in a task \"othertask\" with no prerequisites, and no action, and a task \"one\" with \"othertask\" as a prerequisite and the two functions as its actions.\n\n**Note** how the dependent task was defined *after* it was required as a prerequisite. Task prerequisites are not resolved until the task is invoked. This leads to flexibility in how to compose your tasks and prerequisite tasks.\n\n\n### File Tasks ###\n\nFile tasks are created with the (appropriately named) `file` method. File tasks, however, are only triggered if the file doesn't exist, or the modification time of any of its prerequisites is newer than itself.\n\n~~~js\nfile(\"path/to/some/file\", function (t) {\n    cp(\"other/path\", t.name);\n    t.done();\n});\n~~~\n\nThe above task would only be triggered if `path/to/some/file` did not exist.\n\nThe following:\n\n~~~js\nfile(\"combined/file/path\", [\"pathA\", \"pathB\", \"pathC\"], function (t) {\n    write(t.name, cat(t.prerequisites), \"utf8\");\n    t.done();\n});\n~~~\n\nwould be triggered if `path/to/some/file` did not exist, or its modification time was earlier than any of its prerequisites (`pathA`, `pathB`, or  `pathC`).\n\n\n### Directory Tasks ###\n\nDirectory tasks, created with the `directory` method, are tasks that will only be called if they do not exist. A task will be created for the named directory (and for all directories along the way) with the action of creating the directory.\n\nDirectory tasks do not take any `prerequisites` or an `action` when first defined, however, they may be augmented with such after they are created:\n\n~~~js\ndirectory(\"dir/path/to/create\");\n\ntask(\"dir/path/to/create\", [\"othertask\"], action (t) {\n    //... do stuff\n    t.done();\n});\n~~~\n\n\n### File Create Tasks ###\n\nA file create task is a file task, that when used as a prerequisite, will be needed if, and only if, the file has not been created. Once created, it is not re-triggered if any of its prerequisites are newer, nor does it trigger any rebuilds of tasks that depend on it whenever the file is updated.\n\n~~~js\nfileCreate(\"file/path/to/create.ext\", [\"pathA\", \"pathB\"], function (t) {\n    // create file...\n    t.done();\n});\n~~~\n\n\n(A)Synchronicity and Tasks\n--------------------------\n\nIn **saké** all task actions are assumed to be *asynchronous* and an action must call its task's `done` method to tell **saké** that it is done processing stuff.\n\n~~~js\ntask(\"long task\", function (t) {\n    sh(\"some long running shell command\", function (err, result) {\n        // do stuff...\n        t.done();\n    });\n});\n~~~\n\nAlternatively, you can use the `Sync` version of a task to add an *synchronous* action, and `done` will be called for you.\n\n~~~js\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n~~~\n\nThere are `Sync` versions of all the core tasks: `taskSync`, `fileSync`, and `fileCreateSync` as well as `Async` versions also: `taskAsync`, `fileAsync`, and `fileCreateAsync`. `directory` tasks are always initially *synchronous*. You can add *asynchronous* task actions after the initial definition.\n\nThirdly, you can just specify that all task actions are *synchronous* by setting saké's \"synchronous\" option to `true`, or by use of the command-line options `-S, --synchronous`.\n\n~~~js\nsake.options.synchronous = true;\n\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n\n//... define more synchronous tasks\n\n//... and then revert to async\nsake.options.synchronous = false;\n~~~\n\n\nFile Lists\n----------\n\nFileLists are lists (an `Array`) of files.\n\n~~~js\nnew FileList(\"*.scss\");\n~~~\n\nWould contain all the files with a \".scss\" extension in the top-level directory of your project.\n\nYou can use FileLists pretty much like an `Array`. You can iterate them (with `forEach, filter, reduce`, etc...), `concat` them, `splice` them, and you get back a new FileList object.\n\nTo add files, or glob patterns to them, use the `#include` method:\n\n~~~js\nvar fl = new FileList(\"*.scss\");\nfl.include(\"core.css\", \"reset.css\", \"*.css\");\n~~~\n\nYou can also `exlucude` files by Glob pattern, `Regular Expression` pattern, or by use of a `function` that takes the file path as an argument and returns a `truthy` value to exclude a file.\n\n~~~js\n// Exclude by RegExp\nfl.exclude(/^dev-.*\\.css/);\n\n// Exclude by Glob pattern\nfl.exclude(\"dev-*.css\");\n\n// Exclude by function\nfl.exclude(function (path) {\n    return FS.statSync(path).mtime.getTime() < (Date.now() - 60 * 60 * 1000);\n});\n~~~\n\nTo get to the actual items of the FileList, use the `#items` property, or the `#toArray` method, to get a plain array back. You can also use the `#get` or `#set` methods to retrieve or set an item.\n\nFileLists are *lazy*, in that the actual file paths are not determined from the include and exclude patterns until the individual items are requested. This allows you to define a FileList and incrementally add patterns to it in the Sakefile file. The FileList paths will not be resolved until the task that uses it as a prerequisite actually asks for the final paths.\n\n\n### FileList Utility Properties & Methods ###\n\n*   `existing` &mdash; will return a new `FileList` with all of the files that actually exist.\n*   `notExisting` &mdash; will return a new `FileList` all of the files that do not exist.\n*   `extension(ext)` &mdash; returns a new `FileList` with all paths that match the given extension.\n\n~~~js\nfl.extension(\".scss\").forEach(function (path) {\n    //...\n});\n~~~\n\n*   `grep(pattern)` &mdash; get a `FileList` of all the files that match the given `pattern`. `pattern` can be a plain `String`, a `Glob` pattern, a `RegExp`, or a `function` that receives each path and can return a truthy value include it.\n*   `clearExcludes()` &mdash; clear all exclude patterns/functions.\n*   `clearIncludes()` &mdash; clear all include patterns.\n\n\nSaké Utility Functions\n----------------------\n\nSaké defines a few utility functions to make life a little easier in an asynchronous world. Most of these are just wrappers for `node`'s File System (`require(\"fs\")`) utility methods.\n\n### Synchronous Utilities ###\n\n*   `mkdir(dirpath, mode=\"777\")` &mdash; create the `dirpath` directory, if it doesn't already exist.\n*   `mkdir_p(dirpath, mode=\"777\"])` &mdash; as above, but create all intermediate directories as needed.\n*   `rm(path, [path1, ..., pathN])` &mdash; remove one or more paths from the file system.\n*   `rm_rf(path, [path1, ..., pathN])` &mdash; as above, and remove directories and their contents.\n*   `cp(from, to)` &mdash; copy a file from `from` path to `to` path.\n*   `cp_r(from, to)` &mdash; copy all files from `from` path to `to` path.\n*   `mv(from, to)` &mdash; move a file from `from` path to `to` path.\n*   `ln(from, to)` &mdash; create a hard link from `from` path to `to` path.\n*   `ln_s(from, to)` &mdash; create a symlink from `from` path to `to` path.\n*   `cat(path, [path1, ..., pathN])` &mdash; read all supplied paths and return their contents as a string. If an argument is an `Array` it will be expanded and those paths will be read.\n*   `readdir(path)` &mdash; returns the files of directory `path`.\n*   `read(path, [enc])` &mdash; read the supplied file path. Returns a `buffer`, or a `string` if `enc` is given.\n*   `write(path, data, [enc], mode=\"w\")` &mdash; write the `data` to the supplied file `path`. `data` should be a `buffer` or a `string` if `enc` is given. `mode` is a `string` of either \"w\", for over write,  or \"a\" for append.\n*   `slurp(path, [env])` &mdash; alias for `read`\n*   `spit(path, data, [enc], mode=\"w\")` &mdash; alias for `write`\n\n\n### Asynchronous Utilities ###\n\n*   `sh(cmd, fn(error, result))` &mdash; execute shell `cmd`. In the callback function, `error` will be a truthy value if there was an error, and `result` will contain the STDERR returned from `cmd`. Otherwise, `result` will contain the STDOUT from the `cmd`.\n\n\nReport an Issue\n---------------\n\n* [Bugs](http://github.com/jhamlet/node-sake/issues)\n* Contact the author: <jhamlet@hamletink.com>\n\n\nLicense\n-------\n\n> Copyright (c) 2012 Jerry Hamlet <jerry@hamletink.com>\n> \n> Permission is hereby granted, free of charge, to any person\n> obtaining a copy of this software and associated documentation\n> files (the \"Software\"), to deal in the Software without\n> restriction, including without limitation the rights to use,\n> copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the\n> Software is furnished to do so, subject to the following\n> conditions:\n> \n> The above copyright notice and this permission notice shall be\n> included in all copies or substantial portions of the Software.\n> \n> The Software shall be used for Good, not Evil.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n> OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n> HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n> WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n> FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n> OTHER DEALINGS IN THE SOFTWARE.\n","maintainers":[{"name":"jhamlet","email":"jerry@hamletink.com"}]},"0.1.5":{"name":"sake","description":"[S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.","version":"0.1.5","keywords":["build","make","rake","jake"],"main":"./lib/node_modules/sake/index.js","bin":{"sake":"./bin/sake"},"directories":{"lib":"lib"},"dependencies":{"nomnom":">=1.5.x","async":">=0.1.18","resolve":">=0.2.x","proteus":">=0.0.x","wordwrap":">=0.0.2"},"devDependencies":{"mocha":">=0.3.x","should":">=0.5.x","underscore":">=1.3.x"},"scripts":{"test":"mocha test/test-*"},"licenses":[{"type":"MIT","url":"http://github.com/jhamlet/node-sake/raw/master/LICENSE"}],"repository":{"type":"git","url":"git://github.com/jhamlet/node-sake.git"},"bugs":{"url":"http://github.com/jhamlet/node-sake/issues"},"preferGlobal":true,"_npmUser":{"name":"jhamlet","email":"jerry@hamletink.com"},"_id":"sake@0.1.5","contributors":[{"name":"Jerry Hamlet","email":"jerry@hamletink.com"}],"optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.12","_nodeVersion":"v0.6.10","_defaultsLoaded":true,"dist":{"shasum":"21e43d9c5f184cc41618844e6ab3281504ee4650","tarball":"https://registry.npmjs.org/sake/-/sake-0.1.5.tgz","integrity":"sha512-I1FAUCJivQ9n4y9/ak7KVut67HYxlDes6x9wiJzAQmvbdNHQelyR5V5JoG5tE9aVtJNDKIeTMDul+LURut1t/Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDrTTgBfjSUsAOpPjWlpCkDWS1a6emphuOvRG7YNHxPlAiEAy0DlRtSh7OqweY4PL33tyFIOXlRf92nELK1Vd66AMM8="}]},"readme":"\nSaké\n====\n\n> [S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.\n\n\nOverview\n--------\n\nThis package contains **saké**, a JavaScript build program that runs in node with capabilities similar to ruby's Rake.\n\nSaké has the following features:\n\n1.  `Sakefiles` (**saké’s** version of Rakefiles) are completely defined in standard JavaScript (or CoffeeScript, for those who want an even more Rake-like feel).\n2.  Flexible `FileLists` that act like arrays but know about manipulating file names and paths.\n3.  `clean` and `clobber` tasks are available for tidying up.\n4.  _Asynchronous_ task handling, with easy options for specifying _synchronous_ tasks.\n5.  Simple _namespacing_ of tasks to break projects into discreet parts.\n5.  Many utility methods for handling common build tasks (rm, rm_rf, mkdir, mkdir_p, sh, cat, etc...)\n\n\nInstallation\n------------\n\n### Install with npm\n\nDownload and install with the following:\n\n~~~\nnpm install -g sake\n~~~\n\nCommand-Line Usage\n------------------\n\n~~~\n% sake -h\n\nusage: sake [TASK] [ARGUMENTS ...] [ENV=VALUE ...] [options]\n\n[TASK]       Name of the task to run. Defaults to 'default'.\n[ARGUMENTS ...]     Zero or more arguments to pass to the task invoked.\n[ENV=VALUE ...]     Zero or more arguments to translate into environment variables.\n\noptions:\n   -f, --sakefile PATH    PATH to Sakefile to run instead of searching for one.\n   -n, --dry-run          Do a dry run without executing actions.\n   -T, --tasks            List tasks with descriptions and exit.\n   -P, --prereqs          List tasks and their prerequisites and exit.\n   -r, --require MODULE   Require MODULE before executing Sakefile and expose the\n                          MODULE under a sanitized namespace (i.e.: coffee-script =>\n                          [sake.]coffeeScript).\n   -S, --sync             Make all standard tasks 'synchronous' by default.\n   -d, --debug            Enable additional debugging output.\n   -q, --quiet            Suppress informational messages.\n   -V, --version          Print the version of sake and exit.\n   -h, --help             Print this help information and exit.\n\nSake will look within the current directory, and all parent directories, for the first `Sakefile`\nit can find, and then invoke the TASK. If no task is given, it will try to invoke the task named\n\"default\".\n\n`Sakefile` can be one of \"Sakefile\", or \"sakefile\", with an optional extension of \".js\", or\n\".coffee\"\n~~~\n\n### Dependencies ###\n\nThese are installed when **sake** is installed.\n\n~~~\nnomnom:   >=1.5.x\nasync:    >=0.1.18\nresolve:  >=0.2.x\nproteus:  >=0.0.x\nwordwrap: >=0.0.2\n~~~\n\n\n### Development Dependencies ###\n\nInstalled when you run `npm link` in the package directory.\n\n~~~\nmocha:      >=0.3.x\nshould:     >=0.5.x\nunderscore: >=1.3.x\n~~~\n\n\nSakefile Usage\n--------------\n\nWithin a `Sakefile`, Saké's methods are exported to the global scope, so you can invoke them directly:\n\n~~~js\ntask(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n~~~\n    \nWithin another node module you can `require(\"sake\")` and access the methods on the exported object, or even run a block of code in the **saké** context (virtual machine):\n\n~~~js\nvar sake = require(\"sake\");\n    \nsake.task(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n\n// The function passed to sake#run is compiled and run in the sake context.\n// The function **will not** have access to any variables in this scope,\n// nor, will variables leak from the function's scope into this one.\nsake.run(function () {\n    var jsFiles = new FileList(\"src/js/**/*.js\");\n    \n    require(\"sake/clean\");\n    \n    task(\"script-min.js\", jsFiles, function (t) {\n        var cmd = \"infuse \" + jsFiles.map(function (path) {\n                return \"-i \" + path;\n            }) + \" -E\";\n            \n        sh(cmd, function (err, result) {\n            write(t.name, result, \"utf8\");\n            t.done();\n        })\n    });\n    \n    CLEAN.include(\"script-min.js\");\n});\n~~~\n\nThe remainder of this documentation will assume that we are calling the methods from within a `Sakefile`.\n\n\nDefining Tasks\n--------------\n\nThe various task methods take the following arguments:\n\n1.   `taskname`: `string` &mdash; naming the task\n2.   `prerequisites`: _optional_ \n    *   an `array` of:\n        *   `string` task name, or\n        *   a `FileLists`, or \n        *   a `function` that returns one of the above.\n    *   or, you can also pass a `FileList` in directly for `prerequisites`.\n3.   `action`: an _optional_ `function` that will be called when the task is invoked.\n\nAll task methods return the task *instance*.\n\nIf a task is already defined, it will be augmented by the additional arguments. So, this:\n\n~~~js\ntask(\"one\", [\"othertask\"], function (t) {\n    // do action one...\n    t.done();\n});\n\ntask(\"one\", function (t) {\n    // do action two...\n    t.done();\n});\n\ntask(\"othertask\");\n~~~\n\nWould result in a task \"othertask\" with no prerequisites, and no action, and a task \"one\" with \"othertask\" as a prerequisite and the two functions as its actions.\n\n**Note** how the dependent task was defined *after* it was required as a prerequisite. Task prerequisites are not resolved until the task is invoked. This leads to flexibility in how to compose your tasks and prerequisite tasks.\n\n\n### File Tasks ###\n\nFile tasks are created with the (appropriately named) `file` method. File tasks, however, are only triggered if the file doesn't exist, or the modification time of any of its prerequisites is newer than itself.\n\n~~~js\nfile(\"path/to/some/file\", function (t) {\n    cp(\"other/path\", t.name);\n    t.done();\n});\n~~~\n\nThe above task would only be triggered if `path/to/some/file` did not exist.\n\nThe following:\n\n~~~js\nfile(\"combined/file/path\", [\"pathA\", \"pathB\", \"pathC\"], function (t) {\n    write(t.name, cat(t.prerequisites), \"utf8\");\n    t.done();\n});\n~~~\n\nwould be triggered if `path/to/some/file` did not exist, or its modification time was earlier than any of its prerequisites (`pathA`, `pathB`, or  `pathC`).\n\n\n### Directory Tasks ###\n\nDirectory tasks, created with the `directory` method, are tasks that will only be called if they do not exist. A task will be created for the named directory (and for all directories along the way) with the action of creating the directory.\n\nDirectory tasks do not take any `prerequisites` or an `action` when first defined, however, they may be augmented with such after they are created:\n\n~~~js\ndirectory(\"dir/path/to/create\");\n\ntask(\"dir/path/to/create\", [\"othertask\"], action (t) {\n    //... do stuff\n    t.done();\n});\n~~~\n\n\n### File Create Tasks ###\n\nA file create task is a file task, that when used as a prerequisite, will be needed if, and only if, the file has not been created. Once created, it is not re-triggered if any of its prerequisites are newer, nor does it trigger any rebuilds of tasks that depend on it whenever the file is updated.\n\n~~~js\nfileCreate(\"file/path/to/create.ext\", [\"pathA\", \"pathB\"], function (t) {\n    // create file...\n    t.done();\n});\n~~~\n\n\n(A)Synchronicity and Tasks\n--------------------------\n\nIn **saké** all task actions are assumed to be *asynchronous* and an action must call its task's `done` method to tell **saké** that it is done processing stuff.\n\n~~~js\ntask(\"long task\", function (t) {\n    sh(\"some long running shell command\", function (err, result) {\n        // do stuff...\n        t.done();\n    });\n});\n~~~\n\nAlternatively, you can use the `Sync` version of a task to add a *synchronous* action, and `done` will be called for you after the function completes.\n\n~~~js\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n~~~\n\nThere are `Sync` versions of all the core tasks: `taskSync`, `fileSync`, and `fileCreateSync`. Thre are also `Async` versions of each task: `taskAsync`, `fileAsync`, and `fileCreateAsync`. The actions created for a `directory` task are *synchronous*. You can add *asynchronous* task actions after the initial definition.\n\nThirdly, you can specify that all of the core task creation functions generate *synchronous* actions by setting **saké's** \"sync\" option to `true`, or by use of the command-line option `-S, --sync`.\n\n~~~js\nsake.options.sync = true;\n\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n\n//... define more synchronous tasks\n\n//... and then revert to async\nsake.options.sync = false;\n~~~\n\nUltimately, it is up to the **saké** script author to correctly designate a task action as *synchronous* or *asynchronous*. Nothing prevents the running of an *asynchronous* function within a task's *synchronous* action. If nothing is dependent on the result of that action, then no problem would occur. It's when other tasks rely on the completion of certain *asynchronous* actions, that problems may arise.\n\nIn the case of *asynchronous* actions, **Saké** will issue a `WARNING` when it can not detect a `done()` call within that action.\n\n\nNamespaces\n----------\n\n**Saké** supports simple name spacing of tasks. Simply prepend the namespace before the task name with a colon \":\". This can be done when defining a task, or in the list of prerequisites for a task.\n\n~~~js\n// Defines a task 'fuz' in the namespace 'foo' that depends on the task 'buz'\n// in the namespace 'baz'\ntask(\"foo:fuz\", [\"baz:buz\"], function (t) {\n    //...\n    t.done();\n});\n~~~\n\nThen invoke the task as so:\n\n~~~\n% sake foo:fuz\n~~~\n\nYou can also use the convenience function `namespace` to wrap your task definitions for a particular namespace. Any _namespace naked_ definitions will first be tried in the local namespace, otherwise they will fall-back to the default namespace:\n\n~~~js\n\ntask(\"default\", function (t) {\n    //...\n    t.done():\n});\n\ntask(\"bazil\", function (t) {\n    //...\n    t.done():\n});\n\n// define within the 'foo' namespace\nnamespace(\"foo\", function () {\n    \n    // defines 'foo:foom' task\n    task(\"foom\", function (t) {\n        //...\n        t.done():\n    });\n    \n});\n\nnamespace(\"baz\", function () {\n    \n    // this task is defined in the 'baz' namespace, and depends on the\n    // 'foom' task from the 'foo' namespace\n    task(\"bazil\", [\"foo:foom\"], function (t) {\n        //...\n        t.done():\n    });\n    // This task is also defined in the 'baz' namespace. It depends on \n    // the 'bazil' task, which is also defined in 'baz' namespace. It\n    // also depends on the 'default' task in the 'default' (top-level)\n    // namespace.\n    task(\"buzil\", [\"bazil\", \"default\"], function (t), {\n        //...\n        t.done():\n    });\n    // If 'bazil' wasn't defined in the 'baz' namespace, it would resolve\n    // to the 'default' namespace task.\n});\n~~~\n\n**Note:** prerequisite names are tied to the defined task's namespace. i.e: If a task \"foo:fuz\" depends on \"foom\" **saké** will look in the \"foo\" namespace for \"foom\", and then the \"default\" namespace.\n\n**Note:** although the `namespace` functions can be nested, **saké** does not track the hierarchy of `namespace` calls -- if a dependent task is not found in the current task's namespace, it will look for it in the default namespace.\n\n\nFile Lists\n----------\n\nFileLists are lists of file paths.\n\n~~~js\nnew FileList(\"*.scss\");\n~~~\n\nWould contain all the file paths with a \".scss\" extension in the top-level directory of your project.\n\nYou can use FileLists pretty much like an `Array`. You can iterate them (with `forEach, filter, reduce`, etc...), `concat` them, `splice` them, and you get back a new FileList object.\n\nTo add files, or glob patterns to them, use the `#include` method:\n\n~~~js\nvar fl = new FileList(\"*.scss\");\nfl.include(\"core.css\", \"reset.css\", \"*.css\");\n~~~\n\nYou can also `exlucude` files by Glob pattern, `Regular Expression` pattern, or by use of a `function` that takes the file path as an argument and returns a `truthy` value to exclude a file.\n\n~~~js\n// Exclude by RegExp\nfl.exclude(/^dev-.*\\.css/);\n\n// Exclude by Glob pattern\nfl.exclude(\"dev-*.css\");\n\n// Exclude by function\nfl.exclude(function (path) {\n    return FS.statSync(path).mtime.getTime() < (Date.now() - 60 * 60 * 1000);\n});\n~~~\n\nTo get to the actual items of the FileList, use the `#items` property, or the `#toArray` method, to get a plain array back. You can also use the `#get` or `#set` methods to retrieve or set an item.\n\nFileLists are *lazy*, in that the actual file paths are not determined from the include and exclude patterns until the individual items are requested. This allows you to define a FileList and incrementally add patterns to it in the Sakefile file. The FileList paths will not be resolved until the task that uses it as a prerequisite actually asks for the final paths.\n\n\n### FileList Utility Properties & Methods ###\n\n*   `existing` &mdash; will return a new `FileList` with all of the files that actually exist.\n*   `notExisting` &mdash; will return a new `FileList` of all the files that do not exist.\n*   `extension(ext)` &mdash; returns a new `FileList` with all paths that match the given extension.\n\n~~~js\nfl.extension(\".scss\").forEach(function (path) {\n    //...\n});\n~~~\n\n*   `grep(pattern)` &mdash; get a `FileList` of all the files that match the given `pattern`. `pattern` can be a plain `String`, a `Glob` pattern, a `RegExp`, or a `function` that receives each path and can return a truthy value to include it.\n*   `clearExcludes()` &mdash; clear all exclude patterns/functions.\n*   `clearIncludes()` &mdash; clear all include patterns.\n\nBy default, a `FileList` excludes directories. To allow directories call `FileList#clearExcludes()` before requesting any items.\n\n\nThe \"clean\" and \"clobber\" Tasks, and The CLEAN and CLOBBER FileLists\n--------------------------------------------------------------------\n\nWithin a `Sakefile`:\n\n~~~js\n// defines the CLEAN FileList and 'clean' task\nrequire(\"sake/clean\");\n\n// defines the above, and also the CLOBBER FileTask and 'clobber' task\nrequire(\"sake/clobber\");\n~~~\n\nWhen the \"clean\" task is run, it will remove any files that have been included in the `CLEAN FileList`. \"clobber\" will remove any file, or directory, included in the `CLOBBER FileList`.\n\n\nSaké Utility Functions\n----------------------\n\nSaké defines a few utility functions to make life a little easier in an asynchronous world. Most of these are just wrappers for `node`'s File System (`require(\"fs\")`) utility methods.\n\n### Synchronous Utilities ###\n\n*   `mkdir(dirpath, mode=\"777\")` &mdash; create the `dirpath` directory, if it doesn't already exist.\n*   `mkdir_p(dirpath, mode=\"777\"])` &mdash; as above, but create all intermediate directories as needed.\n*   `rm(path, [path1, ..., pathN])` &mdash; remove one or more paths from the file system.\n*   `rm_rf(path, [path1, ..., pathN])` &mdash; as above, and remove directories and their contents.\n*   `cp(from, to)` &mdash; copy a file from `from` path to `to` path.\n*   `cp_r(from, to)` &mdash; copy all files from `from` path to `to` path.\n*   `mv(from, to)` &mdash; move a file from `from` path to `to` path.\n*   `ln(from, to)` &mdash; create a hard link from `from` path to `to` path.\n*   `ln_s(from, to)` &mdash; create a symlink from `from` path to `to` path.\n*   `cat(path, [path1, ..., pathN])` &mdash; read all supplied paths and return their contents as a string. If an argument is an `Array` it will be expanded and those paths will be read.\n*   `readdir(path)` &mdash; returns the files of directory `path`.\n*   `read(path, [enc])` &mdash; read the supplied file path. Returns a `buffer`, or a `string` if `enc` is given.\n*   `write(path, data, [enc], mode=\"w\")` &mdash; write the `data` to the supplied file `path`. `data` should be a `buffer` or a `string` if `enc` is given. `mode` is a `string` of either \"w\", for over write,  or \"a\" for append.\n*   `slurp(path, [env])` &mdash; alias for `read`\n*   `spit(path, data, [enc], mode=\"w\")` &mdash; alias for `write`\n\n\n### Asynchronous Utilities ###\n\n*   `sh(cmd, fn(error, result))` &mdash; execute shell `cmd`. In the callback function, `error` will be a truthy value if there was an error, and `result` will contain the STDERR returned from `cmd`. Otherwise, `result` will contain the STDOUT from the `cmd`.\n\n\nReport an Issue\n---------------\n\n* [Bugs](http://github.com/jhamlet/node-sake/issues)\n* Contact the author: <jhamlet@hamletink.com>\n\n\nLicense\n-------\n\n> Copyright (c) 2012 Jerry Hamlet <jerry@hamletink.com>\n> \n> Permission is hereby granted, free of charge, to any person\n> obtaining a copy of this software and associated documentation\n> files (the \"Software\"), to deal in the Software without\n> restriction, including without limitation the rights to use,\n> copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the\n> Software is furnished to do so, subject to the following\n> conditions:\n> \n> The above copyright notice and this permission notice shall be\n> included in all copies or substantial portions of the Software.\n> \n> The Software shall be used for Good, not Evil.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n> OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n> HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n> WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n> FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n> OTHER DEALINGS IN THE SOFTWARE.\n","maintainers":[{"name":"jhamlet","email":"jerry@hamletink.com"}]},"0.1.6":{"name":"sake","description":"[S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.","version":"0.1.6","keywords":["build","make","rake","jake"],"main":"./lib/node_modules/sake/index.js","bin":{"sake":"./bin/sake"},"directories":{"lib":"lib"},"dependencies":{"nomnom":">=1.5.x","async":">=0.1.18","resolve":">=0.2.x","proteus":">=0.0.x","wordwrap":">=0.0.2"},"devDependencies":{"mocha":">=0.3.x","should":">=0.5.x","underscore":">=1.3.x"},"scripts":{"test":"mocha test/test-*"},"licenses":[{"type":"MIT","url":"http://github.com/jhamlet/node-sake/raw/master/LICENSE"}],"repository":{"type":"git","url":"git://github.com/jhamlet/node-sake.git"},"bugs":{"url":"http://github.com/jhamlet/node-sake/issues"},"preferGlobal":true,"_npmUser":{"name":"jhamlet","email":"jerry@hamletink.com"},"_id":"sake@0.1.6","contributors":[{"name":"Jerry Hamlet","email":"jerry@hamletink.com"}],"optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.12","_nodeVersion":"v0.6.10","_defaultsLoaded":true,"dist":{"shasum":"95d98c5037ab95ba7841cae9bfb1a6f286656018","tarball":"https://registry.npmjs.org/sake/-/sake-0.1.6.tgz","integrity":"sha512-ZjDyCUgi5ps0o3M4JBdYb/2OGEElk335ccZM91QWJ6oG0EZ8rapAZJzEYo28TNbvlkyv9SVcuqt+cZGrm9mgpg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC7t3LGZtCAStI8S+I4Pfb5ClGzYp9SEJ98kEjOgBR7dgIgPr6IDuqyUkICPLhocNF9+ufi26qM5Lm7N64OQixUdrE="}]},"readme":"\nSaké\n====\n\n> [S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.\n\n\nOverview\n--------\n\nThis package contains **saké**, a JavaScript build program that runs in node with capabilities similar to ruby's Rake.\n\nSaké has the following features:\n\n1.  `Sakefiles` (**saké’s** version of Rakefiles) are completely defined in standard JavaScript (or CoffeeScript, for those who want an even more Rake-like feel).\n2.  Flexible `FileLists` that act like arrays but know about manipulating file names and paths.\n3.  `clean` and `clobber` tasks are available for tidying up.\n4.  _Asynchronous_ task handling, with easy options for specifying _synchronous_ tasks.\n5.  Simple _namespacing_ of tasks to break projects into discreet parts.\n5.  Many utility methods for handling common build tasks (rm, rm_rf, mkdir, mkdir_p, sh, cat, etc...)\n\n\nInstallation\n------------\n\n### Install with npm\n\nDownload and install with the following:\n\n~~~\nnpm install -g sake\n~~~\n\nCommand-Line Usage\n------------------\n\n~~~\n% sake -h\n\nusage: sake [TASK] [ARGUMENTS ...] [ENV=VALUE ...] [options]\n\n[TASK]       Name of the task to run. Defaults to 'default'.\n[ARGUMENTS ...]     Zero or more arguments to pass to the task invoked.\n[ENV=VALUE ...]     Zero or more arguments to translate into environment variables.\n\noptions:\n   -f, --sakefile PATH    PATH to Sakefile to run instead of searching for one.\n   -n, --dry-run          Do a dry run without executing actions.\n   -T, --tasks            List tasks with descriptions and exit.\n   -P, --prereqs          List tasks and their prerequisites and exit.\n   -r, --require MODULE   Require MODULE before executing Sakefile and expose the\n                          MODULE under a sanitized namespace (i.e.: coffee-script =>\n                          [sake.]coffeeScript).\n   -S, --sync             Make all standard tasks 'synchronous' by default.\n   -d, --debug            Enable additional debugging output.\n   -q, --quiet            Suppress informational messages.\n   -V, --version          Print the version of sake and exit.\n   -h, --help             Print this help information and exit.\n\nSake will look within the current directory, and all parent directories, for the first `Sakefile`\nit can find, and then invoke the TASK. If no task is given, it will try to invoke the task named\n\"default\".\n\n`Sakefile` can be one of \"Sakefile\", or \"sakefile\", with an optional extension of \".js\", or\n\".coffee\"\n~~~\n\n### Dependencies ###\n\nThese are installed when **sake** is installed.\n\n~~~\nnomnom:   >=1.5.x\nasync:    >=0.1.18\nresolve:  >=0.2.x\nproteus:  >=0.0.x\nwordwrap: >=0.0.2\n~~~\n\n\n### Development Dependencies ###\n\nInstalled when you run `npm link` in the package directory.\n\n~~~\nmocha:      >=0.3.x\nshould:     >=0.5.x\nunderscore: >=1.3.x\n~~~\n\n\nSakefile Usage\n--------------\n\nWithin a `Sakefile`, Saké's methods are exported to the global scope, so you can invoke them directly:\n\n~~~js\ntask(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n~~~\n    \nWithin another node module you can `require(\"sake\")` and access the methods on the exported object, or even run a block of code in the **saké** context (virtual machine):\n\n~~~js\nvar sake = require(\"sake\");\n    \nsake.task(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n\n// The function passed to sake#run is compiled and run in the sake context.\n// The function **will not** have access to any variables in this scope,\n// nor, will variables leak from the function's scope into this one.\nsake.run(function () {\n    var jsFiles = new FileList(\"src/js/**/*.js\");\n    \n    require(\"sake/clean\");\n    \n    task(\"script-min.js\", jsFiles, function (t) {\n        var cmd = \"infuse \" + jsFiles.map(function (path) {\n                return \"-i \" + path;\n            }) + \" -E\";\n            \n        sh(cmd, function (err, result) {\n            write(t.name, result, \"utf8\");\n            t.done();\n        })\n    });\n    \n    CLEAN.include(\"script-min.js\");\n});\n~~~\n\nThe remainder of this documentation will assume that we are calling the methods from within a `Sakefile`.\n\n\nDefining Tasks\n--------------\n\nThe various task methods take the following arguments:\n\n1.   `taskname`: `string` &mdash; naming the task\n2.   `prerequisites`: _optional_ \n    *   an `array` of:\n        *   `string` task name, or\n        *   a `FileLists`, or \n        *   a `function` that returns one of the above.\n    *   or, you can also pass a `FileList` in directly for `prerequisites`.\n3.   `action`: an _optional_ `function` that will be called when the task is invoked. It will be passed the task instance as its first argument, followed by any arguments that it was invoked with (either from the command-line, or through code). Task arguments can also be accessed through the instance's `arguments` property. i.e: `t.arguments`.\n\nAll task methods return the task *instance*.\n\nIf a task is already defined, it will be augmented by the additional arguments. So, this:\n\n~~~js\ntask(\"one\", [\"othertask\"], function (t) {\n    // do action one...\n    t.done();\n});\n\ntask(\"one\", function (t) {\n    // do action two...\n    t.done();\n});\n\ntask(\"othertask\");\n~~~\n\nWould result in a task \"othertask\" with no prerequisites, and no action, and a task \"one\" with \"othertask\" as a prerequisite and the two functions as its actions.\n\n**Note** how the dependent task was defined *after* it was required as a prerequisite. Task prerequisites are not resolved until the task is invoked. This leads to flexibility in how to compose your tasks and prerequisite tasks.\n\n\n### Task Instance Properties and Methods ###\n\n*   `name {string}` &mdash; the name of the task.\n*   `namespace {string}` &mdash; the task's namespace.\n*   `type {string}` &mdash; one of \"task\", \"file-task\", or \"file-create-task\"\n*   `fqn {string}` &mdash; the fully qualified name of the task. i.e: \"namespace:name\".\n*   `prerequisites {array}` &mdash; the list of prerequisite names for the task.\n*   `isNeeded {boolean}` &mdash; whether or not this task needs to run.\n*   `timestamp {boolean}` &mdash; the last modification time for the task.\n*   `invoke([args ...]) {Task}` &mdash; invoke the task passing args to each action for the task. Will run any prerequisites first. Returns the task instance.\n*   `execute([args ...]) {Task}` &mdash; Like `invoke`, but run the task even if it has already been run, or is not needed.\n*   `done()` &mdash; signal that the current task's action is done running.\n*   `abort([msg], [exitCode])` &mdash; abort the currently running task's actions, if _exitCode_ is specified **saké** will exit with that exit code and no other tasks will be processed. Otherwise, task processing will continue as normal.\n\n\n### Task Static Properties and Methods ###\n\n*   `namespace {string}` &mdash; the current namespace.\n*   `invoke(name, [rest ...]) {Task}` &mdash; invoke the named task and pass it the rest of the arguments.\n*   `get(name, [namespace]) {Task}` &mdash; get the task _name_, optionally start looking in _namespace_. Will throw an error if it can not find a task.\n*   `lookup(name, [namespace]) {Task|null}` &mdash; lookup a task with _name_, optionally start looking in _namespace_.\n*   `getAll() {array[Task]}` &mdash; return all defined tasks.\n*   `has(name, [namespace]) {boolean}` &mdash; does the task _name_ exist?\n*   `find(args, sortFn) {array[Task]}` &mdash; search for a task. _args_ can be an object with keys specifying which properties to match on, and their values denoting the value to match. _args_ can also be a function that accepts a task and returns a boolean whether or not that task matches.\n\n\nFile Tasks\n----------\n\nFile tasks are created with the (appropriately named) `file` method. File tasks, however, are only triggered if the file doesn't exist, or the modification time of any of its prerequisites is newer than itself.\n\n~~~js\nfile(\"path/to/some/file\", function (t) {\n    cp(\"other/path\", t.name);\n    t.done();\n});\n~~~\n\nThe above task would only be triggered if `path/to/some/file` did not exist.\n\nThe following:\n\n~~~js\nfile(\"combined/file/path\", [\"pathA\", \"pathB\", \"pathC\"], function (t) {\n    write(t.name, cat(t.prerequisites), \"utf8\");\n    t.done();\n});\n~~~\n\nwould be triggered if `path/to/some/file` did not exist, or its modification time was earlier than any of its prerequisites (`pathA`, `pathB`, or  `pathC`).\n\n\nDirectory Tasks\n---------------\n\nDirectory tasks, created with the `directory` method, are tasks that will only be called if they do not exist. A task will be created for the named directory (and for all directories along the way) with the action of creating the directory.\n\nDirectory tasks do not take any `prerequisites` or an `action` when first defined, however, they may be augmented with such after they are created:\n\n~~~js\ndirectory(\"dir/path/to/create\");\n\ntask(\"dir/path/to/create\", [\"othertask\"], action (t) {\n    //... do stuff\n    t.done();\n});\n~~~\n\n\nFile Create Tasks\n-----------------\n\nA file create task is a file task, that when used as a prerequisite, will be needed if, and only if, the file has not been created. Once created, it is not re-triggered if any of its prerequisites are newer, nor does it trigger any rebuilds of tasks that depend on it whenever the file is updated.\n\n~~~js\nfileCreate(\"file/path/to/create.ext\", [\"pathA\", \"pathB\"], function (t) {\n    // create file...\n    t.done();\n});\n~~~\n\n\n(A)Synchronicity and Tasks\n--------------------------\n\nIn **saké** all task actions are assumed to be *asynchronous* and an action must call its task's `done` method to tell **saké** that it is done processing stuff.\n\n~~~js\ntask(\"long task\", function (t) {\n    sh(\"some long running shell command\", function (err, result) {\n        // do stuff...\n        t.done();\n    });\n});\n~~~\n\nAlternatively, you can use the `Sync` version of a task to add a *synchronous* action, and `done` will be called for you after the function completes.\n\n~~~js\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n~~~\n\nThere are `Sync` versions of all the core tasks: `taskSync`, `fileSync`, and `fileCreateSync`. Thre are also `Async` versions of each task: `taskAsync`, `fileAsync`, and `fileCreateAsync`. The actions created for a `directory` task are *synchronous*. You can add *asynchronous* task actions after the initial definition.\n\nThirdly, you can specify that all of the core task creation functions generate *synchronous* actions by setting **saké's** \"sync\" option to `true`, or by use of the command-line option `-S, --sync`.\n\n~~~js\nsake.options.sync = true;\n\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n\n//... define more synchronous tasks\n\n//... and then revert to async\nsake.options.sync = false;\n~~~\n\nUltimately, it is up to the **saké** script author to correctly designate a task action as *synchronous* or *asynchronous*. Nothing prevents the running of an *asynchronous* function within a task's *synchronous* action. If nothing is dependent on the result of that action, then no problem would occur. It's when other tasks rely on the completion of certain *asynchronous* actions, that problems may arise.\n\nIn the case of *asynchronous* actions, **Saké** will issue a `WARNING` when it can not detect a `done()` call within that action.\n\n\nNamespaces\n----------\n\n**Saké** supports simple name spacing of tasks. Simply prepend the namespace before the task name with a colon \":\". This can be done when defining a task, or in the list of prerequisites for a task.\n\n~~~js\n// Defines a task 'fuz' in the namespace 'foo' that depends on the task 'buz'\n// in the namespace 'baz'\ntask(\"foo:fuz\", [\"baz:buz\"], function (t) {\n    //...\n    t.done();\n});\n~~~\n\nThen invoke the task as so:\n\n~~~\n% sake foo:fuz\n~~~\n\nYou can also use the convenience function `namespace` to wrap your task definitions for a particular namespace. Any _namespace naked_ definitions will first be tried in the local namespace, otherwise they will fall-back to the default namespace:\n\n~~~js\n\ntask(\"default\", function (t) {\n    //...\n    t.done():\n});\n\ntask(\"bazil\", function (t) {\n    //...\n    t.done():\n});\n\n// define within the 'foo' namespace\nnamespace(\"foo\", function () {\n    \n    // defines 'foo:foom' task\n    task(\"foom\", function (t) {\n        //...\n        t.done():\n    });\n    \n});\n\nnamespace(\"baz\", function () {\n    \n    // this task is defined in the 'baz' namespace, and depends on the\n    // 'foom' task from the 'foo' namespace\n    task(\"bazil\", [\"foo:foom\"], function (t) {\n        //...\n        t.done():\n    });\n    // This task is also defined in the 'baz' namespace. It depends on \n    // the 'bazil' task, which is also defined in 'baz' namespace. It\n    // also depends on the 'default' task in the 'default' (top-level)\n    // namespace.\n    task(\"buzil\", [\"bazil\", \"default\"], function (t), {\n        //...\n        t.done():\n    });\n    // If 'bazil' wasn't defined in the 'baz' namespace, it would resolve\n    // to the 'default' namespace task.\n});\n~~~\n\n**Note:** prerequisite names are tied to the defined task's namespace. i.e: If a task \"foo:fuz\" depends on \"foom\" **saké** will look in the \"foo\" namespace for \"foom\", and then the \"default\" namespace.\n\n**Note:** although the `namespace` functions can be nested, **saké** does not track the hierarchy of `namespace` calls -- if a dependent task is not found in the current task's namespace, it will look for it in the default namespace.\n\n\nIncluding Other Saké Files\n-------------------------------------\n\nYou can include other **saké** files with the `include` and `load` methods. The included files will be run in the **saké** context, so any variables they do not declare with the `var` keyword will be set on the global **saké** context. This allows you to break your project build files up into discreet files.\n\nAll `require` and `include`, or `load` statements, are resolved relative to the current file, so you can create your own hierarchy of build dependencies.\n\n\nFile Lists\n----------\n\nFileLists are lists of file paths.\n\n~~~js\nnew FileList(\"*.scss\");\n~~~\n\nWould contain all the file paths with a \".scss\" extension in the top-level directory of your project.\n\nYou can use FileLists pretty much like an `Array`. You can iterate them (with `forEach, filter, reduce`, etc...), `concat` them, `splice` them, and you get back a new FileList object.\n\nTo add files, or glob patterns to them, use the `#include` method:\n\n~~~js\nvar fl = new FileList(\"*.scss\");\nfl.include(\"core.css\", \"reset.css\", \"*.css\");\n~~~\n\nYou can also `exlucude` files by Glob pattern, `Regular Expression` pattern, or by use of a `function` that takes the file path as an argument and returns a `truthy` value to exclude a file.\n\n~~~js\n// Exclude by RegExp\nfl.exclude(/^dev-.*\\.css/);\n\n// Exclude by Glob pattern\nfl.exclude(\"dev-*.css\");\n\n// Exclude by function\nfl.exclude(function (path) {\n    return FS.statSync(path).mtime.getTime() < (Date.now() - 60 * 60 * 1000);\n});\n~~~\n\nTo get to the actual items of the FileList, use the `#items` property, or the `#toArray` method, to get a plain array back. You can also use the `#get` or `#set` methods to retrieve or set an item.\n\nFileLists are *lazy*, in that the actual file paths are not determined from the include and exclude patterns until the individual items are requested. This allows you to define a FileList and incrementally add patterns to it in the Sakefile file. The FileList paths will not be resolved until the task that uses it as a prerequisite actually asks for the final paths.\n\n\n### FileList Utility Properties & Methods ###\n\n*   `existing` &mdash; will return a new `FileList` with all of the files that actually exist.\n*   `notExisting` &mdash; will return a new `FileList` of all the files that do not exist.\n*   `extension(ext)` &mdash; returns a new `FileList` with all paths that match the given extension.\n\n~~~js\nfl.extension(\".scss\").forEach(function (path) {\n    //...\n});\n~~~\n\n*   `grep(pattern)` &mdash; get a `FileList` of all the files that match the given `pattern`. `pattern` can be a plain `String`, a `Glob` pattern, a `RegExp`, or a `function` that receives each path and can return a truthy value to include it.\n*   `clearExcludes()` &mdash; clear all exclude patterns/functions.\n*   `clearIncludes()` &mdash; clear all include patterns.\n\nBy default, a `FileList` excludes directories. To allow directories call `FileList#clearExcludes()` before requesting any items.\n\n\nThe \"clean\" and \"clobber\" Tasks, and The CLEAN and CLOBBER FileLists\n--------------------------------------------------------------------\n\nWithin a `Sakefile`:\n\n~~~js\n// defines the CLEAN FileList and 'clean' task\nrequire(\"sake/clean\");\n\n// defines the above, and also the CLOBBER FileTask and 'clobber' task\nrequire(\"sake/clobber\");\n~~~\n\nWhen the \"clean\" task is run, it will remove any files that have been included in the `CLEAN FileList`. \"clobber\" will remove any file, or directory, included in the `CLOBBER FileList`.\n\n\nSaké Utility Functions\n----------------------\n\nSaké defines a few utility functions to make life a little easier in an asynchronous world. Most of these are just wrappers for `node`'s File System (`require(\"fs\")`) utility methods.\n\n### Synchronous Utilities ###\n\n*   `mkdir(dirpath, mode=\"777\")` &mdash; create the `dirpath` directory, if it doesn't already exist.\n*   `mkdir_p(dirpath, mode=\"777\"])` &mdash; as above, but create all intermediate directories as needed.\n*   `rm(path, [path1, ..., pathN])` &mdash; remove one or more paths from the file system.\n*   `rm_rf(path, [path1, ..., pathN])` &mdash; as above, and remove directories and their contents.\n*   `cp(from, to)` &mdash; copy a file from `from` path to `to` path.\n*   `cp_r(from, to)` &mdash; copy all files from `from` path to `to` path.\n*   `mv(from, to)` &mdash; move a file from `from` path to `to` path.\n*   `ln(from, to)` &mdash; create a hard link from `from` path to `to` path.\n*   `ln_s(from, to)` &mdash; create a symlink from `from` path to `to` path.\n*   `cat(path, [path1, ..., pathN]) {string}` &mdash; read all supplied paths and return their contents as a string. If an argument is an `Array` it will be expanded and those paths will be read.\n*   `readdir(path) {array[string]}` &mdash; returns the files of directory `path`.\n*   `read(path, [enc]) {string|Buffer}` &mdash; read the supplied file path. Returns a `buffer`, or a `string` if `enc` is given.\n*   `write(path, data, [enc], mode=\"w\")` &mdash; write the `data` to the supplied file `path`. `data` should be a `buffer` or a `string` if `enc` is given. `mode` is a `string` of either \"w\", for over write,  or \"a\" for append.\n*   `slurp(path, [env]) {sring|Buffer}` &mdash; alias for `read`\n*   `spit(path, data, [enc], mode=\"w\")` &mdash; alias for `write`\n\n\n### Asynchronous Utilities ###\n\n*   `sh(cmd, fn(error, result))` &mdash; execute shell `cmd`. In the callback function, `error` will be a truthy value if there was an error, and `result` will contain the STDERR returned from `cmd`. Otherwise, `result` will contain the STDOUT from the `cmd`.\n\n\nReport an Issue\n---------------\n\n* [Bugs](http://github.com/jhamlet/node-sake/issues)\n* Contact the author: <jhamlet@hamletink.com>\n\n\nLicense\n-------\n\n> Copyright (c) 2012 Jerry Hamlet <jerry@hamletink.com>\n> \n> Permission is hereby granted, free of charge, to any person\n> obtaining a copy of this software and associated documentation\n> files (the \"Software\"), to deal in the Software without\n> restriction, including without limitation the rights to use,\n> copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the\n> Software is furnished to do so, subject to the following\n> conditions:\n> \n> The above copyright notice and this permission notice shall be\n> included in all copies or substantial portions of the Software.\n> \n> The Software shall be used for Good, not Evil.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n> OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n> HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n> WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n> FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n> OTHER DEALINGS IN THE SOFTWARE.\n\n","maintainers":[{"name":"jhamlet","email":"jerry@hamletink.com"}]},"0.1.7":{"name":"sake","description":"[S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.","version":"0.1.7","keywords":["build","make","rake","jake"],"main":"./lib/node_modules/sake/index.js","bin":{"sake":"./bin/sake"},"directories":{"lib":"lib"},"dependencies":{"nomnom":">=1.5.x","async":">=0.1.18","resolve":">=0.2.x","proteus":">=0.0.x","wordwrap":">=0.0.2"},"devDependencies":{"mocha":">=0.3.x","should":">=0.5.x","underscore":">=1.3.x"},"scripts":{"test":"mocha test/test-*"},"licenses":[{"type":"MIT","url":"http://github.com/jhamlet/node-sake/raw/master/LICENSE"}],"repository":{"type":"git","url":"git://github.com/jhamlet/node-sake.git"},"bugs":{"url":"http://github.com/jhamlet/node-sake/issues"},"preferGlobal":true,"_npmUser":{"name":"jhamlet","email":"jerry@hamletink.com"},"_id":"sake@0.1.7","contributors":[{"name":"Jerry Hamlet","email":"jerry@hamletink.com"}],"optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.12","_nodeVersion":"v0.6.10","_defaultsLoaded":true,"dist":{"shasum":"fffc4bb8a717a447d6bca9579107f32e70090517","tarball":"https://registry.npmjs.org/sake/-/sake-0.1.7.tgz","integrity":"sha512-i8lbkYJgzY0m5pguYFldsoXIc+H5UQQGlSe/zWfDvvteULuEwR77sUAZ0Uags7+lRJLbvipkOxZnaGH4yZQlvQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQClB+StERUFRVineCCRF1s9svBC4QDUKZrVQyCPkGkkkgIgQUmG2KzqjkzMfW3tfWTK+n3EMFXntS3Cn89yG5QvlnM="}]},"readme":"\nSaké\n====\n\n> [S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.\n\n\nOverview\n--------\n\nThis package contains **saké**, a JavaScript build program that runs in node with capabilities similar to ruby's Rake.\n\nSaké has the following features:\n\n1.  `Sakefiles` (**saké’s** version of Rakefiles) are completely defined in standard JavaScript (or CoffeeScript, for those who want an even more Rake-like feel).\n2.  Flexible `FileLists` that act like arrays but know about manipulating file names and paths.\n3.  `clean` and `clobber` tasks are available for tidying up.\n4.  _Asynchronous_ task handling, with easy options for specifying _synchronous_ tasks.\n5.  Simple _namespacing_ of tasks to break projects into discreet parts.\n5.  Many utility methods for handling common build tasks (rm, rm_rf, mkdir, mkdir_p, sh, cat, etc...)\n\n\nInstallation\n------------\n\n### Install with npm\n\nDownload and install with the following:\n\n~~~\nnpm install -g sake\n~~~\n\nCommand-Line Usage\n------------------\n\n~~~\n% sake -h\n\nusage: sake [TASK] [ARGUMENTS ...] [ENV=VALUE ...] [options]\n\n[TASK]       Name of the task to run. Defaults to 'default'.\n[ARGUMENTS ...]     Zero or more arguments to pass to the task invoked.\n[ENV=VALUE ...]     Zero or more arguments to translate into environment variables.\n\noptions:\n   -f, --sakefile PATH    PATH to Sakefile to run instead of searching for one.\n   -n, --dry-run          Do a dry run without executing actions.\n   -T, --tasks            List tasks with descriptions and exit.\n   -P, --prereqs          List tasks and their prerequisites and exit.\n   -r, --require MODULE   Require MODULE before executing Sakefile and expose the\n                          MODULE under a sanitized namespace (i.e.: coffee-script =>\n                          [sake.]coffeeScript).\n   -S, --sync             Make all standard tasks 'synchronous' by default.\n   -d, --debug            Enable additional debugging output.\n   -q, --quiet            Suppress informational messages.\n   -V, --version          Print the version of sake and exit.\n   -h, --help             Print this help information and exit.\n\nSake will look within the current directory, and all parent directories, for the first `Sakefile`\nit can find, and then invoke the TASK. If no task is given, it will try to invoke the task named\n\"default\".\n\n`Sakefile` can be one of \"Sakefile\", or \"sakefile\", with an optional extension of \".js\", or\n\".coffee\"\n~~~\n\n### Dependencies ###\n\nThese are installed when **sake** is installed.\n\n~~~\nnomnom:   >=1.5.x\nasync:    >=0.1.18\nresolve:  >=0.2.x\nproteus:  >=0.0.x\nwordwrap: >=0.0.2\n~~~\n\n\n### Development Dependencies ###\n\nInstalled when you run `npm link` in the package directory.\n\n~~~\nmocha:      >=0.3.x\nshould:     >=0.5.x\nunderscore: >=1.3.x\n~~~\n\n\nSakefile Usage\n--------------\n\nWithin a `Sakefile`, Saké's methods are exported to the global scope, so you can invoke them directly:\n\n~~~js\ntask(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n~~~\n    \nWithin another node module you can `require(\"sake\")` and access the methods on the exported object, or even run a block of code in the **saké** context (virtual machine):\n\n~~~js\nvar sake = require(\"sake\");\n    \nsake.task(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n\n// The function passed to sake#run is compiled and run in the sake context.\n// The function **will not** have access to any variables in this scope,\n// nor, will variables leak from the function's scope into this one.\nsake.run(function () {\n    var jsFiles = new FileList(\"src/js/**/*.js\");\n    \n    require(\"sake/clean\");\n    \n    task(\"script-min.js\", jsFiles, function (t) {\n        var cmd = \"infuse \" + jsFiles.map(function (path) {\n                return \"-i \" + path;\n            }) + \" -E\";\n            \n        sh(cmd, function (err, result) {\n            write(t.name, result, \"utf8\");\n            t.done();\n        })\n    });\n    \n    CLEAN.include(\"script-min.js\");\n});\n~~~\n\nThe remainder of this documentation will assume that we are calling the methods from within a `Sakefile`.\n\n\nDefining Tasks\n--------------\n\nThe various task methods take the following arguments:\n\n1.   `taskname`: `string` &mdash; naming the task\n2.   `prerequisites`: _optional_ \n    *   an `array` of:\n        *   `string` task name, or\n        *   a `FileLists`, or \n        *   a `function` that returns one of the above.\n    *   or, you can also pass a `FileList` in directly for `prerequisites`.\n3.   `action`: an _optional_ `function` that will be called when the task is invoked. It will be passed the task instance as its first argument, followed by any arguments that it was invoked with (either from the command-line, or through code). Task arguments can also be accessed through the instance's `arguments` property. i.e: `t.arguments`.\n\nAll task methods return the task *instance*.\n\nIf a task is already defined, it will be augmented by the additional arguments. So, this:\n\n~~~js\ntask(\"one\", [\"othertask\"], function (t) {\n    // do action one...\n    t.done();\n});\n\ntask(\"one\", function (t) {\n    // do action two...\n    t.done();\n});\n\ntask(\"othertask\");\n~~~\n\nWould result in a task \"othertask\" with no prerequisites, and no action, and a task \"one\" with \"othertask\" as a prerequisite and the two functions as its actions.\n\n**Note** how the dependent task was defined *after* it was required as a prerequisite. Task prerequisites are not resolved until the task is invoked. This leads to flexibility in how to compose your tasks and prerequisite tasks.\n\n\n### Task Instance Properties and Methods ###\n\n*   `name {string}` &mdash; the name of the task.\n*   `namespace {string}` &mdash; the task's namespace.\n*   `type {string}` &mdash; one of \"task\", \"file-task\", or \"file-create-task\"\n*   `fqn {string}` &mdash; the fully qualified name of the task. i.e: \"namespace:name\".\n*   `prerequisites {array}` &mdash; the list of prerequisite names for the task.\n*   `isNeeded {boolean}` &mdash; whether or not this task needs to run.\n*   `timestamp {boolean}` &mdash; the last modification time for the task.\n*   `invoke([args ...]) {Task}` &mdash; invoke the task passing args to each action for the task. Will run any prerequisites first. Returns the task instance.\n*   `execute([args ...]) {Task}` &mdash; Like `invoke`, but run the task even if it has already been run, or is not needed.\n*   `done()` &mdash; signal that the current task's action is done running.\n*   `abort([msg], [exitCode])` &mdash; abort the currently running task's actions, if _exitCode_ is specified **saké** will exit with that exit code and no other tasks will be processed. Otherwise, task processing will continue as normal.\n\n\n### Task Static Properties and Methods ###\n\n*   `namespace {string}` &mdash; the current namespace.\n*   `invoke(name, [rest ...]) {Task}` &mdash; invoke the named task and pass it the rest of the arguments.\n*   `get(name, [namespace]) {Task}` &mdash; get the task _name_, optionally start looking in _namespace_. Will throw an error if it can not find a task.\n*   `lookup(name, [namespace]) {Task|null}` &mdash; lookup a task with _name_, optionally start looking in _namespace_.\n*   `getAll() {array[Task]}` &mdash; return all defined tasks.\n*   `has(name, [namespace]) {boolean}` &mdash; does the task _name_ exist?\n*   `find(args, sortFn) {array[Task]}` &mdash; search for a task. _args_ can be an object with keys specifying which properties to match on, and their values denoting the value to match. _args_ can also be a function that accepts a task and returns a boolean whether or not that task matches.\n\n\nFile Tasks\n----------\n\nFile tasks are created with the (appropriately named) `file` method. File tasks, however, are only triggered if the file doesn't exist, or the modification time of any of its prerequisites is newer than itself.\n\n~~~js\nfile(\"path/to/some/file\", function (t) {\n    cp(\"other/path\", t.name);\n    t.done();\n});\n~~~\n\nThe above task would only be triggered if `path/to/some/file` did not exist.\n\nThe following:\n\n~~~js\nfile(\"combined/file/path\", [\"pathA\", \"pathB\", \"pathC\"], function (t) {\n    write(t.name, cat(t.prerequisites), \"utf8\");\n    t.done();\n});\n~~~\n\nwould be triggered if `path/to/some/file` did not exist, or its modification time was earlier than any of its prerequisites (`pathA`, `pathB`, or  `pathC`).\n\n\nDirectory Tasks\n---------------\n\nDirectory tasks, created with the `directory` method, are tasks that will only be called if they do not exist. A task will be created for the named directory (and for all directories along the way) with the action of creating the directory.\n\nDirectory tasks do not take any `prerequisites` or an `action` when first defined, however, they may be augmented with such after they are created:\n\n~~~js\ndirectory(\"dir/path/to/create\");\n\ntask(\"dir/path/to/create\", [\"othertask\"], action (t) {\n    //... do stuff\n    t.done();\n});\n~~~\n\n\nFile Create Tasks\n-----------------\n\nA file create task is a file task, that when used as a prerequisite, will be needed if, and only if, the file has not been created. Once created, it is not re-triggered if any of its prerequisites are newer, nor does it trigger any rebuilds of tasks that depend on it whenever the file is updated.\n\n~~~js\nfileCreate(\"file/path/to/create.ext\", [\"pathA\", \"pathB\"], function (t) {\n    // create file...\n    t.done();\n});\n~~~\n\n\n(A)Synchronicity and Tasks\n--------------------------\n\nIn **saké** all task actions are assumed to be *asynchronous* and an action must call its task's `done` method to tell **saké** that it is done processing stuff.\n\n~~~js\ntask(\"long task\", function (t) {\n    sh(\"some long running shell command\", function (err, result) {\n        // do stuff...\n        t.done();\n    });\n});\n~~~\n\nAlternatively, you can use the `Sync` version of a task to add a *synchronous* action, and `done` will be called for you after the function completes.\n\n~~~js\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n~~~\n\nThere are `Sync` versions of all the core tasks: `taskSync`, `fileSync`, and `fileCreateSync`. Thre are also `Async` versions of each task: `taskAsync`, `fileAsync`, and `fileCreateAsync`. The actions created for a `directory` task are *synchronous*. You can add *asynchronous* task actions after the initial definition.\n\nThirdly, you can specify that all of the core task creation functions generate *synchronous* actions by setting **saké's** \"sync\" option to `true`, or by use of the command-line option `-S, --sync`.\n\n~~~js\nsake.options.sync = true;\n\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n\n//... define more synchronous tasks\n\n//... and then revert to async\nsake.options.sync = false;\n~~~\n\nUltimately, it is up to the **saké** script author to correctly designate a task action as *synchronous* or *asynchronous*. Nothing prevents the running of an *asynchronous* function within a task's *synchronous* action. If nothing is dependent on the result of that action, then no problem would occur. It's when other tasks rely on the completion of certain *asynchronous* actions, that problems may arise.\n\nIn the case of *asynchronous* actions, **Saké** will issue a `WARNING` when it can not detect a `done()` call within that action.\n\n\nNamespaces\n----------\n\n**Saké** supports simple name spacing of tasks. Simply prepend the namespace before the task name with a colon \":\". This can be done when defining a task, or in the list of prerequisites for a task.\n\n~~~js\n// Defines a task 'fuz' in the namespace 'foo' that depends on the task 'buz'\n// in the namespace 'baz'\ntask(\"foo:fuz\", [\"baz:buz\"], function (t) {\n    //...\n    t.done();\n});\n~~~\n\nThen invoke the task as so:\n\n~~~\n% sake foo:fuz\n~~~\n\nYou can also use the convenience function `namespace` to wrap your task definitions for a particular namespace. Any _namespace naked_ definitions will first be tried in the local namespace, otherwise they will fall-back to the default namespace:\n\n~~~js\n\ntask(\"default\", function (t) {\n    //...\n    t.done():\n});\n\ntask(\"bazil\", function (t) {\n    //...\n    t.done():\n});\n\n// define within the 'foo' namespace\nnamespace(\"foo\", function () {\n    \n    // defines 'foo:foom' task\n    task(\"foom\", function (t) {\n        //...\n        t.done():\n    });\n    \n});\n\nnamespace(\"baz\", function () {\n    \n    // this task is defined in the 'baz' namespace, and depends on the\n    // 'foom' task from the 'foo' namespace\n    task(\"bazil\", [\"foo:foom\"], function (t) {\n        //...\n        t.done():\n    });\n    // This task is also defined in the 'baz' namespace. It depends on \n    // the 'bazil' task, which is also defined in 'baz' namespace. It\n    // also depends on the 'default' task in the 'default' (top-level)\n    // namespace.\n    task(\"buzil\", [\"bazil\", \"default\"], function (t), {\n        //...\n        t.done():\n    });\n    // If 'bazil' wasn't defined in the 'baz' namespace, it would resolve\n    // to the 'default' namespace task.\n});\n~~~\n\n**Note:** prerequisite names are tied to the defined task's namespace. i.e: If a task \"foo:fuz\" depends on \"foom\" **saké** will look in the \"foo\" namespace for \"foom\", and then the \"default\" namespace.\n\n**Note:** although the `namespace` functions can be nested, **saké** does not track the hierarchy of `namespace` calls -- if a dependent task is not found in the current task's namespace, it will look for it in the default namespace.\n\n\nIncluding Other Saké Files\n-------------------------------------\n\nYou can include other **saké** files with the `include` and `load` methods. The included files will be run in the **saké** context, so any variables they do not declare with the `var` keyword will be set on the global **saké** context. This allows you to break your project build files up into discreet files.\n\nAll `require` and `include`, or `load` statements, are resolved relative to the current file, so you can create your own hierarchy of build dependencies.\n\n\nFile Lists\n----------\n\nFileLists are lists of file paths.\n\n~~~js\nnew FileList(\"*.scss\");\n~~~\n\nWould contain all the file paths with a \".scss\" extension in the top-level directory of your project.\n\nYou can use FileLists pretty much like an `Array`. You can iterate them (with `forEach, filter, reduce`, etc...), `concat` them, `splice` them, and you get back a new FileList object.\n\nTo add files, or glob patterns to them, use the `#include` method:\n\n~~~js\nvar fl = new FileList(\"*.scss\");\nfl.include(\"core.css\", \"reset.css\", \"*.css\");\n~~~\n\nYou can also `exlucude` files by Glob pattern, `Regular Expression` pattern, or by use of a `function` that takes the file path as an argument and returns a `truthy` value to exclude a file.\n\n~~~js\n// Exclude by RegExp\nfl.exclude(/^dev-.*\\.css/);\n\n// Exclude by Glob pattern\nfl.exclude(\"dev-*.css\");\n\n// Exclude by function\nfl.exclude(function (path) {\n    return FS.statSync(path).mtime.getTime() < (Date.now() - 60 * 60 * 1000);\n});\n~~~\n\nTo get to the actual items of the FileList, use the `#items` property, or the `#toArray` method, to get a plain array back. You can also use the `#get` or `#set` methods to retrieve or set an item.\n\nFileLists are *lazy*, in that the actual file paths are not determined from the include and exclude patterns until the individual items are requested. This allows you to define a FileList and incrementally add patterns to it in the Sakefile file. The FileList paths will not be resolved until the task that uses it as a prerequisite actually asks for the final paths.\n\n\n### FileList Utility Properties & Methods ###\n\n*   `existing` &mdash; will return a new `FileList` with all of the files that actually exist.\n*   `notExisting` &mdash; will return a new `FileList` of all the files that do not exist.\n*   `extension(ext)` &mdash; returns a new `FileList` with all paths that match the given extension.\n\n~~~js\nfl.extension(\".scss\").forEach(function (path) {\n    //...\n});\n~~~\n\n*   `grep(pattern)` &mdash; get a `FileList` of all the files that match the given `pattern`. `pattern` can be a plain `String`, a `Glob` pattern, a `RegExp`, or a `function` that receives each path and can return a truthy value to include it.\n*   `clearExcludes()` &mdash; clear all exclude patterns/functions.\n*   `clearIncludes()` &mdash; clear all include patterns.\n\nBy default, a `FileList` excludes directories. To allow directories call `FileList#clearExcludes()` before requesting any items.\n\n\nThe \"clean\" and \"clobber\" Tasks, and The CLEAN and CLOBBER FileLists\n--------------------------------------------------------------------\n\nWithin a `Sakefile`:\n\n~~~js\n// defines the CLEAN FileList and 'clean' task\nrequire(\"sake/clean\");\n\n// defines the above, and also the CLOBBER FileTask and 'clobber' task\nrequire(\"sake/clobber\");\n~~~\n\nWhen the \"clean\" task is run, it will remove any files that have been included in the `CLEAN FileList`. \"clobber\" will remove any file, or directory, included in the `CLOBBER FileList`.\n\n\nSaké Utility Functions\n----------------------\n\nSaké defines a few utility functions to make life a little easier in an asynchronous world. Most of these are just wrappers for `node`'s File System (`require(\"fs\")`) utility methods.\n\n### Synchronous Utilities ###\n\n*   `mkdir(dirpath, mode=\"777\")` &mdash; create the `dirpath` directory, if it doesn't already exist.\n*   `mkdir_p(dirpath, mode=\"777\"])` &mdash; as above, but create all intermediate directories as needed.\n*   `rm(path, [path1, ..., pathN])` &mdash; remove one or more paths from the file system.\n*   `rm_rf(path, [path1, ..., pathN])` &mdash; as above, and remove directories and their contents.\n*   `cp(from, to)` &mdash; copy a file from `from` path to `to` path.\n*   `cp_r(from, to)` &mdash; copy all files from `from` path to `to` path.\n*   `mv(from, to)` &mdash; move a file from `from` path to `to` path.\n*   `ln(from, to)` &mdash; create a hard link from `from` path to `to` path.\n*   `ln_s(from, to)` &mdash; create a symlink from `from` path to `to` path.\n*   `cat(path, [path1, ..., pathN]) {string}` &mdash; read all supplied paths and return their contents as a string. If an argument is an `Array` it will be expanded and those paths will be read.\n*   `readdir(path) {array[string]}` &mdash; returns the files of directory `path`.\n*   `read(path, [enc]) {string|Buffer}` &mdash; read the supplied file path. Returns a `buffer`, or a `string` if `enc` is given.\n*   `write(path, data, [enc], mode=\"w\")` &mdash; write the `data` to the supplied file `path`. `data` should be a `buffer` or a `string` if `enc` is given. `mode` is a `string` of either \"w\", for over write,  or \"a\" for append.\n*   `slurp(path, [env]) {sring|Buffer}` &mdash; alias for `read`\n*   `spit(path, data, [enc], mode=\"w\")` &mdash; alias for `write`\n\n\n### Asynchronous Utilities ###\n\n*   `sh(cmd, fn(error, result))` &mdash; execute shell `cmd`. In the callback function, `error` will be a truthy value if there was an error, and `result` will contain the STDERR returned from `cmd`. Otherwise, `result` will contain the STDOUT from the `cmd`.\n\n\nReport an Issue\n---------------\n\n* [Bugs](http://github.com/jhamlet/node-sake/issues)\n* Contact the author: <jhamlet@hamletink.com>\n\n\nLicense\n-------\n\n> Copyright (c) 2012 Jerry Hamlet <jerry@hamletink.com>\n> \n> Permission is hereby granted, free of charge, to any person\n> obtaining a copy of this software and associated documentation\n> files (the \"Software\"), to deal in the Software without\n> restriction, including without limitation the rights to use,\n> copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the\n> Software is furnished to do so, subject to the following\n> conditions:\n> \n> The above copyright notice and this permission notice shall be\n> included in all copies or substantial portions of the Software.\n> \n> The Software shall be used for Good, not Evil.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n> OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n> HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n> WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n> FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n> OTHER DEALINGS IN THE SOFTWARE.\n\n","maintainers":[{"name":"jhamlet","email":"jerry@hamletink.com"}]},"0.1.8":{"name":"sake","description":"[S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.","version":"0.1.8","keywords":["build","make","rake","jake"],"main":"./lib/node_modules/sake/index.js","bin":{"sake":"./bin/sake"},"directories":{"lib":"lib"},"dependencies":{"nomnom":">=1.5.x","async":">=0.1.18","resolve":">=0.2.x","proteus":">=0.0.x","wordwrap":">=0.0.2"},"devDependencies":{"mocha":">=0.3.x","should":">=0.5.x","underscore":">=1.3.x"},"scripts":{"test":"mocha test/test-*"},"licenses":[{"type":"MIT","url":"http://github.com/jhamlet/node-sake/raw/master/LICENSE"}],"repository":{"type":"git","url":"git://github.com/jhamlet/node-sake.git"},"bugs":{"url":"http://github.com/jhamlet/node-sake/issues"},"preferGlobal":true,"_npmUser":{"name":"jhamlet","email":"jerry@hamletink.com"},"_id":"sake@0.1.8","contributors":[{"name":"Jerry Hamlet","email":"jerry@hamletink.com"}],"optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.12","_nodeVersion":"v0.6.10","_defaultsLoaded":true,"dist":{"shasum":"63b192000377da823dffd1f046ce54b89c46b284","tarball":"https://registry.npmjs.org/sake/-/sake-0.1.8.tgz","integrity":"sha512-7U6AXDXbxOQZfiwuElYIrrdElmKJIbAAUIABr06awL2OZNIHS8PaNE8vFgIVvRZMyU5yKTWP59P0trrH1JMaUw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBTjOeGCD8Df3bUqe2yivpRo9PjI8jG5VBJnAXSxA07nAiA9gPUD7U5ZRw3d3olmF6doIgECDwgrYbvVKgT3d/OKmQ=="}]},"readme":"\nSaké\n====\n\n> [S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.\n\n\nOverview\n--------\n\nThis package contains **saké**, a JavaScript build program that runs in node with capabilities similar to ruby's Rake.\n\nSaké has the following features:\n\n1.  `Sakefiles` (**saké’s** version of Rakefiles) are completely defined in standard JavaScript (or CoffeeScript, for those who want an even more Rake-like feel).\n2.  Flexible `FileLists` that act like arrays but know about manipulating file names and paths.\n3.  `clean` and `clobber` tasks are available for tidying up.\n4.  _Asynchronous_ task handling, with easy options for specifying _synchronous_ tasks.\n5.  Simple _namespacing_ of tasks to break projects into discreet parts.\n5.  Many utility methods for handling common build tasks (rm, rm_rf, mkdir, mkdir_p, sh, cat, etc...)\n\n\nInstallation\n------------\n\n### Install with npm\n\nDownload and install with the following:\n\n~~~\nnpm install -g sake\n~~~\n\nCommand-Line Usage\n------------------\n\n~~~\n% sake -h\n\nusage: sake [TASK] [ARGUMENTS ...] [ENV=VALUE ...] [options]\n\n[TASK]       Name of the task to run. Defaults to 'default'.\n[ARGUMENTS ...]     Zero or more arguments to pass to the task invoked.\n[ENV=VALUE ...]     Zero or more arguments to translate into environment variables.\n\noptions:\n   -f, --sakefile PATH    PATH to Sakefile to run instead of searching for one.\n   -n, --dry-run          Do a dry run without executing actions.\n   -T, --tasks            List tasks with descriptions and exit.\n   -P, --prereqs          List tasks and their prerequisites and exit.\n   -r, --require MODULE   Require MODULE before executing Sakefile and expose the\n                          MODULE under a sanitized namespace (i.e.: coffee-script =>\n                          [sake.]coffeeScript).\n   -S, --sync             Make all standard tasks 'synchronous' by default.\n   -d, --debug            Enable additional debugging output.\n   -q, --quiet            Suppress informational messages.\n   -V, --version          Print the version of sake and exit.\n   -h, --help             Print this help information and exit.\n\nSake will look within the current directory, and all parent directories, for the first `Sakefile`\nit can find, and then invoke the TASK. If no task is given, it will try to invoke the task named\n\"default\".\n\n`Sakefile` can be one of \"Sakefile\", or \"sakefile\", with an optional extension of \".js\", or\n\".coffee\"\n~~~\n\n### Dependencies ###\n\nThese are installed when **sake** is installed.\n\n~~~\nnomnom:   >=1.5.x\nasync:    >=0.1.18\nresolve:  >=0.2.x\nproteus:  >=0.0.x\nwordwrap: >=0.0.2\n~~~\n\n\n### Development Dependencies ###\n\nInstalled when you run `npm link` in the package directory.\n\n~~~\nmocha:      >=0.3.x\nshould:     >=0.5.x\nunderscore: >=1.3.x\n~~~\n\n\nSakefile Usage\n--------------\n\nWithin a `Sakefile`, Saké's methods are exported to the global scope, so you can invoke them directly:\n\n~~~js\ntask(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n~~~\n    \nWithin another node module you can `require(\"sake\")` and access the methods on the exported object, or even run a block of code in the **saké** context (virtual machine):\n\n~~~js\nvar sake = require(\"sake\");\n    \nsake.task(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n\n// The function passed to sake#run is compiled and run in the sake context.\n// The function **will not** have access to any variables in this scope,\n// nor, will variables leak from the function's scope into this one.\nsake.run(function () {\n    var jsFiles = new FileList(\"src/js/**/*.js\");\n    \n    require(\"sake/clean\");\n    \n    task(\"script-min.js\", jsFiles, function (t) {\n        var cmd = \"infuse \" + jsFiles.map(function (path) {\n                return \"-i \" + path;\n            }) + \" -E\";\n            \n        sh(cmd, function (err, result) {\n            write(t.name, result, \"utf8\");\n            t.done();\n        })\n    });\n    \n    CLEAN.include(\"script-min.js\");\n});\n~~~\n\nThe remainder of this documentation will assume that we are calling the methods from within a `Sakefile`.\n\n\nDefining Tasks\n--------------\n\nThe various task methods take the following arguments:\n\n1.   `taskname`: `string` &mdash; naming the task\n2.   `prerequisites`: _optional_ \n    *   an `array` of:\n        *   `string` task name, or\n        *   a `FileLists`, or \n        *   a `function` that returns one of the above.\n    *   or, you can also pass a `FileList` in directly for `prerequisites`.\n3.   `action`: an _optional_ `function` that will be called when the task is invoked. It will be passed the task instance as its first argument, followed by any arguments that it was invoked with (either from the command-line, or through code). Task arguments can also be accessed through the instance's `arguments` property. i.e: `t.arguments`.\n\nAll task methods return the task *instance*.\n\nIf a task is already defined, it will be augmented by the additional arguments. So, this:\n\n~~~js\ntask(\"one\", [\"othertask\"], function (t) {\n    // do action one...\n    t.done();\n});\n\ntask(\"one\", function (t) {\n    // do action two...\n    t.done();\n});\n\ntask(\"othertask\");\n~~~\n\nWould result in a task \"othertask\" with no prerequisites, and no action, and a task \"one\" with \"othertask\" as a prerequisite and the two functions as its actions.\n\n**Note** how the dependent task was defined *after* it was required as a prerequisite. Task prerequisites are not resolved until the task is invoked. This leads to flexibility in how to compose your tasks and prerequisite tasks.\n\n\n### Task Instance Properties and Methods ###\n\n*   `name {string}` &mdash; the name of the task.\n*   `namespace {string}` &mdash; the task's namespace.\n*   `type {string}` &mdash; one of \"task\", \"file-task\", or \"file-create-task\"\n*   `fqn {string}` &mdash; the fully qualified name of the task. i.e: \"namespace:name\".\n*   `prerequisites {array}` &mdash; the list of prerequisite names for the task.\n*   `isNeeded {boolean}` &mdash; whether or not this task needs to run.\n*   `timestamp {boolean}` &mdash; the last modification time for the task.\n*   `invoke([args ...]) {Task}` &mdash; invoke the task passing args to each action for the task. Will run any prerequisites first. Returns the task instance.\n*   `execute([args ...]) {Task}` &mdash; Like `invoke`, but run the task even if it has already been run, or is not needed.\n*   `done()` &mdash; signal that the current task's action is done running.\n*   `abort([msg], [exitCode])` &mdash; abort the currently running task's actions, if _exitCode_ is specified **saké** will exit with that exit code and no other tasks will be processed. Otherwise, task processing will continue as normal.\n\n\n### Task Static Properties and Methods ###\n\n*   `namespace {string}` &mdash; the current namespace.\n*   `invoke(name, [rest ...]) {Task}` &mdash; invoke the named task and pass it the rest of the arguments.\n*   `get(name, [namespace]) {Task}` &mdash; get the task _name_, optionally start looking in _namespace_. Will throw an error if it can not find a task.\n*   `lookup(name, [namespace]) {Task|null}` &mdash; lookup a task with _name_, optionally start looking in _namespace_.\n*   `getAll() {array[Task]}` &mdash; return all defined tasks.\n*   `has(name, [namespace]) {boolean}` &mdash; does the task _name_ exist?\n*   `find(args, sortFn) {array[Task]}` &mdash; search for a task. _args_ can be an object with keys specifying which properties to match on, and their values denoting the value to match. _args_ can also be a function that accepts a task and returns a boolean whether or not that task matches.\n\n\nFile Tasks\n----------\n\nFile tasks are created with the (appropriately named) `file` method. File tasks, however, are only triggered if the file doesn't exist, or the modification time of any of its prerequisites is newer than itself.\n\n~~~js\nfile(\"path/to/some/file\", function (t) {\n    cp(\"other/path\", t.name);\n    t.done();\n});\n~~~\n\nThe above task would only be triggered if `path/to/some/file` did not exist.\n\nThe following:\n\n~~~js\nfile(\"combined/file/path\", [\"pathA\", \"pathB\", \"pathC\"], function (t) {\n    write(t.name, cat(t.prerequisites), \"utf8\");\n    t.done();\n});\n~~~\n\nwould be triggered if `path/to/some/file` did not exist, or its modification time was earlier than any of its prerequisites (`pathA`, `pathB`, or  `pathC`).\n\n\nDirectory Tasks\n---------------\n\nDirectory tasks, created with the `directory` method, are tasks that will only be called if they do not exist. A task will be created for the named directory (and for all directories along the way) with the action of creating the directory.\n\nDirectory tasks do not take any `prerequisites` or an `action` when first defined, however, they may be augmented with such after they are created:\n\n~~~js\ndirectory(\"dir/path/to/create\");\n\ntask(\"dir/path/to/create\", [\"othertask\"], action (t) {\n    //... do stuff\n    t.done();\n});\n~~~\n\n\nFile Create Tasks\n-----------------\n\nA file create task is a file task, that when used as a prerequisite, will be needed if, and only if, the file has not been created. Once created, it is not re-triggered if any of its prerequisites are newer, nor does it trigger any rebuilds of tasks that depend on it whenever the file is updated.\n\n~~~js\nfileCreate(\"file/path/to/create.ext\", [\"pathA\", \"pathB\"], function (t) {\n    // create file...\n    t.done();\n});\n~~~\n\n\n(A)Synchronicity and Tasks\n--------------------------\n\nIn **saké** all task actions are assumed to be *asynchronous* and an action must call its task's `done` method to tell **saké** that it is done processing stuff.\n\n~~~js\ntask(\"long task\", function (t) {\n    sh(\"some long running shell command\", function (err, result) {\n        // do stuff...\n        t.done();\n    });\n});\n~~~\n\nAlternatively, you can use the `Sync` version of a task to add a *synchronous* action, and `done` will be called for you after the function completes.\n\n~~~js\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n~~~\n\nThere are `Sync` versions of all the core tasks: `taskSync`, `fileSync`, and `fileCreateSync`. Thre are also `Async` versions of each task: `taskAsync`, `fileAsync`, and `fileCreateAsync`. The actions created for a `directory` task are *synchronous*. You can add *asynchronous* task actions after the initial definition.\n\nThirdly, you can specify that all of the core task creation functions generate *synchronous* actions by setting **saké's** \"sync\" option to `true`, or by use of the command-line option `-S, --sync`.\n\n~~~js\nsake.options.sync = true;\n\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n\n//... define more synchronous tasks\n\n//... and then revert to async\nsake.options.sync = false;\n~~~\n\nUltimately, it is up to the **saké** script author to correctly designate a task action as *synchronous* or *asynchronous*. Nothing prevents the running of an *asynchronous* function within a task's *synchronous* action. If nothing is dependent on the result of that action, then no problem would occur. It's when other tasks rely on the completion of certain *asynchronous* actions, that problems may arise.\n\nIn the case of *asynchronous* actions, **Saké** will issue a `WARNING` when it can not detect a `done()` call within that action.\n\n\nNamespaces\n----------\n\n**Saké** supports simple name spacing of tasks. Simply prepend the namespace before the task name with a colon \":\". This can be done when defining a task, or in the list of prerequisites for a task.\n\n~~~js\n// Defines a task 'fuz' in the namespace 'foo' that depends on the task 'buz'\n// in the namespace 'baz'\ntask(\"foo:fuz\", [\"baz:buz\"], function (t) {\n    //...\n    t.done();\n});\n~~~\n\nThen invoke the task as so:\n\n~~~\n% sake foo:fuz\n~~~\n\nYou can also use the convenience function `namespace` to wrap your task definitions for a particular namespace. Any _namespace naked_ definitions will first be tried in the local namespace, otherwise they will fall-back to the default namespace:\n\n~~~js\n\ntask(\"default\", function (t) {\n    //...\n    t.done():\n});\n\ntask(\"bazil\", function (t) {\n    //...\n    t.done():\n});\n\n// define within the 'foo' namespace\nnamespace(\"foo\", function () {\n    \n    // defines 'foo:foom' task\n    task(\"foom\", function (t) {\n        //...\n        t.done():\n    });\n    \n});\n\nnamespace(\"baz\", function () {\n    \n    // this task is defined in the 'baz' namespace, and depends on the\n    // 'foom' task from the 'foo' namespace\n    task(\"bazil\", [\"foo:foom\"], function (t) {\n        //...\n        t.done():\n    });\n    // This task is also defined in the 'baz' namespace. It depends on \n    // the 'bazil' task, which is also defined in 'baz' namespace. It\n    // also depends on the 'default' task in the 'default' (top-level)\n    // namespace.\n    task(\"buzil\", [\"bazil\", \"default\"], function (t), {\n        //...\n        t.done():\n    });\n    // If 'bazil' wasn't defined in the 'baz' namespace, it would resolve\n    // to the 'default' namespace task.\n});\n~~~\n\n**Note:** prerequisite names are tied to the defined task's namespace. i.e: If a task \"foo:fuz\" depends on \"foom\" **saké** will look in the \"foo\" namespace for \"foom\", and then the \"default\" namespace.\n\n**Note:** although the `namespace` functions can be nested, **saké** does not track the hierarchy of `namespace` calls -- if a dependent task is not found in the current task's namespace, it will look for it in the default namespace.\n\n\nIncluding Other Saké Files\n-------------------------------------\n\nYou can include other **saké** files with the `include` and `load` methods. The included files will be run in the **saké** context, so any variables they do not declare with the `var` keyword will be set on the global **saké** context. This allows you to break your project build files up into discreet files.\n\nAll `require` and `include`, or `load` statements, are resolved relative to the current file, so you can create your own hierarchy of build dependencies.\n\n\nFile Lists\n----------\n\nFileLists are lists of file paths.\n\n~~~js\nnew FileList(\"*.scss\");\n~~~\n\nWould contain all the file paths with a \".scss\" extension in the top-level directory of your project.\n\nYou can use FileLists pretty much like an `Array`. You can iterate them (with `forEach, filter, reduce`, etc...), `concat` them, `splice` them, and you get back a new FileList object.\n\nTo add files, or glob patterns to them, use the `#include` method:\n\n~~~js\nvar fl = new FileList(\"*.scss\");\nfl.include(\"core.css\", \"reset.css\", \"*.css\");\n~~~\n\nYou can also `exlucude` files by Glob pattern, `Regular Expression` pattern, or by use of a `function` that takes the file path as an argument and returns a `truthy` value to exclude a file.\n\n~~~js\n// Exclude by RegExp\nfl.exclude(/^dev-.*\\.css/);\n\n// Exclude by Glob pattern\nfl.exclude(\"dev-*.css\");\n\n// Exclude by function\nfl.exclude(function (path) {\n    return FS.statSync(path).mtime.getTime() < (Date.now() - 60 * 60 * 1000);\n});\n~~~\n\nTo get to the actual items of the FileList, use the `#items` property, or the `#toArray` method, to get a plain array back. You can also use the `#get` or `#set` methods to retrieve or set an item.\n\nFileLists are *lazy*, in that the actual file paths are not determined from the include and exclude patterns until the individual items are requested. This allows you to define a FileList and incrementally add patterns to it in the Sakefile file. The FileList paths will not be resolved until the task that uses it as a prerequisite actually asks for the final paths.\n\n\n### FileList Utility Properties & Methods ###\n\n*   `existing` &mdash; will return a new `FileList` with all of the files that actually exist.\n*   `notExisting` &mdash; will return a new `FileList` of all the files that do not exist.\n*   `extension(ext)` &mdash; returns a new `FileList` with all paths that match the given extension.\n\n~~~js\nfl.extension(\".scss\").forEach(function (path) {\n    //...\n});\n~~~\n\n*   `grep(pattern)` &mdash; get a `FileList` of all the files that match the given `pattern`. `pattern` can be a plain `String`, a `Glob` pattern, a `RegExp`, or a `function` that receives each path and can return a truthy value to include it.\n*   `clearExcludes()` &mdash; clear all exclude patterns/functions.\n*   `clearIncludes()` &mdash; clear all include patterns.\n\nBy default, a `FileList` excludes directories. To allow directories call `FileList#clearExcludes()` before requesting any items.\n\n\nThe \"clean\" and \"clobber\" Tasks, and The CLEAN and CLOBBER FileLists\n--------------------------------------------------------------------\n\nWithin a `Sakefile`:\n\n~~~js\n// defines the CLEAN FileList and 'clean' task\nrequire(\"sake/clean\");\n\n// defines the above, and also the CLOBBER FileTask and 'clobber' task\nrequire(\"sake/clobber\");\n~~~\n\nWhen the \"clean\" task is run, it will remove any files that have been included in the `CLEAN FileList`. \"clobber\" will remove any file, or directory, included in the `CLOBBER FileList`.\n\n\nSaké Utility Functions\n----------------------\n\nSaké defines a few utility functions to make life a little easier in an asynchronous world. Most of these are just wrappers for `node`'s File System (`require(\"fs\")`) utility methods.\n\n### Synchronous Utilities ###\n\n*   `mkdir(dirpath, mode=\"777\")` &mdash; create the `dirpath` directory, if it doesn't already exist.\n*   `mkdir_p(dirpath, mode=\"777\"])` &mdash; as above, but create all intermediate directories as needed.\n*   `rm(path, [path1, ..., pathN])` &mdash; remove one or more paths from the file system.\n*   `rm_rf(path, [path1, ..., pathN])` &mdash; as above, and remove directories and their contents.\n*   `cp(from, to)` &mdash; copy a file from `from` path to `to` path.\n*   `cp_r(from, to)` &mdash; copy all files from `from` path to `to` path.\n*   `mv(from, to)` &mdash; move a file from `from` path to `to` path.\n*   `ln(from, to)` &mdash; create a hard link from `from` path to `to` path.\n*   `ln_s(from, to)` &mdash; create a symlink from `from` path to `to` path.\n*   `cat(path, [path1, ..., pathN]) {string}` &mdash; read all supplied paths and return their contents as a string. If an argument is an `Array` it will be expanded and those paths will be read.\n*   `readdir(path) {array[string]}` &mdash; returns the files of directory `path`.\n*   `read(path, [enc]) {string|Buffer}` &mdash; read the supplied file path. Returns a `buffer`, or a `string` if `enc` is given.\n*   `write(path, data, [enc], mode=\"w\")` &mdash; write the `data` to the supplied file `path`. `data` should be a `buffer` or a `string` if `enc` is given. `mode` is a `string` of either \"w\", for over write,  or \"a\" for append.\n*   `slurp(path, [env]) {sring|Buffer}` &mdash; alias for `read`\n*   `spit(path, data, [enc], mode=\"w\")` &mdash; alias for `write`\n\n\n### Asynchronous Utilities ###\n\n*   `sh(cmd, fn(error, result))` &mdash; execute shell `cmd`. In the callback function, `error` will be a truthy value if there was an error, and `result` will contain the STDERR returned from `cmd`. Otherwise, `result` will contain the STDOUT from the `cmd`.\n\n\nReport an Issue\n---------------\n\n* [Bugs](http://github.com/jhamlet/node-sake/issues)\n* Contact the author: <jhamlet@hamletink.com>\n\n\nLicense\n-------\n\n> Copyright (c) 2012 Jerry Hamlet <jerry@hamletink.com>\n> \n> Permission is hereby granted, free of charge, to any person\n> obtaining a copy of this software and associated documentation\n> files (the \"Software\"), to deal in the Software without\n> restriction, including without limitation the rights to use,\n> copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the\n> Software is furnished to do so, subject to the following\n> conditions:\n> \n> The above copyright notice and this permission notice shall be\n> included in all copies or substantial portions of the Software.\n> \n> The Software shall be used for Good, not Evil.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n> OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n> HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n> WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n> FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n> OTHER DEALINGS IN THE SOFTWARE.\n\n","maintainers":[{"name":"jhamlet","email":"jerry@hamletink.com"}]},"0.1.9":{"name":"sake","description":"[S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.","version":"0.1.9","keywords":["build","make","rake","jake"],"main":"./lib/node_modules/sake/index.js","bin":{"sake":"./bin/sake"},"directories":{"lib":"lib"},"dependencies":{"nomnom":">=1.5.x","async":">=0.1.18","resolve":">=0.2.x","proteus":">=0.0.x","wordwrap":">=0.0.2"},"devDependencies":{"mocha":">=0.3.x","should":">=0.5.x","underscore":">=1.3.x"},"scripts":{"test":"mocha test/test-*"},"licenses":[{"type":"MIT","url":"http://github.com/jhamlet/node-sake/raw/master/LICENSE"}],"repository":{"type":"git","url":"git://github.com/jhamlet/node-sake.git"},"bugs":{"url":"http://github.com/jhamlet/node-sake/issues"},"preferGlobal":true,"_npmUser":{"name":"jhamlet","email":"jerry@hamletink.com"},"_id":"sake@0.1.9","contributors":[{"name":"Jerry Hamlet","email":"jerry@hamletink.com"}],"optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.12","_nodeVersion":"v0.6.10","_defaultsLoaded":true,"dist":{"shasum":"5ddc46ced1dc01780cdef582ff87e97b7a04083d","tarball":"https://registry.npmjs.org/sake/-/sake-0.1.9.tgz","integrity":"sha512-8nZPRR+M4aC4oMkPpFHdc3vgttuq22T4AqSQ2plcA/Hk2z/bNEdhJCMiz/7Hd+mAQrs/xC/gE0IS0NKeClkI+A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDPczkZq9+8PQPOCM5S3Ys5Jmt2Npj5q0LOXDtt28f7vAIgPa6+kQTru1x3iz+XoWKkD/iAOk/PiiATWe+cY1NYOIg="}]},"readme":"\nSaké\n====\n\n> [S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.\n\n\nOverview\n--------\n\nThis package contains **saké**, a JavaScript build program that runs in node with capabilities similar to ruby's Rake.\n\nSaké has the following features:\n\n1.  `Sakefiles` (**saké’s** version of Rakefiles) are completely defined in standard JavaScript (or CoffeeScript, for those who want an even more Rake-like feel).\n2.  Flexible `FileLists` that act like arrays but know about manipulating file names and paths.\n3.  `clean` and `clobber` tasks are available for tidying up.\n4.  _Asynchronous_ task handling, with easy options for specifying _synchronous_ tasks.\n5.  Simple _namespacing_ of tasks to break projects into discreet parts.\n5.  Many utility methods for handling common build tasks (rm, rm_rf, mkdir, mkdir_p, sh, cat, etc...)\n\n\nInstallation\n------------\n\n### Install with npm\n\nDownload and install with the following:\n\n~~~\nnpm install -g sake\n~~~\n\nCommand-Line Usage\n------------------\n\n~~~\n% sake -h\n\nusage: sake [TASK] [ARGUMENTS ...] [ENV=VALUE ...] [options]\n\n[TASK]       Name of the task to run. Defaults to 'default'.\n[ARGUMENTS ...]     Zero or more arguments to pass to the task invoked.\n[ENV=VALUE ...]     Zero or more arguments to translate into environment variables.\n\noptions:\n   -f, --sakefile SAKEFILE   PATH to Sakefile to run instead of searching for one.\n   -n, --dry-run             Do a dry run without executing actions.\n   -T, --tasks               List tasks with descriptions and exit.\n   -P, --prereqs             List tasks and their prerequisites and exit.\n   -r, --require MODULE      Require MODULE before executing Sakefile and expose the\n                             MODULE under a sanitized namespace (i.e.: coffee-script =>\n                             [sake.]coffeeScript). Can be specified multiple times.\n   -l, --sakelib SAKELIB     Auto-include any .sake[.js|.coffeee] files in SAKELIB.\n                             (default is 'sakelib'.) Can be specified multiple times\n   -S, --sync                Make all standard tasks 'synchronous' by default.\n   -d, --debug               Enable additional debugging output.\n   -q, --quiet               Suppress informational messages.\n   -V, --version             Print the version of sake and exit.\n   -h, --help                Print this help information and exit.\n\nSake will look within the current directory, and all parent directories, for the first SAKEFILE it\ncan find, and then invoke the TASK. If no task is given, it will try to invoke the task named\n\"default\".\n\nSAKEFILE can be one of \"Sakefile\", or \"sakefile\", with an optional extension of \".js\", or\n\".coffee\". (If you wan't to run a coffe-script file though, you will have to use the \".coffee\"\nextension.)\n~~~\n\n### Dependencies ###\n\nThese are installed when **sake** is installed.\n\n~~~\nnomnom:   >=1.5.x\nasync:    >=0.1.18\nresolve:  >=0.2.x\nproteus:  >=0.0.x\nwordwrap: >=0.0.2\n~~~\n\n\n### Development Dependencies ###\n\nInstalled when you run `npm link` in the package directory.\n\n~~~\nmocha:      >=0.3.x\nshould:     >=0.5.x\nunderscore: >=1.3.x\n~~~\n\n\nSakefile Usage\n--------------\n\nWithin a `Sakefile`, Saké's methods are exported to the global scope, so you can invoke them directly:\n\n~~~js\ntask(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n~~~\n    \nWithin another node module you can `require(\"sake\")` and access the methods on the exported object, or even run a block of code in the **saké** context (virtual machine):\n\n~~~js\nvar sake = require(\"sake\");\n    \nsake.task(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n\n// The function passed to sake#run is compiled and run in the sake context.\n// The function **will not** have access to any variables in this scope,\n// nor, will variables leak from the function's scope into this one.\nsake.run(function () {\n    var jsFiles = new FileList(\"src/js/**/*.js\");\n    \n    require(\"sake/clean\");\n    \n    task(\"script-min.js\", jsFiles, function (t) {\n        var cmd = \"infuse \" + jsFiles.map(function (path) {\n                return \"-i \" + path;\n            }) + \" -E\";\n            \n        sh(cmd, function (err, result) {\n            write(t.name, result, \"utf8\");\n            t.done();\n        })\n    });\n    \n    CLEAN.include(\"script-min.js\");\n});\n~~~\n\nThe remainder of this documentation will assume that we are calling the methods from within a `Sakefile`.\n\n\nDefining Tasks\n--------------\n\nThe various task methods take the following arguments:\n\n1.   `taskname`: `string` &mdash; naming the task\n2.   `prerequisites`: _optional_ \n    *   an `array` of:\n        *   `string` task name, or\n        *   a `FileLists`, or \n        *   a `function` that returns one of the above.\n    *   or, you can also pass a `FileList` in directly for `prerequisites`.\n3.   `action`: an _optional_ `function` that will be called when the task is invoked. It will be passed the task instance as its first argument, followed by any arguments that it was invoked with (either from the command-line, or through code). Task arguments can also be accessed through the instance's `arguments` property. i.e: `t.arguments`.\n\nAll task methods return the task *instance*.\n\nIf a task is already defined, it will be augmented by the additional arguments. So, this:\n\n~~~js\ntask(\"one\", [\"othertask\"], function (t) {\n    // do action one...\n    t.done();\n});\n\ntask(\"one\", function (t) {\n    // do action two...\n    t.done();\n});\n\ntask(\"othertask\");\n~~~\n\nWould result in a task \"othertask\" with no prerequisites, and no action, and a task \"one\" with \"othertask\" as a prerequisite and the two functions as its actions.\n\n**Note** how the dependent task was defined *after* it was required as a prerequisite. Task prerequisites are not resolved until the task is invoked. This leads to flexibility in how to compose your tasks and prerequisite tasks.\n\n\n### Task Instance Properties and Methods ###\n\n*   `name {string}` &mdash; the name of the task.\n*   `namespace {string}` &mdash; the task's namespace.\n*   `type {string}` &mdash; one of \"task\", \"file-task\", or \"file-create-task\"\n*   `fqn {string}` &mdash; the fully qualified name of the task. i.e: \"namespace:name\".\n*   `prerequisites {array}` &mdash; the list of prerequisite names for the task.\n*   `isNeeded {boolean}` &mdash; whether or not this task needs to run.\n*   `timestamp {boolean}` &mdash; the last modification time for the task.\n*   `invoke([args ...]) {Task}` &mdash; invoke the task passing args to each action for the task. Will run any prerequisites first. Returns the task instance.\n*   `execute([args ...]) {Task}` &mdash; Like `invoke`, but run the task even if it has already been run, or is not needed.\n*   `done()` &mdash; signal that the current task's action is done running.\n*   `abort([msg], [exitCode])` &mdash; abort the currently running task's actions, if _exitCode_ is specified **saké** will exit with that exit code and no other tasks will be processed. Otherwise, task processing will continue as normal.\n\n\n### Task Static Properties and Methods ###\n\n*   `namespace {string}` &mdash; the current namespace.\n*   `invoke(name, [rest ...]) {Task}` &mdash; invoke the named task and pass it the rest of the arguments.\n*   `get(name, [namespace]) {Task}` &mdash; get the task _name_, optionally start looking in _namespace_. Will throw an error if it can not find a task.\n*   `lookup(name, [namespace]) {Task|null}` &mdash; lookup a task with _name_, optionally start looking in _namespace_.\n*   `getAll() {array[Task]}` &mdash; return all defined tasks.\n*   `has(name, [namespace]) {boolean}` &mdash; does the task _name_ exist?\n*   `find(args, sortFn) {array[Task]}` &mdash; search for a task. _args_ can be an object with keys specifying which properties to match on, and their values denoting the value to match. _args_ can also be a function that accepts a task and returns a boolean whether or not that task matches.\n\n\nFile Tasks\n----------\n\nFile tasks are created with the (appropriately named) `file` method. File tasks, however, are only triggered if the file doesn't exist, or the modification time of any of its prerequisites is newer than itself.\n\n~~~js\nfile(\"path/to/some/file\", function (t) {\n    cp(\"other/path\", t.name);\n    t.done();\n});\n~~~\n\nThe above task would only be triggered if `path/to/some/file` did not exist.\n\nThe following:\n\n~~~js\nfile(\"combined/file/path\", [\"pathA\", \"pathB\", \"pathC\"], function (t) {\n    write(t.name, cat(t.prerequisites), \"utf8\");\n    t.done();\n});\n~~~\n\nwould be triggered if `path/to/some/file` did not exist, or its modification time was earlier than any of its prerequisites (`pathA`, `pathB`, or  `pathC`).\n\n\nDirectory Tasks\n---------------\n\nDirectory tasks, created with the `directory` method, are tasks that will only be called if they do not exist. A task will be created for the named directory (and for all directories along the way) with the action of creating the directory.\n\nDirectory tasks do not take any `prerequisites` or an `action` when first defined, however, they may be augmented with such after they are created:\n\n~~~js\ndirectory(\"dir/path/to/create\");\n\ntask(\"dir/path/to/create\", [\"othertask\"], action (t) {\n    //... do stuff\n    t.done();\n});\n~~~\n\n\nFile Create Tasks\n-----------------\n\nA file create task is a file task, that when used as a prerequisite, will be needed if, and only if, the file has not been created. Once created, it is not re-triggered if any of its prerequisites are newer, nor does it trigger any rebuilds of tasks that depend on it whenever the file is updated.\n\n~~~js\nfileCreate(\"file/path/to/create.ext\", [\"pathA\", \"pathB\"], function (t) {\n    // create file...\n    t.done();\n});\n~~~\n\n\n(A)Synchronicity and Tasks\n--------------------------\n\nIn **saké** all task actions are assumed to be *asynchronous* and an action must call its task's `done` method to tell **saké** that it is done processing stuff.\n\n~~~js\ntask(\"long task\", function (t) {\n    sh(\"some long running shell command\", function (err, result) {\n        // do stuff...\n        t.done();\n    });\n});\n~~~\n\nAlternatively, you can use the `Sync` version of a task to add a *synchronous* action, and `done` will be called for you after the function completes.\n\n~~~js\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n~~~\n\nThere are `Sync` versions of all the core tasks: `taskSync`, `fileSync`, and `fileCreateSync`. Thre are also `Async` versions of each task: `taskAsync`, `fileAsync`, and `fileCreateAsync`. The actions created for a `directory` task are *synchronous*. You can add *asynchronous* task actions after the initial definition.\n\nThirdly, you can specify that all of the core task creation functions generate *synchronous* actions by setting **saké's** \"sync\" option to `true`, or by use of the command-line option `-S, --sync`.\n\n~~~js\nsake.options.sync = true;\n\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n\n//... define more synchronous tasks\n\n//... and then revert to async\nsake.options.sync = false;\n~~~\n\nUltimately, it is up to the **saké** script author to correctly designate a task action as *synchronous* or *asynchronous*. Nothing prevents the running of an *asynchronous* function within a task's *synchronous* action. If nothing is dependent on the result of that action, then no problem would occur. It's when other tasks rely on the completion of certain *asynchronous* actions, that problems may arise.\n\nIn the case of *asynchronous* actions, **Saké** will issue a `WARNING` when it can not detect a `done()` call within that action.\n\n\nNamespaces\n----------\n\n**Saké** supports simple name spacing of tasks. Simply prepend the namespace before the task name with a colon \":\". This can be done when defining a task, or in the list of prerequisites for a task.\n\n~~~js\n// Defines a task 'fuz' in the namespace 'foo' that depends on the task 'buz'\n// in the namespace 'baz'\ntask(\"foo:fuz\", [\"baz:buz\"], function (t) {\n    //...\n    t.done();\n});\n~~~\n\nThen invoke the task as so:\n\n~~~\n% sake foo:fuz\n~~~\n\nYou can also use the convenience function `namespace` to wrap your task definitions for a particular namespace. Any _namespace naked_ definitions will first be tried in the local namespace, otherwise they will fall-back to the default namespace:\n\n~~~js\n\ntask(\"default\", function (t) {\n    //...\n    t.done():\n});\n\ntask(\"bazil\", function (t) {\n    //...\n    t.done():\n});\n\n// define within the 'foo' namespace\nnamespace(\"foo\", function () {\n    \n    // defines 'foo:foom' task\n    task(\"foom\", function (t) {\n        //...\n        t.done():\n    });\n    \n});\n\nnamespace(\"baz\", function () {\n    \n    // this task is defined in the 'baz' namespace, and depends on the\n    // 'foom' task from the 'foo' namespace\n    task(\"bazil\", [\"foo:foom\"], function (t) {\n        //...\n        t.done():\n    });\n    // This task is also defined in the 'baz' namespace. It depends on \n    // the 'bazil' task, which is also defined in 'baz' namespace. It\n    // also depends on the 'default' task in the 'default' (top-level)\n    // namespace.\n    task(\"buzil\", [\"bazil\", \"default\"], function (t), {\n        //...\n        t.done():\n    });\n    // If 'bazil' wasn't defined in the 'baz' namespace, it would resolve\n    // to the 'default' namespace task.\n});\n~~~\n\n**Note:** prerequisite names are tied to the defined task's namespace. i.e: If a task \"foo:fuz\" depends on \"foom\" **saké** will look in the \"foo\" namespace for \"foom\", and then the \"default\" namespace.\n\n**Note:** although the `namespace` functions can be nested, **saké** does not track the hierarchy of `namespace` calls -- if a dependent task is not found in the current task's namespace, it will look for it in the default namespace.\n\n\nIncluding Other Saké Files\n-------------------------------------\n\nYou can include other **saké** files with the `include` and `load` methods. The included files will be run in the **saké** context, so any variables they do not declare with the `var` keyword will be set on the global **saké** context. This allows you to break your project build files up into discreet files.\n\nAll `require` and `include`, or `load` statements, are resolved relative to the current file, so you can create your own hierarchy of build dependencies.\n\n\nSake Library\n------------\n\n**Saké** will load any `.sake`, `.sake.js`, or `.sake.coffee` files located in a `sakelib` directory relative to the `Sakefile` being run. This directory name can be modified with the `-l, --sakelib` option, and multiple directories can be specified. This allows you to re-use common tasks across multiple projects.\n\n\nFile Lists\n----------\n\nFileLists are lists of file paths.\n\n~~~js\nnew FileList(\"*.scss\");\n~~~\n\nWould contain all the file paths with a \".scss\" extension in the top-level directory of your project.\n\nYou can use FileLists pretty much like an `Array`. You can iterate them (with `forEach, filter, reduce`, etc...), `concat` them, `splice` them, and you get back a new FileList object.\n\nTo add files, or glob patterns to them, use the `#include` method:\n\n~~~js\nvar fl = new FileList(\"*.scss\");\nfl.include(\"core.css\", \"reset.css\", \"*.css\");\n~~~\n\nYou can also `exlucude` files by Glob pattern, `Regular Expression` pattern, or by use of a `function` that takes the file path as an argument and returns a `truthy` value to exclude a file.\n\n~~~js\n// Exclude by RegExp\nfl.exclude(/^dev-.*\\.css/);\n\n// Exclude by Glob pattern\nfl.exclude(\"dev-*.css\");\n\n// Exclude by function\nfl.exclude(function (path) {\n    return FS.statSync(path).mtime.getTime() < (Date.now() - 60 * 60 * 1000);\n});\n~~~\n\nTo get to the actual items of the FileList, use the `#items` property, or the `#toArray` method, to get a plain array back. You can also use the `#get` or `#set` methods to retrieve or set an item.\n\nFileLists are *lazy*, in that the actual file paths are not determined from the include and exclude patterns until the individual items are requested. This allows you to define a FileList and incrementally add patterns to it in the Sakefile file. The FileList paths will not be resolved until the task that uses it as a prerequisite actually asks for the final paths.\n\n\n### FileList Utility Properties & Methods ###\n\n*   `existing` &mdash; will return a new `FileList` with all of the files that actually exist.\n*   `notExisting` &mdash; will return a new `FileList` of all the files that do not exist.\n*   `extension(ext)` &mdash; returns a new `FileList` with all paths that match the given extension.\n\n~~~js\nfl.extension(\".scss\").forEach(function (path) {\n    //...\n});\n~~~\n\n*   `grep(pattern)` &mdash; get a `FileList` of all the files that match the given `pattern`. `pattern` can be a plain `String`, a `Glob` pattern, a `RegExp`, or a `function` that receives each path and can return a truthy value to include it.\n*   `clearExcludes()` &mdash; clear all exclude patterns/functions.\n*   `clearIncludes()` &mdash; clear all include patterns.\n\nBy default, a `FileList` excludes directories. To allow directories call `FileList#clearExcludes()` before requesting any items.\n\n\nThe \"clean\" and \"clobber\" Tasks, and The CLEAN and CLOBBER FileLists\n--------------------------------------------------------------------\n\nWithin a `Sakefile`:\n\n~~~js\n// defines the CLEAN FileList and 'clean' task\nrequire(\"sake/clean\");\n\n// defines the above, and also the CLOBBER FileTask and 'clobber' task\nrequire(\"sake/clobber\");\n~~~\n\nWhen the \"clean\" task is run, it will remove any files that have been included in the `CLEAN FileList`. \"clobber\" will remove any file, or directory, included in the `CLOBBER FileList`.\n\n\nSaké Utility Functions\n----------------------\n\nSaké defines a few utility functions to make life a little easier in an asynchronous world. Most of these are just wrappers for `node`'s File System (`require(\"fs\")`) utility methods.\n\n### Synchronous Utilities ###\n\n*   `mkdir(dirpath, mode=\"777\")` &mdash; create the `dirpath` directory, if it doesn't already exist.\n*   `mkdir_p(dirpath, mode=\"777\"])` &mdash; as above, but create all intermediate directories as needed.\n*   `rm(path, [path1, ..., pathN])` &mdash; remove one or more paths from the file system.\n*   `rm_rf(path, [path1, ..., pathN])` &mdash; as above, and remove directories and their contents.\n*   `cp(from, to)` &mdash; copy a file from `from` path to `to` path.\n*   `cp_r(from, to)` &mdash; copy all files from `from` path to `to` path.\n*   `mv(from, to)` &mdash; move a file from `from` path to `to` path.\n*   `ln(from, to)` &mdash; create a hard link from `from` path to `to` path.\n*   `ln_s(from, to)` &mdash; create a symlink from `from` path to `to` path.\n*   `cat(path, [path1, ..., pathN]) {string}` &mdash; read all supplied paths and return their contents as a string. If an argument is an `Array` it will be expanded and those paths will be read.\n*   `readdir(path) {array[string]}` &mdash; returns the files of directory `path`.\n*   `read(path, [enc]) {string|Buffer}` &mdash; read the supplied file path. Returns a `buffer`, or a `string` if `enc` is given.\n*   `write(path, data, [enc], mode=\"w\")` &mdash; write the `data` to the supplied file `path`. `data` should be a `buffer` or a `string` if `enc` is given. `mode` is a `string` of either \"w\", for over write,  or \"a\" for append.\n*   `slurp(path, [env]) {sring|Buffer}` &mdash; alias for `read`\n*   `spit(path, data, [enc], mode=\"w\")` &mdash; alias for `write`\n\n\n### Asynchronous Utilities ###\n\n*   `sh(cmd, fn(error, result))` &mdash; execute shell `cmd`. In the callback function, `error` will be a truthy value if there was an error, and `result` will contain the STDERR returned from `cmd`. Otherwise, `result` will contain the STDOUT from the `cmd`.\n\n\nReport an Issue\n---------------\n\n* [Bugs](http://github.com/jhamlet/node-sake/issues)\n* Contact the author: <jhamlet@hamletink.com>\n\n\nLicense\n-------\n\n> Copyright (c) 2012 Jerry Hamlet <jerry@hamletink.com>\n> \n> Permission is hereby granted, free of charge, to any person\n> obtaining a copy of this software and associated documentation\n> files (the \"Software\"), to deal in the Software without\n> restriction, including without limitation the rights to use,\n> copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the\n> Software is furnished to do so, subject to the following\n> conditions:\n> \n> The above copyright notice and this permission notice shall be\n> included in all copies or substantial portions of the Software.\n> \n> The Software shall be used for Good, not Evil.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n> OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n> HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n> WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n> FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n> OTHER DEALINGS IN THE SOFTWARE.\n\n","maintainers":[{"name":"jhamlet","email":"jerry@hamletink.com"}]},"0.1.10":{"name":"sake","description":"[S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.","version":"0.1.10","keywords":["build","make","rake","jake"],"main":"./lib/node_modules/sake/index.js","bin":{"sake":"./bin/sake"},"directories":{"lib":"lib"},"dependencies":{"nomnom":">=1.5.x","async":">=0.1.18","resolve":">=0.2.x","proteus":">=0.0.x","wordwrap":">=0.0.2"},"devDependencies":{"mocha":">=0.3.x","should":">=0.5.x","underscore":">=1.3.x"},"scripts":{"test":"mocha test/test-*"},"licenses":[{"type":"MIT","url":"http://github.com/jhamlet/node-sake/raw/master/LICENSE"}],"repository":{"type":"git","url":"git://github.com/jhamlet/node-sake.git"},"bugs":{"url":"http://github.com/jhamlet/node-sake/issues"},"preferGlobal":true,"_npmUser":{"name":"jhamlet","email":"jerry@hamletink.com"},"_id":"sake@0.1.10","contributors":[{"name":"Jerry Hamlet","email":"jerry@hamletink.com"}],"optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.12","_nodeVersion":"v0.6.10","_defaultsLoaded":true,"dist":{"shasum":"ac5d8f7a1a7d326ec82ff2d12f6e2a2be38413ef","tarball":"https://registry.npmjs.org/sake/-/sake-0.1.10.tgz","integrity":"sha512-4xf7whIFyTdAd0URdw+7ZA2yAdsJJWl938/Sv80xPAAckAJAmyhGb2Avi897UmRPk4dv/lFmZzf2U7VXyowPLQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDxHj61oN0igokP2q/MZu25lF2CKtr5wV2kLj0V3R5MpwIhAK/qsI2NEB74QSxsBecYit2pieunF+PHDhC6MVKi0IMC"}]},"readme":"\nSaké\n====\n\n> [S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.\n\n\nOverview\n--------\n\nThis package contains **saké**, a JavaScript build program that runs in node with capabilities similar to ruby's Rake.\n\nSaké has the following features:\n\n1.  `Sakefiles` (**saké’s** version of Rakefiles) are completely defined in standard JavaScript (or CoffeeScript, for those who want an even more Rake-like feel).\n2.  Flexible `FileLists` that act like arrays but know about manipulating file names and paths.\n3.  `clean` and `clobber` tasks are available for tidying up.\n4.  _Asynchronous_ task handling, with easy options for specifying _synchronous_ tasks.\n5.  Simple _namespacing_ of tasks to break projects into discreet parts.\n5.  Many utility methods for handling common build tasks (rm, rm_rf, mkdir, mkdir_p, sh, cat, etc...)\n\n\nInstallation\n------------\n\n### Install with npm\n\nDownload and install with the following:\n\n~~~\nnpm install -g sake\n~~~\n\nCommand-Line Usage\n------------------\n\n~~~\n% sake -h\n\nusage: sake [TASK] [ARGUMENTS ...] [ENV=VALUE ...] [options]\n\n[TASK]       Name of the task to run. Defaults to 'default'.\n[ARGUMENTS ...]     Zero or more arguments to pass to the task invoked.\n[ENV=VALUE ...]     Zero or more arguments to translate into environment variables.\n\noptions:\n   -f, --sakefile SAKEFILE   PATH to Sakefile to run instead of searching for one.\n   -n, --dry-run             Do a dry run without executing actions.\n   -T, --tasks               List tasks with descriptions and exit.\n   -P, --prereqs             List tasks and their prerequisites and exit.\n   -r, --require MODULE      Require MODULE before executing Sakefile and expose the\n                             MODULE under a sanitized namespace (i.e.: coffee-script =>\n                             [sake.]coffeeScript). Can be specified multiple times.\n   -l, --sakelib SAKELIB     Auto-include any .sake[.js|.coffeee] files in SAKELIB.\n                             (default is 'sakelib'.) Can be specified multiple times\n   -S, --sync                Make all standard tasks 'synchronous' by default.\n   -d, --debug               Enable additional debugging output.\n   -q, --quiet               Suppress informational messages.\n   -V, --version             Print the version of sake and exit.\n   -h, --help                Print this help information and exit.\n\nSake will look within the current directory, and all parent directories, for the first SAKEFILE it\ncan find, and then invoke the TASK. If no task is given, it will try to invoke the task named\n\"default\".\n\nSAKEFILE can be one of \"Sakefile\", or \"sakefile\", with an optional extension of \".js\", or\n\".coffee\". (If you wan't to run a coffe-script file though, you will have to use the \".coffee\"\nextension.)\n~~~\n\n### Dependencies ###\n\nThese are installed when **sake** is installed.\n\n~~~\nnomnom:   >=1.5.x\nasync:    >=0.1.18\nresolve:  >=0.2.x\nproteus:  >=0.0.x\nwordwrap: >=0.0.2\n~~~\n\n\n### Development Dependencies ###\n\nInstalled when you run `npm link` in the package directory.\n\n~~~\nmocha:      >=0.3.x\nshould:     >=0.5.x\nunderscore: >=1.3.x\n~~~\n\n\nSakefile Usage\n--------------\n\nWithin a `Sakefile`, Saké's methods are exported to the global scope, so you can invoke them directly:\n\n~~~js\ntask(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n~~~\n    \nWithin another node module you can `require(\"sake\")` and access the methods on the exported object, or even run a block of code in the **saké** context (virtual machine):\n\n~~~js\nvar sake = require(\"sake\");\n    \nsake.task(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n\n// The function passed to sake#run is compiled and run in the sake context.\n// The function **will not** have access to any variables in this scope,\n// nor, will variables leak from the function's scope into this one.\nsake.run(function () {\n    var jsFiles = new FileList(\"src/js/**/*.js\");\n    \n    require(\"sake/clean\");\n    \n    task(\"script-min.js\", jsFiles, function (t) {\n        var cmd = \"infuse \" + jsFiles.map(function (path) {\n                return \"-i \" + path;\n            }) + \" -E\";\n            \n        sh(cmd, function (err, result) {\n            write(t.name, result, \"utf8\");\n            t.done();\n        })\n    });\n    \n    CLEAN.include(\"script-min.js\");\n});\n~~~\n\nThe remainder of this documentation will assume that we are calling the methods from within a `Sakefile`.\n\n\nDefining Tasks\n--------------\n\nThe various task methods take the following arguments:\n\n1.   `taskname`: `string` &mdash; naming the task\n2.   `prerequisites`: _optional_ \n    *   an `array` of:\n        *   `string` task name, or\n        *   a `FileLists`, or \n        *   a `function` that returns one of the above.\n    *   or, you can also pass a `FileList` in directly for `prerequisites`.\n3.   `action`: an _optional_ `function` that will be called when the task is invoked. It will be passed the task instance as its first argument, followed by any arguments that it was invoked with (either from the command-line, or through code). Task arguments can also be accessed through the instance's `arguments` property. i.e: `t.arguments`.\n\nAll task methods return the task *instance*.\n\nIf a task is already defined, it will be augmented by the additional arguments. So, this:\n\n~~~js\ntask(\"one\", [\"othertask\"], function (t) {\n    // do action one...\n    t.done();\n});\n\ntask(\"one\", function (t) {\n    // do action two...\n    t.done();\n});\n\ntask(\"othertask\");\n~~~\n\nWould result in a task \"othertask\" with no prerequisites, and no action, and a task \"one\" with \"othertask\" as a prerequisite and the two functions as its actions.\n\n**Note** how the dependent task was defined *after* it was required as a prerequisite. Task prerequisites are not resolved until the task is invoked. This leads to flexibility in how to compose your tasks and prerequisite tasks.\n\n\n### Task Instance Properties and Methods ###\n\n*   `name {string}` &mdash; the name of the task.\n*   `namespace {string}` &mdash; the task's namespace.\n*   `type {string}` &mdash; one of \"task\", \"file-task\", or \"file-create-task\"\n*   `fqn {string}` &mdash; the fully qualified name of the task. i.e: \"namespace:name\".\n*   `prerequisites {array}` &mdash; the list of prerequisite names for the task.\n*   `isNeeded {boolean}` &mdash; whether or not this task needs to run.\n*   `timestamp {boolean}` &mdash; the last modification time for the task.\n*   `invoke([args ...]) {Task}` &mdash; invoke the task passing args to each action for the task. Will run any prerequisites first. Returns the task instance.\n*   `execute([args ...]) {Task}` &mdash; Like `invoke`, but run the task even if it has already been run, or is not needed.\n*   `done()` &mdash; signal that the current task's action is done running.\n*   `abort([msg], [exitCode])` &mdash; abort the currently running task's actions, if _exitCode_ is specified **saké** will exit with that exit code and no other tasks will be processed. Otherwise, task processing will continue as normal.\n\n\n### Task Static Properties and Methods ###\n\n*   `namespace {string}` &mdash; the current namespace.\n*   `invoke(name, [rest ...]) {Task}` &mdash; invoke the named task and pass it the rest of the arguments.\n*   `get(name, [namespace]) {Task}` &mdash; get the task _name_, optionally start looking in _namespace_. Will throw an error if it can not find a task.\n*   `lookup(name, [namespace]) {Task|null}` &mdash; lookup a task with _name_, optionally start looking in _namespace_.\n*   `getAll() {array[Task]}` &mdash; return all defined tasks.\n*   `has(name, [namespace]) {boolean}` &mdash; does the task _name_ exist?\n*   `find(args, sortFn) {array[Task]}` &mdash; search for a task. _args_ can be an object with keys specifying which properties to match on, and their values denoting the value to match. _args_ can also be a function that accepts a task and returns a boolean whether or not that task matches.\n\n\nFile Tasks\n----------\n\nFile tasks are created with the (appropriately named) `file` method. File tasks, however, are only triggered if the file doesn't exist, or the modification time of any of its prerequisites is newer than itself.\n\n~~~js\nfile(\"path/to/some/file\", function (t) {\n    cp(\"other/path\", t.name);\n    t.done();\n});\n~~~\n\nThe above task would only be triggered if `path/to/some/file` did not exist.\n\nThe following:\n\n~~~js\nfile(\"combined/file/path\", [\"pathA\", \"pathB\", \"pathC\"], function (t) {\n    write(t.name, cat(t.prerequisites), \"utf8\");\n    t.done();\n});\n~~~\n\nwould be triggered if `path/to/some/file` did not exist, or its modification time was earlier than any of its prerequisites (`pathA`, `pathB`, or  `pathC`).\n\n\nDirectory Tasks\n---------------\n\nDirectory tasks, created with the `directory` method, are tasks that will only be called if they do not exist. A task will be created for the named directory (and for all directories along the way) with the action of creating the directory.\n\nDirectory tasks do not take any `prerequisites` or an `action` when first defined, however, they may be augmented with such after they are created:\n\n~~~js\ndirectory(\"dir/path/to/create\");\n\ntask(\"dir/path/to/create\", [\"othertask\"], action (t) {\n    //... do stuff\n    t.done();\n});\n~~~\n\n\nFile Create Tasks\n-----------------\n\nA file create task is a file task, that when used as a prerequisite, will be needed if, and only if, the file has not been created. Once created, it is not re-triggered if any of its prerequisites are newer, nor does it trigger any rebuilds of tasks that depend on it whenever the file is updated.\n\n~~~js\nfileCreate(\"file/path/to/create.ext\", [\"pathA\", \"pathB\"], function (t) {\n    // create file...\n    t.done();\n});\n~~~\n\n\n(A)Synchronicity and Tasks\n--------------------------\n\nIn **saké** all task actions are assumed to be *asynchronous* and an action must call its task's `done` method to tell **saké** that it is done processing stuff.\n\n~~~js\ntask(\"long task\", function (t) {\n    sh(\"some long running shell command\", function (err, result) {\n        // do stuff...\n        t.done();\n    });\n});\n~~~\n\nAlternatively, you can use the `Sync` version of a task to add a *synchronous* action, and `done` will be called for you after the function completes.\n\n~~~js\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n~~~\n\nThere are `Sync` versions of all the core tasks: `taskSync`, `fileSync`, and `fileCreateSync`. Thre are also `Async` versions of each task: `taskAsync`, `fileAsync`, and `fileCreateAsync`. The actions created for a `directory` task are *synchronous*. You can add *asynchronous* task actions after the initial definition.\n\nThirdly, you can specify that all of the core task creation functions generate *synchronous* actions by setting **saké's** \"sync\" option to `true`, or by use of the command-line option `-S, --sync`.\n\n~~~js\nsake.options.sync = true;\n\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n\n//... define more synchronous tasks\n\n//... and then revert to async\nsake.options.sync = false;\n~~~\n\nUltimately, it is up to the **saké** script author to correctly designate a task action as *synchronous* or *asynchronous*. Nothing prevents the running of an *asynchronous* function within a task's *synchronous* action. If nothing is dependent on the result of that action, then no problem would occur. It's when other tasks rely on the completion of certain *asynchronous* actions, that problems may arise.\n\nIn the case of *asynchronous* actions, **Saké** will issue a `WARNING` when it can not detect a `done()` call within that action.\n\n\nNamespaces\n----------\n\n**Saké** supports simple name spacing of tasks. Simply prepend the namespace before the task name with a colon \":\". This can be done when defining a task, or in the list of prerequisites for a task.\n\n~~~js\n// Defines a task 'fuz' in the namespace 'foo' that depends on the task 'buz'\n// in the namespace 'baz'\ntask(\"foo:fuz\", [\"baz:buz\"], function (t) {\n    //...\n    t.done();\n});\n~~~\n\nThen invoke the task as so:\n\n~~~\n% sake foo:fuz\n~~~\n\nYou can also use the convenience function `namespace` to wrap your task definitions for a particular namespace. Any _namespace naked_ definitions will first be tried in the local namespace, otherwise they will fall-back to the default namespace:\n\n~~~js\n\ntask(\"default\", function (t) {\n    //...\n    t.done():\n});\n\ntask(\"bazil\", function (t) {\n    //...\n    t.done():\n});\n\n// define within the 'foo' namespace\nnamespace(\"foo\", function () {\n    \n    // defines 'foo:foom' task\n    task(\"foom\", function (t) {\n        //...\n        t.done():\n    });\n    \n});\n\nnamespace(\"baz\", function () {\n    \n    // this task is defined in the 'baz' namespace, and depends on the\n    // 'foom' task from the 'foo' namespace\n    task(\"bazil\", [\"foo:foom\"], function (t) {\n        //...\n        t.done():\n    });\n    // This task is also defined in the 'baz' namespace. It depends on \n    // the 'bazil' task, which is also defined in 'baz' namespace. It\n    // also depends on the 'default' task in the 'default' (top-level)\n    // namespace.\n    task(\"buzil\", [\"bazil\", \"default\"], function (t), {\n        //...\n        t.done():\n    });\n    // If 'bazil' wasn't defined in the 'baz' namespace, it would resolve\n    // to the 'default' namespace task.\n});\n~~~\n\n**Note:** prerequisite names are tied to the defined task's namespace. i.e: If a task \"foo:fuz\" depends on \"foom\" **saké** will look in the \"foo\" namespace for \"foom\", and then the \"default\" namespace.\n\n**Note:** although the `namespace` functions can be nested, **saké** does not track the hierarchy of `namespace` calls -- if a dependent task is not found in the current task's namespace, it will look for it in the default namespace.\n\n\nIncluding Other Saké Files\n-------------------------------------\n\nYou can include other **saké** files with the `include` and `load` methods. The included files will be run in the **saké** context, so any variables they do not declare with the `var` keyword will be set on the global **saké** context. This allows you to break your project build files up into discreet files.\n\nAll `require` and `include`, or `load` statements, are resolved relative to the current file, so you can create your own hierarchy of build dependencies.\n\n\nSake Library\n------------\n\n**Saké** will load any `.sake`, `.sake.js`, or `.sake.coffee` files located in a `sakelib` directory relative to the `Sakefile` being run. This directory name can be modified with the `-l, --sakelib` option, and multiple directories can be specified. This allows you to re-use common tasks across multiple projects.\n\n\nFile Lists\n----------\n\nFileLists are lists of file paths.\n\n~~~js\nnew FileList(\"*.scss\");\n~~~\n\nWould contain all the file paths with a \".scss\" extension in the top-level directory of your project.\n\nYou can use FileLists pretty much like an `Array`. You can iterate them (with `forEach, filter, reduce`, etc...), `concat` them, `splice` them, and you get back a new FileList object.\n\nTo add files, or glob patterns to them, use the `#include` method:\n\n~~~js\nvar fl = new FileList(\"*.scss\");\nfl.include(\"core.css\", \"reset.css\", \"*.css\");\n~~~\n\nYou can also `exlucude` files by Glob pattern, `Regular Expression` pattern, or by use of a `function` that takes the file path as an argument and returns a `truthy` value to exclude a file.\n\n~~~js\n// Exclude by RegExp\nfl.exclude(/^dev-.*\\.css/);\n\n// Exclude by Glob pattern\nfl.exclude(\"dev-*.css\");\n\n// Exclude by function\nfl.exclude(function (path) {\n    return FS.statSync(path).mtime.getTime() < (Date.now() - 60 * 60 * 1000);\n});\n~~~\n\nTo get to the actual items of the FileList, use the `#items` property, or the `#toArray` method, to get a plain array back. You can also use the `#get` or `#set` methods to retrieve or set an item.\n\nFileLists are *lazy*, in that the actual file paths are not determined from the include and exclude patterns until the individual items are requested. This allows you to define a FileList and incrementally add patterns to it in the Sakefile file. The FileList paths will not be resolved until the task that uses it as a prerequisite actually asks for the final paths.\n\n\n### FileList Utility Properties & Methods ###\n\n*   `existing` &mdash; will return a new `FileList` with all of the files that actually exist.\n*   `notExisting` &mdash; will return a new `FileList` of all the files that do not exist.\n*   `extension(ext)` &mdash; returns a new `FileList` with all paths that match the given extension.\n\n~~~js\nfl.extension(\".scss\").forEach(function (path) {\n    //...\n});\n~~~\n\n*   `grep(pattern)` &mdash; get a `FileList` of all the files that match the given `pattern`. `pattern` can be a plain `String`, a `Glob` pattern, a `RegExp`, or a `function` that receives each path and can return a truthy value to include it.\n*   `clearExcludes()` &mdash; clear all exclude patterns/functions.\n*   `clearIncludes()` &mdash; clear all include patterns.\n\nBy default, a `FileList` excludes directories. To allow directories call `FileList#clearExcludes()` before requesting any items.\n\n\nThe \"clean\" and \"clobber\" Tasks, and The CLEAN and CLOBBER FileLists\n--------------------------------------------------------------------\n\nWithin a `Sakefile`:\n\n~~~js\n// defines the CLEAN FileList and 'clean' task\nrequire(\"sake/clean\");\n\n// defines the above, and also the CLOBBER FileTask and 'clobber' task\nrequire(\"sake/clobber\");\n~~~\n\nWhen the \"clean\" task is run, it will remove any files that have been included in the `CLEAN FileList`. \"clobber\" will remove any file, or directory, included in the `CLOBBER FileList`.\n\n\nSaké Utility Functions\n----------------------\n\nSaké defines a few utility functions to make life a little easier in an asynchronous world. Most of these are just wrappers for `node`'s File System (`require(\"fs\")`) utility methods.\n\n### Synchronous Utilities ###\n\n*   `mkdir(dirpath, mode=\"777\")` &mdash; create the `dirpath` directory, if it doesn't already exist.\n*   `mkdir_p(dirpath, mode=\"777\"])` &mdash; as above, but create all intermediate directories as needed.\n*   `rm(path, [path1, ..., pathN])` &mdash; remove one or more paths from the file system.\n*   `rm_rf(path, [path1, ..., pathN])` &mdash; as above, and remove directories and their contents.\n*   `cp(from, to)` &mdash; copy a file from `from` path to `to` path.\n*   `cp_r(from, to)` &mdash; copy all files from `from` path to `to` path.\n*   `mv(from, to)` &mdash; move a file from `from` path to `to` path.\n*   `ln(from, to)` &mdash; create a hard link from `from` path to `to` path.\n*   `ln_s(from, to)` &mdash; create a symlink from `from` path to `to` path.\n*   `cat(path, [path1, ..., pathN]) {string}` &mdash; read all supplied paths and return their contents as a string. If an argument is an `Array` it will be expanded and those paths will be read.\n*   `readdir(path) {array[string]}` &mdash; returns the files of directory `path`.\n*   `read(path, [enc]) {string|Buffer}` &mdash; read the supplied file path. Returns a `buffer`, or a `string` if `enc` is given.\n*   `write(path, data, [enc], mode=\"w\")` &mdash; write the `data` to the supplied file `path`. `data` should be a `buffer` or a `string` if `enc` is given. `mode` is a `string` of either \"w\", for over write,  or \"a\" for append.\n*   `slurp(path, [env]) {sring|Buffer}` &mdash; alias for `read`\n*   `spit(path, data, [enc], mode=\"w\")` &mdash; alias for `write`\n\n\n### Asynchronous Utilities ###\n\n*   `sh(cmd, fn(error, result))` &mdash; execute shell `cmd`. In the callback function, `error` will be a truthy value if there was an error, and `result` will contain the STDERR returned from `cmd`. Otherwise, `result` will contain the STDOUT from the `cmd`.\n\n\nReport an Issue\n---------------\n\n* [Bugs](http://github.com/jhamlet/node-sake/issues)\n* Contact the author: <jhamlet@hamletink.com>\n\n\nLicense\n-------\n\n> Copyright (c) 2012 Jerry Hamlet <jerry@hamletink.com>\n> \n> Permission is hereby granted, free of charge, to any person\n> obtaining a copy of this software and associated documentation\n> files (the \"Software\"), to deal in the Software without\n> restriction, including without limitation the rights to use,\n> copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the\n> Software is furnished to do so, subject to the following\n> conditions:\n> \n> The above copyright notice and this permission notice shall be\n> included in all copies or substantial portions of the Software.\n> \n> The Software shall be used for Good, not Evil.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n> OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n> HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n> WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n> FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n> OTHER DEALINGS IN THE SOFTWARE.\n\n","maintainers":[{"name":"jhamlet","email":"jerry@hamletink.com"}]},"0.1.11":{"name":"sake","description":"[S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.","version":"0.1.11","keywords":["build","make","rake","jake"],"main":"./lib/node_modules/sake/index.js","bin":{"sake":"./bin/sake"},"directories":{"lib":"lib"},"dependencies":{"nomnom":">=1.5.x","async":">=0.1.18","resolve":">=0.2.x","proteus":">=0.0.x","wordwrap":">=0.0.2"},"devDependencies":{"mocha":">=0.3.x","should":">=0.5.x","underscore":">=1.3.x"},"scripts":{"test":"mocha test/test-*"},"licenses":[{"type":"MIT","url":"http://github.com/jhamlet/node-sake/raw/master/LICENSE"}],"repository":{"type":"git","url":"git://github.com/jhamlet/node-sake.git"},"bugs":{"url":"http://github.com/jhamlet/node-sake/issues"},"preferGlobal":true,"_npmUser":{"name":"jhamlet","email":"jerry@hamletink.com"},"_id":"sake@0.1.11","contributors":[{"name":"Jerry Hamlet","email":"jerry@hamletink.com"}],"optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.12","_nodeVersion":"v0.6.10","_defaultsLoaded":true,"dist":{"shasum":"e7d06865434cfab20bf18846056f14913494b080","tarball":"https://registry.npmjs.org/sake/-/sake-0.1.11.tgz","integrity":"sha512-9r4+ky6KZS/ro0l82+FmJmL4L2J1j1PfvQEEMfeOp9A4FpgucurVKyj3I+uc5fnArNT5sXebIJAy7UE94+y60A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBZ5Hf3763NxdmmDcz5Yq1MsHn2vfKTuVQoYPAMFs4dzAiBD0qIeIOBXeKiKqfqpryTA73eQEXNXlQItG1JZmvCyBg=="}]},"readme":"\nSaké\n====\n\n> [S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.\n\n\nOverview\n--------\n\nThis package contains **saké**, a JavaScript build program that runs in node with capabilities similar to ruby's Rake.\n\nSaké has the following features:\n\n1.  `Sakefiles` (**saké’s** version of Rakefiles) are completely defined in standard JavaScript (or CoffeeScript, for those who want an even more Rake-like feel).\n2.  Flexible `FileLists` that act like arrays but know about manipulating file names and paths.\n3.  `clean` and `clobber` tasks are available for tidying up.\n4.  _Asynchronous_ task handling, with easy options for specifying _synchronous_ tasks.\n5.  Simple _namespacing_ of tasks to break projects into discreet parts.\n5.  Many utility methods for handling common build tasks (rm, rm_rf, mkdir, mkdir_p, sh, cat, etc...)\n\n\nInstallation\n------------\n\n### Install with npm\n\nDownload and install with the following:\n\n~~~\nnpm install -g sake\n~~~\n\nCommand-Line Usage\n------------------\n\n~~~\n% sake -h\n\nusage: sake [TASK] [ARGUMENTS ...] [ENV=VALUE ...] [options]\n\n[TASK]       Name of the task to run. Defaults to 'default'.\n[ARGUMENTS ...]     Zero or more arguments to pass to the task invoked.\n[ENV=VALUE ...]     Zero or more arguments to translate into environment variables.\n\noptions:\n   -f, --sakefile SAKEFILE   PATH to Sakefile to run instead of searching for one.\n   -T, --tasks [PATTERN]     List tasks with descriptions (optionally, just those\n                             matching PATTERN) and exit.\n   -P, --prereqs [PATTERN]   List tasks and their prerequisites (optionally, just those\n                             matching PATTERN) and exit.\n   -r, --require MODULE      Require MODULE before executing Sakefile and expose the\n                             MODULE under a sanitized namespace (i.e.: coffee-script =>\n                             [sake.]coffeeScript). Can be specified multiple times.\n   -l, --sakelib SAKELIB     Auto-include any .sake[.js|.coffeee] files in SAKELIB.\n                             (default is 'sakelib'.) Can be specified multiple times\n   -n, --dry-run             Do a dry run without executing actions.\n   -S, --sync                Make all standard tasks 'synchronous' by default.\n   -d, --debug               Enable additional debugging output.\n   -q, --quiet               Suppress informational messages.\n   -V, --version             Print the version of sake and exit.\n   -h, --help                Print this help information and exit.\n\nSake will look within the current directory, and all parent directories, for the first SAKEFILE it\ncan find, and then invoke the TASK. If no task is given, it will try to invoke the task named\n\"default\".\n\nSAKEFILE can be one of \"Sakefile\", or \"sakefile\", with an optional extension of \".js\", or\n\".coffee\". (If you wan't to run a coffe-script file though, you will have to use the \".coffee\"\nextension.)\n~~~\n\n### Dependencies ###\n\nThese are installed when **sake** is installed.\n\n~~~\nnomnom:   >=1.5.x\nasync:    >=0.1.18\nresolve:  >=0.2.x\nproteus:  >=0.0.x\nwordwrap: >=0.0.2\n~~~\n\n\n### Development Dependencies ###\n\nInstalled when you run `npm link` in the package directory.\n\n~~~\nmocha:      >=0.3.x\nshould:     >=0.5.x\nunderscore: >=1.3.x\n~~~\n\n\nSakefile Usage\n--------------\n\nWithin a `Sakefile`, Saké's methods are exported to the global scope, so you can invoke them directly:\n\n~~~js\ntask(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n~~~\n    \nWithin another node module you can `require(\"sake\")` and access the methods on the exported object, or even run a block of code in the **saké** context (virtual machine):\n\n~~~js\nvar sake = require(\"sake\");\n    \nsake.task(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n\n// The function passed to sake#run is compiled and run in the sake context.\n// The function **will not** have access to any variables in this scope,\n// nor, will variables leak from the function's scope into this one.\nsake.run(function () {\n    var jsFiles = new FileList(\"src/js/**/*.js\");\n    \n    require(\"sake/clean\");\n    \n    task(\"script-min.js\", jsFiles, function (t) {\n        var cmd = \"infuse \" + jsFiles.map(function (path) {\n                return \"-i \" + path;\n            }) + \" -E\";\n            \n        sh(cmd, function (err, result) {\n            write(t.name, result, \"utf8\");\n            t.done();\n        })\n    });\n    \n    CLEAN.include(\"script-min.js\");\n});\n~~~\n\nThe remainder of this documentation will assume that we are calling the methods from within a `Sakefile`.\n\n\nDefining Tasks\n--------------\n\nThe various task methods take the following arguments:\n\n1.   `taskname`: `string` &mdash; naming the task\n2.   `prerequisites`: _optional_ \n    *   an `array` of:\n        *   `string` task name, or\n        *   a `FileLists`, or \n        *   a `function` that returns one of the above.\n    *   or, you can also pass a `FileList` in directly for `prerequisites`.\n3.   `action`: an _optional_ `function` that will be called when the task is invoked. It will be passed the task instance as its first argument, followed by any arguments that it was invoked with (either from the command-line, or through code). Task arguments can also be accessed through the instance's `arguments` property. i.e: `t.arguments`.\n\nAll task methods return the task *instance*.\n\nIf a task is already defined, it will be augmented by the additional arguments. So, this:\n\n~~~js\ntask(\"one\", [\"othertask\"], function (t) {\n    // do action one...\n    t.done();\n});\n\ntask(\"one\", function (t) {\n    // do action two...\n    t.done();\n});\n\ntask(\"othertask\");\n~~~\n\nWould result in a task \"othertask\" with no prerequisites, and no action, and a task \"one\" with \"othertask\" as a prerequisite and the two functions as its actions.\n\n**Note** how the dependent task was defined *after* it was required as a prerequisite. Task prerequisites are not resolved until the task is invoked. This leads to flexibility in how to compose your tasks and prerequisite tasks.\n\n\n### Task Instance Properties and Methods ###\n\n*   `name {string}` &mdash; the name of the task.\n*   `namespace {string}` &mdash; the task's namespace.\n*   `type {string}` &mdash; one of \"task\", \"file-task\", or \"file-create-task\"\n*   `fqn {string}` &mdash; the fully qualified name of the task. i.e: \"namespace:name\".\n*   `prerequisites {array}` &mdash; the list of prerequisite names for the task.\n*   `isNeeded {boolean}` &mdash; whether or not this task needs to run.\n*   `timestamp {boolean}` &mdash; the last modification time for the task.\n*   `invoke([args ...]) {Task}` &mdash; invoke the task passing args to each action for the task. Will run any prerequisites first. Returns the task instance.\n*   `execute([args ...]) {Task}` &mdash; Like `invoke`, but run the task even if it has already been run, or is not needed.\n*   `done()` &mdash; signal that the current task's action is done running.\n*   `abort([msg], [exitCode])` &mdash; abort the currently running task's actions, if _exitCode_ is specified **saké** will exit with that exit code and no other tasks will be processed. Otherwise, task processing will continue as normal.\n\n\n### Task Static Properties and Methods ###\n\n*   `namespace {string}` &mdash; the current namespace.\n*   `invoke(name, [rest ...]) {Task}` &mdash; invoke the named task and pass it the rest of the arguments.\n*   `get(name, [namespace]) {Task}` &mdash; get the task _name_, optionally start looking in _namespace_. Will throw an error if it can not find a task.\n*   `lookup(name, [namespace]) {Task|null}` &mdash; lookup a task with _name_, optionally start looking in _namespace_.\n*   `getAll() {array[Task]}` &mdash; return all defined tasks.\n*   `has(name, [namespace]) {boolean}` &mdash; does the task _name_ exist?\n*   `find(args, sortFn) {array[Task]}` &mdash; search for a task. _args_ can be an object with keys specifying which properties to match on, and their values denoting the value to match. _args_ can also be a function that accepts a task and returns a boolean whether or not that task matches.\n\n\nFile Tasks\n----------\n\nFile tasks are created with the (appropriately named) `file` method. File tasks, however, are only triggered if the file doesn't exist, or the modification time of any of its prerequisites is newer than itself.\n\n~~~js\nfile(\"path/to/some/file\", function (t) {\n    cp(\"other/path\", t.name);\n    t.done();\n});\n~~~\n\nThe above task would only be triggered if `path/to/some/file` did not exist.\n\nThe following:\n\n~~~js\nfile(\"combined/file/path\", [\"pathA\", \"pathB\", \"pathC\"], function (t) {\n    write(t.name, cat(t.prerequisites), \"utf8\");\n    t.done();\n});\n~~~\n\nwould be triggered if `path/to/some/file` did not exist, or its modification time was earlier than any of its prerequisites (`pathA`, `pathB`, or  `pathC`).\n\n\nDirectory Tasks\n---------------\n\nDirectory tasks, created with the `directory` method, are tasks that will only be called if they do not exist. A task will be created for the named directory (and for all directories along the way) with the action of creating the directory.\n\nDirectory tasks do not take any `prerequisites` or an `action` when first defined, however, they may be augmented with such after they are created:\n\n~~~js\ndirectory(\"dir/path/to/create\");\n\ntask(\"dir/path/to/create\", [\"othertask\"], action (t) {\n    //... do stuff\n    t.done();\n});\n~~~\n\n\nFile Create Tasks\n-----------------\n\nA file create task is a file task, that when used as a prerequisite, will be needed if, and only if, the file has not been created. Once created, it is not re-triggered if any of its prerequisites are newer, nor does it trigger any rebuilds of tasks that depend on it whenever the file is updated.\n\n~~~js\nfileCreate(\"file/path/to/create.ext\", [\"pathA\", \"pathB\"], function (t) {\n    // create file...\n    t.done();\n});\n~~~\n\n\n(A)Synchronicity and Tasks\n--------------------------\n\nIn **saké** all task actions are assumed to be *asynchronous* and an action must call its task's `done` method to tell **saké** that it is done processing stuff.\n\n~~~js\ntask(\"long task\", function (t) {\n    sh(\"some long running shell command\", function (err, result) {\n        // do stuff...\n        t.done();\n    });\n});\n~~~\n\nAlternatively, you can use the `Sync` version of a task to add a *synchronous* action, and `done` will be called for you after the function completes.\n\n~~~js\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n~~~\n\nThere are `Sync` versions of all the core tasks: `taskSync`, `fileSync`, and `fileCreateSync`. Thre are also `Async` versions of each task: `taskAsync`, `fileAsync`, and `fileCreateAsync`. The actions created for a `directory` task are *synchronous*. You can add *asynchronous* task actions after the initial definition.\n\nThirdly, you can specify that all of the core task creation functions generate *synchronous* actions by setting **saké's** \"sync\" option to `true`, or by use of the command-line option `-S, --sync`.\n\n~~~js\nsake.options.sync = true;\n\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n\n//... define more synchronous tasks\n\n//... and then revert to async\nsake.options.sync = false;\n~~~\n\nUltimately, it is up to the **saké** script author to correctly designate a task action as *synchronous* or *asynchronous*. Nothing prevents the running of an *asynchronous* function within a task's *synchronous* action. If nothing is dependent on the result of that action, then no problem would occur. It's when other tasks rely on the completion of certain *asynchronous* actions, that problems may arise.\n\nIn the case of *asynchronous* actions, **Saké** will issue a `WARNING` when it can not detect a `done()` call within that action.\n\n\nNamespaces\n----------\n\n**Saké** supports simple name spacing of tasks. Simply prepend the namespace before the task name with a colon \":\". This can be done when defining a task, or in the list of prerequisites for a task.\n\n~~~js\n// Defines a task 'fuz' in the namespace 'foo' that depends on the task 'buz'\n// in the namespace 'baz'\ntask(\"foo:fuz\", [\"baz:buz\"], function (t) {\n    //...\n    t.done();\n});\n~~~\n\nThen invoke the task as so:\n\n~~~\n% sake foo:fuz\n~~~\n\nYou can also use the convenience function `namespace` to wrap your task definitions for a particular namespace. Any _namespace naked_ definitions will first be tried in the local namespace, otherwise they will fall-back to the default namespace:\n\n~~~js\n\ntask(\"default\", function (t) {\n    //...\n    t.done():\n});\n\ntask(\"bazil\", function (t) {\n    //...\n    t.done():\n});\n\n// define within the 'foo' namespace\nnamespace(\"foo\", function () {\n    \n    // defines 'foo:foom' task\n    task(\"foom\", function (t) {\n        //...\n        t.done():\n    });\n    \n});\n\nnamespace(\"baz\", function () {\n    \n    // this task is defined in the 'baz' namespace, and depends on the\n    // 'foom' task from the 'foo' namespace\n    task(\"bazil\", [\"foo:foom\"], function (t) {\n        //...\n        t.done():\n    });\n    // This task is also defined in the 'baz' namespace. It depends on \n    // the 'bazil' task, which is also defined in 'baz' namespace. It\n    // also depends on the 'default' task in the 'default' (top-level)\n    // namespace.\n    task(\"buzil\", [\"bazil\", \"default\"], function (t), {\n        //...\n        t.done():\n    });\n    // If 'bazil' wasn't defined in the 'baz' namespace, it would resolve\n    // to the 'default' namespace task.\n});\n~~~\n\n**Note:** prerequisite names are tied to the defined task's namespace. i.e: If a task \"foo:fuz\" depends on \"foom\" **saké** will look in the \"foo\" namespace for \"foom\", and then the \"default\" namespace.\n\n**Note:** although the `namespace` functions can be nested, **saké** does not track the hierarchy of `namespace` calls -- if a dependent task is not found in the current task's namespace, it will look for it in the default namespace.\n\n\nIncluding Other Saké Files\n-------------------------------------\n\nYou can include other **saké** files with the `include` and `load` methods. The included files will be run in the **saké** context, so any variables they do not declare with the `var` keyword will be set on the global **saké** context. This allows you to break your project build files up into discreet files.\n\nAll `require` and `include`, or `load` statements, are resolved relative to the current file, so you can create your own hierarchy of build dependencies.\n\n\nSake Library\n------------\n\n**Saké** will load any `.sake`, `.sake.js`, or `.sake.coffee` files located in a `sakelib` directory relative to the `Sakefile` being run. This directory name can be modified with the `-l, --sakelib` option, and multiple directories can be specified. This allows you to re-use common tasks across multiple projects.\n\n\nFile Lists\n----------\n\nFileLists are lists of file paths.\n\n~~~js\nnew FileList(\"*.scss\");\n~~~\n\nWould contain all the file paths with a \".scss\" extension in the top-level directory of your project.\n\nYou can use FileLists pretty much like an `Array`. You can iterate them (with `forEach, filter, reduce`, etc...), `concat` them, `splice` them, and you get back a new FileList object.\n\nTo add files, or glob patterns to them, use the `#include` method:\n\n~~~js\nvar fl = new FileList(\"*.scss\");\nfl.include(\"core.css\", \"reset.css\", \"*.css\");\n~~~\n\nYou can also `exlucude` files by Glob pattern, `Regular Expression` pattern, or by use of a `function` that takes the file path as an argument and returns a `truthy` value to exclude a file.\n\n~~~js\n// Exclude by RegExp\nfl.exclude(/^dev-.*\\.css/);\n\n// Exclude by Glob pattern\nfl.exclude(\"dev-*.css\");\n\n// Exclude by function\nfl.exclude(function (path) {\n    return FS.statSync(path).mtime.getTime() < (Date.now() - 60 * 60 * 1000);\n});\n~~~\n\nTo get to the actual items of the FileList, use the `#items` property, or the `#toArray` method, to get a plain array back. You can also use the `#get` or `#set` methods to retrieve or set an item.\n\nFileLists are *lazy*, in that the actual file paths are not determined from the include and exclude patterns until the individual items are requested. This allows you to define a FileList and incrementally add patterns to it in the Sakefile file. The FileList paths will not be resolved until the task that uses it as a prerequisite actually asks for the final paths.\n\n\n### FileList Utility Properties & Methods ###\n\n*   `existing` &mdash; will return a new `FileList` with all of the files that actually exist.\n*   `notExisting` &mdash; will return a new `FileList` of all the files that do not exist.\n*   `extension(ext)` &mdash; returns a new `FileList` with all paths that match the given extension.\n\n~~~js\nfl.extension(\".scss\").forEach(function (path) {\n    //...\n});\n~~~\n\n*   `grep(pattern)` &mdash; get a `FileList` of all the files that match the given `pattern`. `pattern` can be a plain `String`, a `Glob` pattern, a `RegExp`, or a `function` that receives each path and can return a truthy value to include it.\n*   `clearExcludes()` &mdash; clear all exclude patterns/functions.\n*   `clearIncludes()` &mdash; clear all include patterns.\n\nBy default, a `FileList` excludes directories. To allow directories call `FileList#clearExcludes()` before requesting any items.\n\n\nThe \"clean\" and \"clobber\" Tasks, and The CLEAN and CLOBBER FileLists\n--------------------------------------------------------------------\n\nWithin a `Sakefile`:\n\n~~~js\n// defines the CLEAN FileList and 'clean' task\nrequire(\"sake/clean\");\n\n// defines the above, and also the CLOBBER FileTask and 'clobber' task\nrequire(\"sake/clobber\");\n~~~\n\nWhen the \"clean\" task is run, it will remove any files that have been included in the `CLEAN FileList`. \"clobber\" will remove any file, or directory, included in the `CLOBBER FileList`.\n\n\nSaké Utility Functions\n----------------------\n\nSaké defines a few utility functions to make life a little easier in an asynchronous world. Most of these are just wrappers for `node`'s File System (`require(\"fs\")`) utility methods.\n\n### Synchronous Utilities ###\n\n*   `mkdir(dirpath, mode=\"777\")` &mdash; create the `dirpath` directory, if it doesn't already exist.\n*   `mkdir_p(dirpath, mode=\"777\"])` &mdash; as above, but create all intermediate directories as needed.\n*   `rm(path, [path1, ..., pathN])` &mdash; remove one or more paths from the file system.\n*   `rm_rf(path, [path1, ..., pathN])` &mdash; as above, and remove directories and their contents.\n*   `cp(from, to)` &mdash; copy a file from `from` path to `to` path.\n*   `cp_r(from, to)` &mdash; copy all files from `from` path to `to` path.\n*   `mv(from, to)` &mdash; move a file from `from` path to `to` path.\n*   `ln(from, to)` &mdash; create a hard link from `from` path to `to` path.\n*   `ln_s(from, to)` &mdash; create a symlink from `from` path to `to` path.\n*   `cat(path, [path1, ..., pathN]) {string}` &mdash; read all supplied paths and return their contents as a string. If an argument is an `Array` it will be expanded and those paths will be read.\n*   `readdir(path) {array[string]}` &mdash; returns the files of directory `path`.\n*   `read(path, [enc]) {string|Buffer}` &mdash; read the supplied file path. Returns a `buffer`, or a `string` if `enc` is given.\n*   `write(path, data, [enc], mode=\"w\")` &mdash; write the `data` to the supplied file `path`. `data` should be a `buffer` or a `string` if `enc` is given. `mode` is a `string` of either \"w\", for over write,  or \"a\" for append.\n*   `slurp(path, [env]) {sring|Buffer}` &mdash; alias for `read`\n*   `spit(path, data, [enc], mode=\"w\")` &mdash; alias for `write`\n\n\n### Asynchronous Utilities ###\n\n*   `sh(cmd, fn(error, result))` &mdash; execute shell `cmd`. In the callback function, `error` will be a truthy value if there was an error, and `result` will contain the STDERR returned from `cmd`. Otherwise, `result` will contain the STDOUT from the `cmd`.\n\n\nReport an Issue\n---------------\n\n* [Bugs](http://github.com/jhamlet/node-sake/issues)\n* Contact the author: <jhamlet@hamletink.com>\n\n\nLicense\n-------\n\n> Copyright (c) 2012 Jerry Hamlet <jerry@hamletink.com>\n> \n> Permission is hereby granted, free of charge, to any person\n> obtaining a copy of this software and associated documentation\n> files (the \"Software\"), to deal in the Software without\n> restriction, including without limitation the rights to use,\n> copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the\n> Software is furnished to do so, subject to the following\n> conditions:\n> \n> The above copyright notice and this permission notice shall be\n> included in all copies or substantial portions of the Software.\n> \n> The Software shall be used for Good, not Evil.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n> OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n> HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n> WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n> FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n> OTHER DEALINGS IN THE SOFTWARE.\n\n","maintainers":[{"name":"jhamlet","email":"jerry@hamletink.com"}]},"0.1.12":{"name":"sake","description":"[S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.","version":"0.1.12","keywords":["build","make","rake","jake"],"main":"./lib/node_modules/sake/index.js","bin":{"sake":"./bin/sake"},"directories":{"lib":"lib"},"dependencies":{"nomnom":">=1.5.x","async":">=0.1.18","resolve":">=0.2.x","proteus":">=0.0.x","wordwrap":">=0.0.2"},"devDependencies":{"mocha":">=0.3.x","should":">=0.5.x","underscore":">=1.3.x"},"scripts":{"test":"mocha test/test-*"},"licenses":[{"type":"MIT","url":"http://github.com/jhamlet/node-sake/raw/master/LICENSE"}],"repository":{"type":"git","url":"git://github.com/jhamlet/node-sake.git"},"bugs":{"url":"http://github.com/jhamlet/node-sake/issues"},"preferGlobal":true,"_npmUser":{"name":"jhamlet","email":"jerry@hamletink.com"},"_id":"sake@0.1.12","contributors":[{"name":"Jerry Hamlet","email":"jerry@hamletink.com"}],"optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.12","_nodeVersion":"v0.6.10","_defaultsLoaded":true,"dist":{"shasum":"18813d53ab8346261144e5f2b533ce099005a804","tarball":"https://registry.npmjs.org/sake/-/sake-0.1.12.tgz","integrity":"sha512-MJSP4eY5E7n0cUchopTAd7PSs3xHlf3AJHhZi4WsjGbAZA18eG/a2u+cnVBNZZ74srsUa6SUX9j9gfMtKlVaNA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDyAuJHgRYwq2eCpLoxpo72xj00BqeRos5luK08HivW8AiBa1Y2HZijcWf3JnRAssLnsr3GES+qyUbpjZkWz9eDjxg=="}]},"readme":"\nSaké\n====\n\n> [S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.\n\n\nOverview\n--------\n\nThis package contains **saké**, a JavaScript build program that runs in node with capabilities similar to ruby's Rake.\n\nSaké has the following features:\n\n1.  `Sakefiles` (**saké’s** version of Rakefiles) are completely defined in standard JavaScript (or CoffeeScript, for those who want an even more Rake-like feel).\n2.  Flexible `FileLists` that act like arrays but know about manipulating file names and paths.\n3.  `clean` and `clobber` tasks are available for tidying up.\n4.  _Asynchronous_ task handling, with easy options for specifying _synchronous_ tasks.\n5.  Simple _namespacing_ of tasks to break projects into discreet parts.\n5.  Many utility methods for handling common build tasks (rm, rm_rf, mkdir, mkdir_p, sh, cat, etc...)\n\n\nInstallation\n------------\n\n### Install with npm\n\nDownload and install with the following:\n\n~~~\nnpm install -g sake\n~~~\n\nCommand-Line Usage\n------------------\n\n~~~\n% sake -h\n\nusage: sake [TASK] [ARGUMENTS ...] [ENV=VALUE ...] [options]\n\n[TASK]       Name of the task to run. Defaults to 'default'.\n[ARGUMENTS ...]     Zero or more arguments to pass to the task invoked.\n[ENV=VALUE ...]     Zero or more arguments to translate into environment variables.\n\noptions:\n   -f, --sakefile PATH       PATH to Sakefile to run instead of searching for one.\n   -T, --tasks [PATTERN]     List tasks with descriptions (optionally, just those\n                             matching PATTERN) and exit.\n   -P, --prereqs [PATTERN]   List tasks and their prerequisites (optionally, just\n                             those matching PATTERN) and exit.\n   -r, --require MODULE      Require MODULE before executing Sakefile and expose the\n                             MODULE under a sanitized namespace (i.e.: coffee-script\n                             => [sake.]coffeeScript). Can be specified multiple\n                             times.\n   -l, --sakelib PATH        Auto-include any .sake[.js|.coffeee] files in PATH.\n                             (default is 'sakelib'.) Can be specified multiple times\n   -n, --dry-run             Do a dry run without executing actions.\n   -C, --no-chdir            Do not change directory to the Sakefile location.\n   -N, --no-search           Do not search parent directories for a Sakefile.\n   -G, --no-system           Do not use SAKE_PATH environment variable to search for\n                             a Sakefile.\n   -S, --sync                Make all standard tasks 'synchronous' by default.\n   -d, --debug               Enable additional debugging output.\n   -q, --quiet               Suppress informational messages.\n   -V, --version             Print the version of sake and exit.\n   -h, --help                Print this help information and exit.\n\nSake searches the current directory, and all parent directories, for a Sakefile, unless\n--no-search is specified. Otherwise, if defined and --no-system is not set, it searches\npaths in the SAKE_PATH environment variable.\n\nIf found through normal searching, and not in SAKE_PATH, sake changes the process\ncurrent working directory to the directory of the found Sakefile, otherwise it stays\nwhere it was run from.\n\nSake then invokes the specified TASK, or the \"default\" one.\n\nSakefile can be one of \"Sakefile\", or \"sakefile\", with an optional extension of \".js\",\nor \".coffee\". (If you wan't to run a coffe-script file though, you will have to use the\n\".coffee\" extension.)\n~~~\n\n### Dependencies ###\n\nThese are installed when **sake** is installed.\n\n~~~\nnomnom:   >=1.5.x\nasync:    >=0.1.18\nresolve:  >=0.2.x\nproteus:  >=0.0.x\nwordwrap: >=0.0.2\n~~~\n\n\n### Development Dependencies ###\n\nInstalled when you run `npm link` in the package directory.\n\n~~~\nmocha:      >=0.3.x\nshould:     >=0.5.x\nunderscore: >=1.3.x\n~~~\n\n\nSakefile Usage\n--------------\n\nWithin a `Sakefile`, Saké's methods are exported to the global scope, so you can invoke them directly:\n\n~~~js\ntask(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n~~~\n    \nWithin another node module you can `require(\"sake\")` and access the methods on the exported object, or even run a block of code in the **saké** context (virtual machine):\n\n~~~js\nvar sake = require(\"sake\");\n    \nsake.task(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n\n// The function passed to sake#run is compiled and run in the sake context.\n// The function **will not** have access to any variables in this scope,\n// nor, will variables leak from the function's scope into this one.\nsake.run(function () {\n    var jsFiles = new FileList(\"src/js/**/*.js\");\n    \n    require(\"sake/clean\");\n    \n    task(\"script-min.js\", jsFiles, function (t) {\n        var cmd = \"infuse \" + jsFiles.map(function (path) {\n                return \"-i \" + path;\n            }) + \" -E\";\n            \n        sh(cmd, function (err, result) {\n            write(t.name, result, \"utf8\");\n            t.done();\n        })\n    });\n    \n    CLEAN.include(\"script-min.js\");\n});\n~~~\n\nThe remainder of this documentation will assume that we are calling the methods from within a `Sakefile`.\n\n\nDefining Tasks\n--------------\n\nThe various task methods take the following arguments:\n\n1.   `taskname`: `string` &mdash; naming the task\n2.   `prerequisites`: _optional_ \n    *   an `array` of:\n        *   `string` task name, or\n        *   a `FileLists`, or \n        *   a `function` that returns one of the above.\n    *   or, you can also pass a `FileList` in directly for `prerequisites`.\n3.   `action`: an _optional_ `function` that will be called when the task is invoked. It will be passed the task instance as its first argument, followed by any arguments that it was invoked with (either from the command-line, or through code). Task arguments can also be accessed through the instance's `arguments` property. i.e: `t.arguments`.\n\nAll task methods return the task *instance*.\n\nIf a task is already defined, it will be augmented by the additional arguments. So, this:\n\n~~~js\ntask(\"one\", [\"othertask\"], function (t) {\n    // do action one...\n    t.done();\n});\n\ntask(\"one\", function (t) {\n    // do action two...\n    t.done();\n});\n\ntask(\"othertask\");\n~~~\n\nWould result in a task \"othertask\" with no prerequisites, and no action, and a task \"one\" with \"othertask\" as a prerequisite and the two functions as its actions.\n\n**Note** how the dependent task was defined *after* it was required as a prerequisite. Task prerequisites are not resolved until the task is invoked. This leads to flexibility in how to compose your tasks and prerequisite tasks.\n\n\n### Task Instance Properties and Methods ###\n\n*   `name {string}` &mdash; the name of the task.\n*   `namespace {string}` &mdash; the task's namespace.\n*   `type {string}` &mdash; one of \"task\", \"file-task\", or \"file-create-task\"\n*   `fqn {string}` &mdash; the fully qualified name of the task. i.e: \"namespace:name\".\n*   `prerequisites {array}` &mdash; the list of prerequisite names for the task.\n*   `isNeeded {boolean}` &mdash; whether or not this task needs to run.\n*   `timestamp {boolean}` &mdash; the last modification time for the task.\n*   `invoke([args ...]) {Task}` &mdash; invoke the task passing args to each action for the task. Will run any prerequisites first. Returns the task instance.\n*   `execute([args ...]) {Task}` &mdash; Like `invoke`, but run the task even if it has already been run, or is not needed.\n*   `done()` &mdash; signal that the current task's action is done running.\n*   `abort([msg], [exitCode])` &mdash; abort the currently running task's actions, if _exitCode_ is specified **saké** will exit with that exit code and no other tasks will be processed. Otherwise, task processing will continue as normal.\n\n\n### Task Static Properties and Methods ###\n\n*   `namespace {string}` &mdash; the current namespace.\n*   `invoke(name, [rest ...]) {Task}` &mdash; invoke the named task and pass it the rest of the arguments.\n*   `get(name, [namespace]) {Task}` &mdash; get the task _name_, optionally start looking in _namespace_. Will throw an error if it can not find a task.\n*   `lookup(name, [namespace]) {Task|null}` &mdash; lookup a task with _name_, optionally start looking in _namespace_.\n*   `getAll() {array[Task]}` &mdash; return all defined tasks.\n*   `has(name, [namespace]) {boolean}` &mdash; does the task _name_ exist?\n*   `find(args, sortFn) {array[Task]}` &mdash; search for a task. _args_ can be an object with keys specifying which properties to match on, and their values denoting the value to match. _args_ can also be a function that accepts a task and returns a boolean whether or not that task matches.\n\n\nFile Tasks\n----------\n\nFile tasks are created with the (appropriately named) `file` method. File tasks, however, are only triggered if the file doesn't exist, or the modification time of any of its prerequisites is newer than itself.\n\n~~~js\nfile(\"path/to/some/file\", function (t) {\n    cp(\"other/path\", t.name);\n    t.done();\n});\n~~~\n\nThe above task would only be triggered if `path/to/some/file` did not exist.\n\nThe following:\n\n~~~js\nfile(\"combined/file/path\", [\"pathA\", \"pathB\", \"pathC\"], function (t) {\n    write(t.name, cat(t.prerequisites), \"utf8\");\n    t.done();\n});\n~~~\n\nwould be triggered if `path/to/some/file` did not exist, or its modification time was earlier than any of its prerequisites (`pathA`, `pathB`, or  `pathC`).\n\n\nDirectory Tasks\n---------------\n\nDirectory tasks, created with the `directory` method, are tasks that will only be called if they do not exist. A task will be created for the named directory (and for all directories along the way) with the action of creating the directory.\n\nDirectory tasks do not take any `prerequisites` or an `action` when first defined, however, they may be augmented with such after they are created:\n\n~~~js\ndirectory(\"dir/path/to/create\");\n\ntask(\"dir/path/to/create\", [\"othertask\"], action (t) {\n    //... do stuff\n    t.done();\n});\n~~~\n\n\nFile Create Tasks\n-----------------\n\nA file create task is a file task, that when used as a prerequisite, will be needed if, and only if, the file has not been created. Once created, it is not re-triggered if any of its prerequisites are newer, nor does it trigger any rebuilds of tasks that depend on it whenever the file is updated.\n\n~~~js\nfileCreate(\"file/path/to/create.ext\", [\"pathA\", \"pathB\"], function (t) {\n    // create file...\n    t.done();\n});\n~~~\n\n\n(A)Synchronicity and Tasks\n--------------------------\n\nIn **saké** all task actions are assumed to be *asynchronous* and an action must call its task's `done` method to tell **saké** that it is done processing stuff.\n\n~~~js\ntask(\"long task\", function (t) {\n    sh(\"some long running shell command\", function (err, result) {\n        // do stuff...\n        t.done();\n    });\n});\n~~~\n\nAlternatively, you can use the `Sync` version of a task to add a *synchronous* action, and `done` will be called for you after the function completes.\n\n~~~js\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n~~~\n\nThere are `Sync` versions of all the core tasks: `taskSync`, `fileSync`, and `fileCreateSync`. Thre are also `Async` versions of each task: `taskAsync`, `fileAsync`, and `fileCreateAsync`. The actions created for a `directory` task are *synchronous*. You can add *asynchronous* task actions after the initial definition.\n\nThirdly, you can specify that all of the core task creation functions generate *synchronous* actions by setting **saké's** \"sync\" option to `true`, or by use of the command-line option `-S, --sync`.\n\n~~~js\nsake.options.sync = true;\n\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n\n//... define more synchronous tasks\n\n//... and then revert to async\nsake.options.sync = false;\n~~~\n\nUltimately, it is up to the **saké** script author to correctly designate a task action as *synchronous* or *asynchronous*. Nothing prevents the running of an *asynchronous* function within a task's *synchronous* action. If nothing is dependent on the result of that action, then no problem would occur. It's when other tasks rely on the completion of certain *asynchronous* actions, that problems may arise.\n\nIn the case of *asynchronous* actions, **Saké** will issue a `WARNING` when it can not detect a `done()` call within that action.\n\n\nNamespaces\n----------\n\n**Saké** supports simple name spacing of tasks. Simply prepend the namespace before the task name with a colon \":\". This can be done when defining a task, or in the list of prerequisites for a task.\n\n~~~js\n// Defines a task 'fuz' in the namespace 'foo' that depends on the task 'buz'\n// in the namespace 'baz'\ntask(\"foo:fuz\", [\"baz:buz\"], function (t) {\n    //...\n    t.done();\n});\n~~~\n\nThen invoke the task as so:\n\n~~~\n% sake foo:fuz\n~~~\n\nYou can also use the convenience function `namespace` to wrap your task definitions for a particular namespace. Any _namespace naked_ definitions will first be tried in the local namespace, otherwise they will fall-back to the default namespace:\n\n~~~js\n\ntask(\"default\", function (t) {\n    //...\n    t.done():\n});\n\ntask(\"bazil\", function (t) {\n    //...\n    t.done():\n});\n\n// define within the 'foo' namespace\nnamespace(\"foo\", function () {\n    \n    // defines 'foo:foom' task\n    task(\"foom\", function (t) {\n        //...\n        t.done():\n    });\n    \n});\n\nnamespace(\"baz\", function () {\n    \n    // this task is defined in the 'baz' namespace, and depends on the\n    // 'foom' task from the 'foo' namespace\n    task(\"bazil\", [\"foo:foom\"], function (t) {\n        //...\n        t.done():\n    });\n    // This task is also defined in the 'baz' namespace. It depends on \n    // the 'bazil' task, which is also defined in 'baz' namespace. It\n    // also depends on the 'default' task in the 'default' (top-level)\n    // namespace.\n    task(\"buzil\", [\"bazil\", \"default\"], function (t), {\n        //...\n        t.done():\n    });\n    // If 'bazil' wasn't defined in the 'baz' namespace, it would resolve\n    // to the 'default' namespace task.\n});\n~~~\n\n**Note:** prerequisite names are tied to the defined task's namespace. i.e: If a task \"foo:fuz\" depends on \"foom\" **saké** will look in the \"foo\" namespace for \"foom\", and then the \"default\" namespace.\n\n**Note:** although the `namespace` functions can be nested, **saké** does not track the hierarchy of `namespace` calls -- if a dependent task is not found in the current task's namespace, it will look for it in the default namespace.\n\n\nPassing Arguments to A Task\n---------------------------\n\nThere are two ways to pass arguments to a task.\n\nFirst, **saké** translates any arguments in the form of `ENV=VALUE` on the command-line into `process.env` values:\n\n~~~\n% sake build BUILD_TYPE=debug ENVIRONMENT=prod\n~~~\n\nWill set `process.env.BUILD_TYPE` to \"debug\" and `process.env.ENVIRONMENT` to \"prod\". The values are JSON parsed; so the values are translated into real JavaScript values (numbers, true, false, etc...).\n\nSecondly, **saké** passes all non-option, and non-ENV=VALUE, looking arguments from the command-line to the invoked task:\n\n~~~\n% sake foo 3.14 pie true\n~~~\n\nWill invoke the \"foo\" task and pass to each of foo's actions (after the task instance itself) `3.14`, \"pie\" and `true`. The arguments are also JSON parsed to get real JavaScript values.\n\n~~~js\ntask(\"foo\", function (t, amt, word, flag) {\n    log(amt);   // => 3.14\n    log(word);  // => \"pie\"\n    log(flag);  // => true\n});\n~~~\n\n**Note:** This differs from how **rake**, and **jake** do things. In **saké** you can only invoke one task on the command-line. All other arguments on the command-line are considered task arguments.\n\n\nIncluding Other Saké Files\n-------------------------------------\n\nYou can include other **saké** files with the `include` and `load` methods. The included files will be run in the **saké** context, so any variables they do not declare with the `var` keyword will be set on the global **saké** context. This allows you to break your project build files up into discreet files.\n\nAll `require` and `include`, or `load` statements, are resolved relative to the current file, so you can create your own hierarchy of build dependencies.\n\n\nSake Library\n------------\n\n**Saké** will load any `.sake`, `.sake.js`, or `.sake.coffee` files located in a `sakelib` directory relative to the `Sakefile` being run. This directory name can be modified with the `-l, --sakelib` option, and multiple directories can be specified. This allows you to re-use common tasks across multiple projects.\n\n\nFile Lists\n----------\n\nFileLists are lists of file paths.\n\n~~~js\nnew FileList(\"*.scss\");\n~~~\n\nWould contain all the file paths with a \".scss\" extension in the top-level directory of your project.\n\nYou can use FileLists pretty much like an `Array`. You can iterate them (with `forEach, filter, reduce`, etc...), `concat` them, `splice` them, and you get back a new FileList object.\n\nTo add files, or glob patterns to them, use the `#include` method:\n\n~~~js\nvar fl = new FileList(\"*.scss\");\nfl.include(\"core.css\", \"reset.css\", \"*.css\");\n~~~\n\nYou can also `exlucude` files by Glob pattern, `Regular Expression` pattern, or by use of a `function` that takes the file path as an argument and returns a `truthy` value to exclude a file.\n\n~~~js\n// Exclude by RegExp\nfl.exclude(/^dev-.*\\.css/);\n\n// Exclude by Glob pattern\nfl.exclude(\"dev-*.css\");\n\n// Exclude by function\nfl.exclude(function (path) {\n    return FS.statSync(path).mtime.getTime() < (Date.now() - 60 * 60 * 1000);\n});\n~~~\n\nTo get to the actual items of the FileList, use the `#items` property, or the `#toArray` method, to get a plain array back. You can also use the `#get` or `#set` methods to retrieve or set an item.\n\nFileLists are *lazy*, in that the actual file paths are not determined from the include and exclude patterns until the individual items are requested. This allows you to define a FileList and incrementally add patterns to it in the Sakefile file. The FileList paths will not be resolved until the task that uses it as a prerequisite actually asks for the final paths.\n\n\n### FileList Utility Properties & Methods ###\n\n*   `existing` &mdash; will return a new `FileList` with all of the files that actually exist.\n*   `notExisting` &mdash; will return a new `FileList` of all the files that do not exist.\n*   `extension(ext)` &mdash; returns a new `FileList` with all paths that match the given extension.\n\n~~~js\nfl.extension(\".scss\").forEach(function (path) {\n    //...\n});\n~~~\n\n*   `grep(pattern)` &mdash; get a `FileList` of all the files that match the given `pattern`. `pattern` can be a plain `String`, a `Glob` pattern, a `RegExp`, or a `function` that receives each path and can return a truthy value to include it.\n*   `clearExcludes()` &mdash; clear all exclude patterns/functions.\n*   `clearIncludes()` &mdash; clear all include patterns.\n\nBy default, a `FileList` excludes directories. To allow directories call `FileList#clearExcludes()` before requesting any items.\n\n\nThe \"clean\" and \"clobber\" Tasks, and The CLEAN and CLOBBER FileLists\n--------------------------------------------------------------------\n\nWithin a `Sakefile`:\n\n~~~js\n// defines the CLEAN FileList and 'clean' task\nrequire(\"sake/clean\");\n\n// defines the above, and also the CLOBBER FileTask and 'clobber' task\nrequire(\"sake/clobber\");\n~~~\n\nWhen the \"clean\" task is run, it will remove any files that have been included in the `CLEAN FileList`. \"clobber\" will remove any file, or directory, included in the `CLOBBER FileList`.\n\n\nSaké Utility Functions\n----------------------\n\nSaké defines a few utility functions to make life a little easier in an asynchronous world. Most of these are just wrappers for `node`'s File System (`require(\"fs\")`) utility methods.\n\n### Synchronous Utilities ###\n\n*   `mkdir(dirpath, mode=\"777\")` &mdash; create the `dirpath` directory, if it doesn't already exist.\n*   `mkdir_p(dirpath, mode=\"777\"])` &mdash; as above, but create all intermediate directories as needed.\n*   `rm(path, [path1, ..., pathN])` &mdash; remove one or more paths from the file system.\n*   `rm_rf(path, [path1, ..., pathN])` &mdash; as above, and remove directories and their contents.\n*   `cp(from, to)` &mdash; copy a file from `from` path to `to` path.\n*   `cp_r(from, to)` &mdash; copy all files from `from` path to `to` path.\n*   `mv(from, to)` &mdash; move a file from `from` path to `to` path.\n*   `ln(from, to)` &mdash; create a hard link from `from` path to `to` path.\n*   `ln_s(from, to)` &mdash; create a symlink from `from` path to `to` path.\n*   `cat(path, [path1, ..., pathN]) {string}` &mdash; read all supplied paths and return their contents as a string. If an argument is an `Array` it will be expanded and those paths will be read.\n*   `readdir(path) {array[string]}` &mdash; returns the files of directory `path`.\n*   `read(path, [enc]) {string|Buffer}` &mdash; read the supplied file path. Returns a `buffer`, or a `string` if `enc` is given.\n*   `write(path, data, [enc], mode=\"w\")` &mdash; write the `data` to the supplied file `path`. `data` should be a `buffer` or a `string` if `enc` is given. `mode` is a `string` of either \"w\", for over write,  or \"a\" for append.\n*   `slurp(path, [env]) {sring|Buffer}` &mdash; alias for `read`\n*   `spit(path, data, [enc], mode=\"w\")` &mdash; alias for `write`\n\n\n### Asynchronous Utilities ###\n\n*   `sh(cmd, fn(error, result))` &mdash; execute shell `cmd`. In the callback function, `error` will be a truthy value if there was an error, and `result` will contain the STDERR returned from `cmd`. Otherwise, `result` will contain the STDOUT from the `cmd`.\n\n\nReport an Issue\n---------------\n\n* [Bugs](http://github.com/jhamlet/node-sake/issues)\n* Contact the author: <jhamlet@hamletink.com>\n\n\nLicense\n-------\n\n> Copyright (c) 2012 Jerry Hamlet <jerry@hamletink.com>\n> \n> Permission is hereby granted, free of charge, to any person\n> obtaining a copy of this software and associated documentation\n> files (the \"Software\"), to deal in the Software without\n> restriction, including without limitation the rights to use,\n> copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the\n> Software is furnished to do so, subject to the following\n> conditions:\n> \n> The above copyright notice and this permission notice shall be\n> included in all copies or substantial portions of the Software.\n> \n> The Software shall be used for Good, not Evil.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n> OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n> HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n> WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n> FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n> OTHER DEALINGS IN THE SOFTWARE.\n\n","maintainers":[{"name":"jhamlet","email":"jerry@hamletink.com"}]},"0.1.13":{"name":"sake","description":"[S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.","version":"0.1.13","keywords":["build","make","rake","jake"],"main":"./lib/node_modules/sake/index.js","bin":{"sake":"./bin/sake"},"directories":{"lib":"lib"},"dependencies":{"nomnom":">=1.5.x","async":">=0.1.x","resolve":">=0.2.x","proteus":">=0.0.x","wordwrap":">=0.0.2"},"devDependencies":{"mocha":">=0.3.x","should":">=0.5.x","underscore":">=1.3.x"},"scripts":{"test":"mocha test/test-*"},"licenses":[{"type":"MIT","url":"http://github.com/jhamlet/node-sake/raw/master/LICENSE"}],"repository":{"type":"git","url":"git://github.com/jhamlet/node-sake.git"},"bugs":{"url":"http://github.com/jhamlet/node-sake/issues"},"preferGlobal":true,"_npmUser":{"name":"jhamlet","email":"jerry@hamletink.com"},"_id":"sake@0.1.13","contributors":[{"name":"Jerry Hamlet","email":"jerry@hamletink.com"}],"optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.12","_nodeVersion":"v0.6.10","_defaultsLoaded":true,"dist":{"shasum":"62cbed77961669981611375aa6ce55149e45c0ab","tarball":"https://registry.npmjs.org/sake/-/sake-0.1.13.tgz","integrity":"sha512-MW7eAwoKkZbH/btNHcuzJHVQh04gp7FN7cnF00jhGtPmktQmF1Sxnt8u52ENcu94jA+0AZS1IP0t5zaPVDyASA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIE+W74sdHHqg4pykCo+vcTyV7h6HMxyfQS1h8CCeY3zWAiB89PcxGJesSQPR1AqkkleJGI7Wx/JOjLwilrygoWx+1A=="}]},"readme":"\nSaké\n====\n\n> [S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.\n\n\nOverview\n--------\n\nThis package contains **saké**, a JavaScript build program that runs in node with capabilities similar to ruby's Rake.\n\nSaké has the following features:\n\n1.  `Sakefiles` (**saké’s** version of Rakefiles) are completely defined in standard JavaScript (or CoffeeScript, for those who want an even more Rake-like feel).\n2.  Flexible `FileLists` that act like arrays but know about manipulating file names and paths.\n3.  `clean` and `clobber` tasks are available for tidying up.\n4.  _Asynchronous_ task handling, with easy options for specifying _synchronous_ tasks.\n5.  Simple _namespacing_ of tasks to break projects into discreet parts.\n5.  Many utility methods for handling common build tasks (rm, rm_rf, mkdir, mkdir_p, sh, cat, etc...)\n\n\nInstallation\n------------\n\n### Install with npm\n\nDownload and install with the following:\n\n~~~\nnpm install -g sake\n~~~\n\nCommand-Line Usage\n------------------\n\n~~~\n% sake -h\n\nusage: sake [TASKNAME] [ARGUMENTS ...] [ENV=VALUE ...] [options]\n\n[TASKNAME]     Name of the task to run. Defaults to 'default'.\n[ARGUMENTS ...]     Zero or more arguments to pass to the task invoked.\n[ENV=VALUE ...]     Zero or more arguments to translate into environment variables.\n\noptions:\n   -f, --sakefile PATH       PATH to Sakefile to run instead of searching for one.\n   -T, --tasks [PATTERN]     List tasks with descriptions (optionally, just those\n                             matching PATTERN) and exit.\n   -P, --prereqs [PATTERN]   List tasks and their prerequisites (optionally, just\n                             those matching PATTERN) and exit.\n   -r, --require MODULE      Require MODULE before executing Sakefile and expose the\n                             MODULE under a sanitized namespace (i.e.: coffee-script\n                             => [sake.]coffeeScript). Can be specified multiple\n                             times.\n   -l, --sakelib PATH        Auto-include any .sake[.js|.coffeee] files in PATH.\n                             (default is 'sakelib'.) Can be specified multiple times\n   -n, --dry-run             Do a dry run without executing actions.\n   -C, --no-chdir            Do not change directory to the Sakefile location.\n   -N, --no-search           Do not search parent directories for a Sakefile.\n   -G, --no-system           Do not use SAKE_PATH environment variable to search for\n                             a Sakefile.\n   -S, --sync                Make all standard tasks 'synchronous' by default.\n   -d, --debug               Enable additional debugging output.\n   -q, --quiet               Suppress informational messages.\n   -V, --version             Print the version of sake and exit.\n   -h, --help                Print this help information and exit.\n\nIf a Sakefile is not specified, sake searches the current directory, and all parent\ndirectories, for one (unless -N, --no-search is set). Otherwise, if the SAKE_PATH\nenvironment variable is defined it searches those path(s) (unless -G, --no-system is\nset).\n\nIf specified, or found through normal searching (not in SAKE_PATH(s)), sake changes the\nprocess' current working directory to the directory of the found Sakefile (unless -C,\n--no-chdir is set), otherwise it stays where it was run from.\n\nSake then invokes the specified TASKNAME, or the \"default\" one.\n\nSakefile can be one of \"Sakefile\", or \"sakefile\", with an optional extension of \".js\",\nor \".coffee\".\n~~~\n\n### Dependencies ###\n\nThese are installed when **sake** is installed.\n\n~~~\nnomnom:   >=1.5.x\nasync:    >=0.1.18\nresolve:  >=0.2.x\nproteus:  >=0.0.x\nwordwrap: >=0.0.2\n~~~\n\n\n### Development Dependencies ###\n\nInstalled when you run `npm link` in the package directory.\n\n~~~\nmocha:      >=0.3.x\nshould:     >=0.5.x\nunderscore: >=1.3.x\n~~~\n\n\nSakefile Usage\n--------------\n\nWithin a `Sakefile`, Saké's methods are exported to the global scope, so you can invoke them directly:\n\n~~~js\ntask(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n~~~\n    \nWithin another node module you can `require(\"sake\")` and access the methods on the exported object, or even run a block of code in the **saké** context (virtual machine):\n\n~~~js\nvar sake = require(\"sake\");\n    \nsake.task(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n\n// The function passed to sake#run is compiled and run in the sake context.\n// The function **will not** have access to any variables in this scope,\n// nor, will variables leak from the function's scope into this one.\nsake.run(function () {\n    var jsFiles = new FileList(\"src/js/**/*.js\");\n    \n    require(\"sake/clean\");\n    \n    task(\"script-min.js\", jsFiles, function (t) {\n        var cmd = \"infuse \" + jsFiles.map(function (path) {\n                return \"-i \" + path;\n            }) + \" -E\";\n            \n        sh(cmd, function (err, result) {\n            write(t.name, result, \"utf8\");\n            t.done();\n        })\n    });\n    \n    CLEAN.include(\"script-min.js\");\n});\n~~~\n\nThe remainder of this documentation will assume that we are calling the methods from within a `Sakefile`.\n\n\nDefining Tasks\n--------------\n\nThe various task methods take the following arguments:\n\n1.   `taskname`: `string` &mdash; naming the task\n2.   `prerequisites`: _optional_ \n    *   an `array` of:\n        *   `string` task name, or\n        *   a `FileLists`, or \n        *   a `function` that returns one of the above.\n    *   or, you can also pass a `FileList` in directly for `prerequisites`.\n3.   `action`: an _optional_ `function` that will be called when the task is invoked. It will be passed the task instance as its first argument, followed by any arguments that it was invoked with (either from the command-line, or through code). Task arguments can also be accessed through the instance's `arguments` property. i.e: `t.arguments`.\n\nAll task methods return the task *instance*.\n\nIf a task is already defined, it will be augmented by the additional arguments. So, this:\n\n~~~js\ntask(\"one\", [\"othertask\"], function (t) {\n    // do action one...\n    t.done();\n});\n\ntask(\"one\", function (t) {\n    // do action two...\n    t.done();\n});\n\ntask(\"othertask\");\n~~~\n\nWould result in a task \"othertask\" with no prerequisites, and no action, and a task \"one\" with \"othertask\" as a prerequisite and the two functions as its actions.\n\n**Note** how the dependent task was defined *after* it was required as a prerequisite. Task prerequisites are not resolved until the task is invoked. This leads to flexibility in how to compose your tasks and prerequisite tasks.\n\n\n### Task Instance Properties and Methods ###\n\n*   `name {string}` &mdash; the name of the task.\n*   `namespace {string}` &mdash; the task's namespace.\n*   `type {string}` &mdash; one of \"task\", \"file-task\", or \"file-create-task\"\n*   `fqn {string}` &mdash; the fully qualified name of the task. i.e: \"namespace:name\".\n*   `prerequisites {array}` &mdash; the list of prerequisite names for the task.\n*   `isNeeded {boolean}` &mdash; whether or not this task needs to run.\n*   `timestamp {boolean}` &mdash; the last modification time for the task.\n*   `invoke([args ...]) {Task}` &mdash; invoke the task passing args to each action for the task. Will run any prerequisites first. Returns the task instance.\n*   `execute([args ...]) {Task}` &mdash; Like `invoke`, but run the task even if it has already been run, or is not needed.\n*   `done()` &mdash; signal that the current task's action is done running.\n*   `abort([msg], [exitCode])` &mdash; abort the currently running task's actions, if _exitCode_ is specified **saké** will exit with that exit code and no other tasks will be processed. Otherwise, task processing will continue as normal.\n\n\n### Task Static Properties and Methods ###\n\n*   `namespace {string}` &mdash; the current namespace.\n*   `invoke(name, [rest ...]) {Task}` &mdash; invoke the named task and pass it the rest of the arguments.\n*   `get(name, [namespace]) {Task}` &mdash; get the task _name_, optionally start looking in _namespace_. Will throw an error if it can not find a task.\n*   `lookup(name, [namespace]) {Task|null}` &mdash; lookup a task with _name_, optionally start looking in _namespace_.\n*   `getAll() {array[Task]}` &mdash; return all defined tasks.\n*   `has(name, [namespace]) {boolean}` &mdash; does the task _name_ exist?\n*   `find(args, sortFn) {array[Task]}` &mdash; search for a task. _args_ can be an object with keys specifying which properties to match on, and their values denoting the value to match. _args_ can also be a function that accepts a task and returns a boolean whether or not that task matches.\n\n\nFile Tasks\n----------\n\nFile tasks are created with the (appropriately named) `file` method. File tasks, however, are only triggered if the file doesn't exist, or the modification time of any of its prerequisites is newer than itself.\n\n~~~js\nfile(\"path/to/some/file\", function (t) {\n    cp(\"other/path\", t.name);\n    t.done();\n});\n~~~\n\nThe above task would only be triggered if `path/to/some/file` did not exist.\n\nThe following:\n\n~~~js\nfile(\"combined/file/path\", [\"pathA\", \"pathB\", \"pathC\"], function (t) {\n    write(t.name, cat(t.prerequisites), \"utf8\");\n    t.done();\n});\n~~~\n\nwould be triggered if `path/to/some/file` did not exist, or its modification time was earlier than any of its prerequisites (`pathA`, `pathB`, or  `pathC`).\n\n\nDirectory Tasks\n---------------\n\nDirectory tasks, created with the `directory` method, are tasks that will only be called if they do not exist. A task will be created for the named directory (and for all directories along the way) with the action of creating the directory.\n\nDirectory tasks do not take any `prerequisites` or an `action` when first defined, however, they may be augmented with such after they are created:\n\n~~~js\ndirectory(\"dir/path/to/create\");\n\ntask(\"dir/path/to/create\", [\"othertask\"], action (t) {\n    //... do stuff\n    t.done();\n});\n~~~\n\n\nFile Create Tasks\n-----------------\n\nA file create task is a file task, that when used as a prerequisite, will be needed if, and only if, the file has not been created. Once created, it is not re-triggered if any of its prerequisites are newer, nor does it trigger any rebuilds of tasks that depend on it whenever the file is updated.\n\n~~~js\nfileCreate(\"file/path/to/create.ext\", [\"pathA\", \"pathB\"], function (t) {\n    // create file...\n    t.done();\n});\n~~~\n\n\n(A)Synchronicity and Tasks\n--------------------------\n\nIn **saké** all task actions are assumed to be *asynchronous* and an action must call its task's `done` method to tell **saké** that it is done processing stuff.\n\n~~~js\ntask(\"long task\", function (t) {\n    sh(\"some long running shell command\", function (err, result) {\n        // do stuff...\n        t.done();\n    });\n});\n~~~\n\nAlternatively, you can use the `Sync` version of a task to add a *synchronous* action, and `done` will be called for you after the function completes.\n\n~~~js\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n~~~\n\nThere are `Sync` versions of all the core tasks: `taskSync`, `fileSync`, and `fileCreateSync`. Thre are also `Async` versions of each task: `taskAsync`, `fileAsync`, and `fileCreateAsync`. The actions created for a `directory` task are *synchronous*. You can add *asynchronous* task actions after the initial definition.\n\nThirdly, you can specify that all of the core task creation functions generate *synchronous* actions by setting **saké's** \"sync\" option to `true`, or by use of the command-line option `-S, --sync`.\n\n~~~js\nsake.options.sync = true;\n\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n\n//... define more synchronous tasks\n\n//... and then revert to async\nsake.options.sync = false;\n~~~\n\nUltimately, it is up to the **saké** script author to correctly designate a task action as *synchronous* or *asynchronous*. Nothing prevents the running of an *asynchronous* function within a task's *synchronous* action. If nothing is dependent on the result of that action, then no problem would occur. It's when other tasks rely on the completion of certain *asynchronous* actions, that problems may arise.\n\nIn the case of *asynchronous* actions, **Saké** will issue a `WARNING` when it can not detect a `done()` call within that action.\n\n\nNamespaces\n----------\n\n**Saké** supports simple name spacing of tasks. Simply prepend the namespace before the task name with a colon \":\". This can be done when defining a task, or in the list of prerequisites for a task.\n\n~~~js\n// Defines a task 'fuz' in the namespace 'foo' that depends on the task 'buz'\n// in the namespace 'baz'\ntask(\"foo:fuz\", [\"baz:buz\"], function (t) {\n    //...\n    t.done();\n});\n~~~\n\nThen invoke the task as so:\n\n~~~\n% sake foo:fuz\n~~~\n\nYou can also use the convenience function `namespace` to wrap your task definitions for a particular namespace. Any _namespace naked_ definitions will first be tried in the local namespace, otherwise they will fall-back to the default namespace:\n\n~~~js\n\ntask(\"default\", function (t) {\n    //...\n    t.done():\n});\n\ntask(\"bazil\", function (t) {\n    //...\n    t.done():\n});\n\n// define within the 'foo' namespace\nnamespace(\"foo\", function () {\n    \n    // defines 'foo:foom' task\n    task(\"foom\", function (t) {\n        //...\n        t.done():\n    });\n    \n});\n\nnamespace(\"baz\", function () {\n    \n    // this task is defined in the 'baz' namespace, and depends on the\n    // 'foom' task from the 'foo' namespace\n    task(\"bazil\", [\"foo:foom\"], function (t) {\n        //...\n        t.done():\n    });\n    // This task is also defined in the 'baz' namespace. It depends on \n    // the 'bazil' task, which is also defined in 'baz' namespace. It\n    // also depends on the 'default' task in the 'default' (top-level)\n    // namespace.\n    task(\"buzil\", [\"bazil\", \"default\"], function (t), {\n        //...\n        t.done():\n    });\n    // If 'bazil' wasn't defined in the 'baz' namespace, it would resolve\n    // to the 'default' namespace task.\n});\n~~~\n\n**Note:** prerequisite names are tied to the defined task's namespace. i.e: If a task \"foo:fuz\" depends on \"foom\" **saké** will look in the \"foo\" namespace for \"foom\", and then the \"default\" namespace.\n\n**Note:** although the `namespace` functions can be nested, **saké** does not track the hierarchy of `namespace` calls -- if a dependent task is not found in the current task's namespace, it will look for it in the default namespace.\n\n\nPassing Arguments to A Task\n---------------------------\n\nThere are two ways to pass arguments to a task.\n\nFirst, **saké** translates any arguments in the form of `ENV=VALUE` on the command-line into `process.env` values:\n\n~~~\n% sake build BUILD_TYPE=debug ENVIRONMENT=prod\n~~~\n\nWill set `process.env.BUILD_TYPE` to \"debug\" and `process.env.ENVIRONMENT` to \"prod\". The values are JSON parsed; so the values are translated into real JavaScript values (numbers, true, false, etc...).\n\nSecondly, **saké** passes all non-option, and non-ENV=VALUE, looking arguments from the command-line to the invoked task:\n\n~~~\n% sake foo 3.14 pie true\n~~~\n\nWill invoke the \"foo\" task and pass to each of foo's actions (after the task instance itself) `3.14`, \"pie\" and `true`. The arguments are also JSON parsed to get real JavaScript values.\n\n~~~js\ntask(\"foo\", function (t, amt, word, flag) {\n    log(amt);   // => 3.14\n    log(word);  // => \"pie\"\n    log(flag);  // => true\n});\n~~~\n\n**Note:** This differs from how **rake**, and **jake** do things. In **saké** you can only invoke one task on the command-line. All other arguments on the command-line are considered task arguments.\n\n\nIncluding Other Saké Files\n-------------------------------------\n\nYou can include other **saké** files with the `include` and `load` methods. The included files will be run in the **saké** context, so any variables they do not declare with the `var` keyword will be set on the global **saké** context. This allows you to break your project build files up into discreet files.\n\nAll `require` and `include`, or `load` statements, are resolved relative to the current file, so you can create your own hierarchy of build dependencies.\n\n\nSake Library\n------------\n\n**Saké** will load any `.sake`, `.sake.js`, or `.sake.coffee` files located in a `sakelib` directory relative to the `Sakefile` being run. This directory name can be modified with the `-l, --sakelib` option, and multiple directories can be specified. This allows you to re-use common tasks across multiple projects.\n\n\nFile Lists\n----------\n\nFileLists are lists of file paths.\n\n~~~js\nnew FileList(\"*.scss\");\n~~~\n\nWould contain all the file paths with a \".scss\" extension in the top-level directory of your project.\n\nYou can use FileLists pretty much like an `Array`. You can iterate them (with `forEach, filter, reduce`, etc...), `concat` them, `splice` them, and you get back a new FileList object.\n\nTo add files, or glob patterns to them, use the `#include` method:\n\n~~~js\nvar fl = new FileList(\"*.scss\");\nfl.include(\"core.css\", \"reset.css\", \"*.css\");\n~~~\n\nYou can also `exlucude` files by Glob pattern, `Regular Expression` pattern, or by use of a `function` that takes the file path as an argument and returns a `truthy` value to exclude a file.\n\n~~~js\n// Exclude by RegExp\nfl.exclude(/^dev-.*\\.css/);\n\n// Exclude by Glob pattern\nfl.exclude(\"dev-*.css\");\n\n// Exclude by function\nfl.exclude(function (path) {\n    return FS.statSync(path).mtime.getTime() < (Date.now() - 60 * 60 * 1000);\n});\n~~~\n\nTo get to the actual items of the FileList, use the `#items` property, or the `#toArray` method, to get a plain array back. You can also use the `#get` or `#set` methods to retrieve or set an item.\n\nFileLists are *lazy*, in that the actual file paths are not determined from the include and exclude patterns until the individual items are requested. This allows you to define a FileList and incrementally add patterns to it in the Sakefile file. The FileList paths will not be resolved until the task that uses it as a prerequisite actually asks for the final paths.\n\n\n### FileList Properties & Methods ###\n\n*   `existing` &mdash; will return a new `FileList` with all of the files that actually exist.\n*   `notExisting` &mdash; will return a new `FileList` of all the files that do not exist.\n*   `extension(ext)` &mdash; returns a new `FileList` with all paths that match the given extension.\n\n~~~js\nfl.extension(\".scss\").forEach(function (path) {\n    //...\n});\n~~~\n\n*   `grep(pattern)` &mdash; get a `FileList` of all the files that match the given `pattern`. `pattern` can be a plain `String`, a `Glob` pattern, a `RegExp`, or a `function` that receives each path and can return a truthy value to include it.\n*   `clearExcludes()` &mdash; clear all exclude patterns/functions.\n*   `clearIncludes()` &mdash; clear all include patterns.\n\nBy default, a `FileList` excludes directories. To allow directories call `FileList#clearExcludes()` before requesting any items.\n\n\nThe \"clean\" and \"clobber\" Tasks, and The CLEAN and CLOBBER FileLists\n--------------------------------------------------------------------\n\nWithin a `Sakefile`:\n\n~~~js\n// defines the CLEAN FileList and 'clean' task\nrequire(\"sake/clean\");\n\n// defines the above, and also the CLOBBER FileTask and 'clobber' task\nrequire(\"sake/clobber\");\n~~~\n\nWhen the \"clean\" task is run, it will remove any files that have been included in the `CLEAN FileList`. \"clobber\" will remove any file, or directory, included in the `CLOBBER FileList`.\n\n\nSaké Utility Functions\n----------------------\n\nSaké defines a few utility functions to make life a little easier in an asynchronous world. Most of these are just wrappers for `node`'s File System (`require(\"fs\")`) utility methods.\n\n### Synchronous Utilities ###\n\n*   `mkdir(dirpath, mode=\"777\")` &mdash; create the `dirpath` directory, if it doesn't already exist.\n*   `mkdir_p(dirpath, mode=\"777\"])` &mdash; as above, but create all intermediate directories as needed.\n*   `rm(path, [path1, ..., pathN])` &mdash; remove one or more paths from the file system.\n*   `rm_rf(path, [path1, ..., pathN])` &mdash; as above, and remove directories and their contents.\n*   `cp(from, to)` &mdash; copy a file from `from` path to `to` path.\n*   `cp_r(from, to)` &mdash; copy all files from `from` path to `to` path.\n*   `mv(from, to)` &mdash; move a file from `from` path to `to` path.\n*   `ln(from, to)` &mdash; create a hard link from `from` path to `to` path.\n*   `ln_s(from, to)` &mdash; create a symlink from `from` path to `to` path.\n*   `cat(path, [path1, ..., pathN]) {string}` &mdash; read all supplied paths and return their contents as a string. If an argument is an `Array` it will be expanded and those paths will be read.\n*   `readdir(path) {array[string]}` &mdash; returns the files of directory `path`.\n*   `read(path, [enc]) {string|Buffer}` &mdash; read the supplied file path. Returns a `buffer`, or a `string` if `enc` is given.\n*   `write(path, data, [enc], mode=\"w\")` &mdash; write the `data` to the supplied file `path`. `data` should be a `buffer` or a `string` if `enc` is given. `mode` is a `string` of either \"w\", for over write,  or \"a\" for append.\n*   `slurp(path, [env]) {sring|Buffer}` &mdash; alias for `read`\n*   `spit(path, data, [enc], mode=\"w\")` &mdash; alias for `write`\n\n\n### Asynchronous Utilities ###\n\n*   `sh(cmd, fn(error, result))` &mdash; execute shell `cmd`. In the callback function, `error` will be a truthy value if there was an error, and `result` will contain the STDERR returned from `cmd`. Otherwise, `result` will contain the STDOUT from the `cmd`.\n\n\nReport an Issue\n---------------\n\n* [Bugs](http://github.com/jhamlet/node-sake/issues)\n* Contact the author: <jhamlet@hamletink.com>\n\n\nLicense\n-------\n\n> Copyright (c) 2012 Jerry Hamlet <jerry@hamletink.com>\n> \n> Permission is hereby granted, free of charge, to any person\n> obtaining a copy of this software and associated documentation\n> files (the \"Software\"), to deal in the Software without\n> restriction, including without limitation the rights to use,\n> copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the\n> Software is furnished to do so, subject to the following\n> conditions:\n> \n> The above copyright notice and this permission notice shall be\n> included in all copies or substantial portions of the Software.\n> \n> The Software shall be used for Good, not Evil.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n> OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n> HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n> WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n> FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n> OTHER DEALINGS IN THE SOFTWARE.\n\n","maintainers":[{"name":"jhamlet","email":"jerry@hamletink.com"}]},"0.1.14":{"name":"sake","description":"[S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.","version":"0.1.14","keywords":["build","make","rake","jake"],"main":"./lib/node_modules/sake/index.js","bin":{"sake":"./bin/sake"},"directories":{"lib":"lib"},"dependencies":{"nomnom":">=1.5.x","async":">=0.1.x","resolve":">=0.2.x","proteus":">=0.0.x","wordwrap":">=0.0.2"},"devDependencies":{"mocha":">=0.3.x","should":">=0.5.x","underscore":">=1.3.x"},"scripts":{"test":"mocha test/test-*"},"licenses":[{"type":"MIT","url":"http://github.com/jhamlet/node-sake/raw/master/LICENSE"}],"repository":{"type":"git","url":"git://github.com/jhamlet/node-sake.git"},"bugs":{"url":"http://github.com/jhamlet/node-sake/issues"},"preferGlobal":true,"_npmUser":{"name":"jhamlet","email":"jerry@hamletink.com"},"_id":"sake@0.1.14","contributors":[{"name":"Jerry Hamlet","email":"jerry@hamletink.com"}],"optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.12","_nodeVersion":"v0.6.10","_defaultsLoaded":true,"dist":{"shasum":"75e562903240e483a0baa9676c22398dc3fe2ace","tarball":"https://registry.npmjs.org/sake/-/sake-0.1.14.tgz","integrity":"sha512-T2cHmNy4R6uovlkedXjigYbk6JygIA37CFs/D7zMSc4xn41hSGoW60LS96b+ofayZQ8efyzcJcJJQiFjjw/Rpw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFxPWhpi86+x5Ij6t5Z1Kl1lQ0kPV8x7qCsP2zkBElH6AiEAjEIlQR/hmdFVEhJ+nXjlGiWrXf6Jqp5f32XY4+nhPL0="}]},"readme":"\nSaké\n====\n\n> [S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.\n\n\nOverview\n--------\n\nThis package contains **saké**, a JavaScript build program that runs in node with capabilities similar to ruby's Rake.\n\nSaké has the following features:\n\n1.  `Sakefiles` (**saké’s** version of Rakefiles) are completely defined in standard JavaScript (or CoffeeScript, for those who want an even more Rake-like feel).\n2.  Flexible `FileLists` that act like arrays but know about manipulating file names and paths.\n3.  `clean` and `clobber` tasks are available for tidying up.\n4.  _Asynchronous_ task handling, with easy options for specifying _synchronous_ tasks.\n5.  Simple _namespacing_ of tasks to break projects into discreet parts.\n5.  Many utility methods for handling common build tasks (rm, rm_rf, mkdir, mkdir_p, sh, cat, etc...)\n\n\nInstallation\n------------\n\n### Install with npm\n\nDownload and install with the following:\n\n~~~\nnpm install -g sake\n~~~\n\nCommand-Line Usage\n------------------\n\n~~~\n% sake -h\n\nusage: sake [TASKNAME] [ARGUMENTS ...] [ENV=VALUE ...] [options]\n\n[TASKNAME]     Name of the task to run. Defaults to 'default'.\n[ARGUMENTS ...]     Zero or more arguments to pass to the task invoked.\n[ENV=VALUE ...]     Zero or more arguments to translate into environment variables.\n\noptions:\n   -f, --sakefile PATH       PATH to Sakefile to run instead of searching for one.\n   -T, --tasks [PATTERN]     List tasks with descriptions (optionally, just those\n                             matching PATTERN) and exit.\n   -P, --prereqs [PATTERN]   List tasks and their prerequisites (optionally, just\n                             those matching PATTERN) and exit.\n   -r, --require MODULE      Require MODULE before executing Sakefile and expose the\n                             MODULE under a sanitized namespace (i.e.: coffee-script\n                             => [sake.]coffeeScript). Can be specified multiple\n                             times.\n   -l, --sakelib PATH        Auto-include any .sake[.js|.coffeee] files in PATH.\n                             (default is 'sakelib'.) Can be specified multiple times\n   -n, --dry-run             Do a dry run without executing actions.\n   -C, --no-chdir            Do not change directory to the Sakefile location.\n   -N, --no-search           Do not search parent directories for a Sakefile.\n   -G, --no-system           Do not use SAKE_PATH environment variable to search for\n                             a Sakefile.\n   -S, --sync                Make all standard tasks 'synchronous' by default.\n   -d, --debug               Enable additional debugging output.\n   -q, --quiet               Suppress informational messages.\n   -V, --version             Print the version of sake and exit.\n   -h, --help                Print this help information and exit.\n\nIf a Sakefile is not specified, sake searches the current directory, and all parent\ndirectories, for one (unless -N, --no-search is set). Otherwise, if the SAKE_PATH\nenvironment variable is defined it searches those path(s) (unless -G, --no-system is\nset).\n\nIf specified, or found through normal searching (not in SAKE_PATH(s)), sake changes the\nprocess' current working directory to the directory of the found Sakefile (unless -C,\n--no-chdir is set), otherwise it stays where it was run from.\n\nSake then invokes the specified TASKNAME, or the \"default\" one.\n\nSakefile can be one of \"Sakefile\", or \"sakefile\", with an optional extension of \".js\",\nor \".coffee\".\n~~~\n\n### Dependencies ###\n\nThese are installed when **sake** is installed.\n\n~~~\nnomnom:   >=1.5.x\nasync:    >=0.1.x\nresolve:  >=0.2.x\nproteus:  >=0.0.x\nwordwrap: >=0.0.2\n~~~\n\n\n### Development Dependencies ###\n\nInstalled when you run `npm link` in the package directory.\n\n~~~\nmocha:      >=0.3.x\nshould:     >=0.5.x\nunderscore: >=1.3.x\n~~~\n\n\nSakefile Usage\n--------------\n\nWithin a `Sakefile`, Saké's methods are exported to the global scope, so you can invoke them directly:\n\n~~~js\ntask(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n~~~\n    \nWithin another node module you can `require(\"sake\")` and access the methods on the exported object, or even run a block of code in the **saké** context (virtual machine):\n\n~~~js\nvar sake = require(\"sake\");\n    \nsake.task(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n\n// The function passed to sake#run is compiled and run in the sake context.\n// The function **will not** have access to any variables in this scope,\n// nor, will variables leak from the function's scope into this one.\nsake.run(function () {\n    var jsFiles = new FileList(\"src/js/**/*.js\");\n    \n    require(\"sake/clean\");\n    \n    task(\"script-min.js\", jsFiles, function (t) {\n        var cmd = \"infuse \" + jsFiles.map(function (path) {\n                return \"-i \" + path;\n            }) + \" -E\";\n            \n        sh(cmd, function (err, result) {\n            write(t.name, result, \"utf8\");\n            t.done();\n        })\n    });\n    \n    CLEAN.include(\"script-min.js\");\n});\n~~~\n\nThe remainder of this documentation will assume that we are calling the methods from within a `Sakefile`.\n\n\nDefining Tasks\n--------------\n\nThe various task methods take the following arguments:\n\n1.   `taskname`: `string` &mdash; naming the task\n2.   `prerequisites`: _optional_ \n    *   an `array` of:\n        *   `string` task name, or\n        *   a `FileLists`, or \n        *   a `function` that returns one of the above.\n    *   or, you can also pass a `FileList` in directly for `prerequisites`.\n3.   `action`: an _optional_ `function` that will be called when the task is invoked. It will be passed the task instance as its first argument, followed by any arguments that it was invoked with (either from the command-line, or through code). Task arguments can also be accessed through the instance's `arguments` property. i.e: `t.arguments`.\n\nAll task methods return the task *instance*.\n\nIf a task is already defined, it will be augmented by the additional arguments. So, this:\n\n~~~js\ntask(\"one\", [\"othertask\"], function (t) {\n    // do action one...\n    t.done();\n});\n\ntask(\"one\", function (t) {\n    // do action two...\n    t.done();\n});\n\ntask(\"othertask\");\n~~~\n\nWould result in a task \"othertask\" with no prerequisites, and no action, and a task \"one\" with \"othertask\" as a prerequisite and the two functions as its actions.\n\n**Note** how the dependent task was defined *after* it was required as a prerequisite. Task prerequisites are not resolved until the task is invoked. This leads to flexibility in how to compose your tasks and prerequisite tasks.\n\n\n### Task Instance Properties and Methods ###\n\n*   `name {string}` &mdash; the name of the task.\n*   `namespace {string}` &mdash; the task's namespace.\n*   `type {string}` &mdash; one of \"task\", \"file-task\", or \"file-create-task\"\n*   `fqn {string}` &mdash; the fully qualified name of the task. i.e: \"namespace:name\".\n*   `prerequisites {array}` &mdash; the list of prerequisite names for the task.\n*   `isNeeded {boolean}` &mdash; whether or not this task needs to run.\n*   `timestamp {boolean}` &mdash; the last modification time for the task.\n*   `invoke([args ...]) {Task}` &mdash; invoke the task passing args to each action for the task. Will run any prerequisites first. Returns the task instance.\n*   `execute([args ...]) {Task}` &mdash; Like `invoke`, but run the task even if it has already been run, or is not needed.\n*   `done()` &mdash; signal that the current task's action is done running.\n*   `abort([msg], [exitCode])` &mdash; abort the currently running task's actions, if _exitCode_ is specified **saké** will exit with that exit code and no other tasks will be processed. Otherwise, task processing will continue as normal.\n\n\n### Task Static Properties and Methods ###\n\n*   `namespace {string}` &mdash; the current namespace.\n*   `invoke(name, [rest ...]) {Task}` &mdash; invoke the named task and pass it the rest of the arguments.\n*   `get(name, [namespace]) {Task}` &mdash; get the task _name_, optionally start looking in _namespace_. Will throw an error if it can not find a task.\n*   `lookup(name, [namespace]) {Task|null}` &mdash; lookup a task with _name_, optionally start looking in _namespace_.\n*   `getAll() {array[Task]}` &mdash; return all defined tasks.\n*   `has(name, [namespace]) {boolean}` &mdash; does the task _name_ exist?\n*   `find(args, sortFn) {array[Task]}` &mdash; search for a task. _args_ can be an object with keys specifying which properties to match on, and their values denoting the value to match. _args_ can also be a function that accepts a task and returns a boolean whether or not that task matches.\n\n\nFile Tasks\n----------\n\nFile tasks are created with the (appropriately named) `file` method. File tasks, however, are only triggered if the file doesn't exist, or the modification time of any of its prerequisites is newer than itself.\n\n~~~js\nfile(\"path/to/some/file\", function (t) {\n    cp(\"other/path\", t.name);\n    t.done();\n});\n~~~\n\nThe above task would only be triggered if `path/to/some/file` did not exist.\n\nThe following:\n\n~~~js\nfile(\"combined/file/path\", [\"pathA\", \"pathB\", \"pathC\"], function (t) {\n    write(t.name, cat(t.prerequisites), \"utf8\");\n    t.done();\n});\n~~~\n\nwould be triggered if `path/to/some/file` did not exist, or its modification time was earlier than any of its prerequisites (`pathA`, `pathB`, or  `pathC`).\n\n\nDirectory Tasks\n---------------\n\nDirectory tasks, created with the `directory` method, are tasks that will only be called if they do not exist. A task will be created for the named directory (and for all directories along the way) with the action of creating the directory.\n\nDirectory tasks do not take any `prerequisites` or an `action` when first defined, however, they may be augmented with such after they are created:\n\n~~~js\ndirectory(\"dir/path/to/create\");\n\ntask(\"dir/path/to/create\", [\"othertask\"], action (t) {\n    //... do stuff\n    t.done();\n});\n~~~\n\n\nFile Create Tasks\n-----------------\n\nA file create task is a file task, that when used as a prerequisite, will be needed if, and only if, the file has not been created. Once created, it is not re-triggered if any of its prerequisites are newer, nor does it trigger any rebuilds of tasks that depend on it whenever the file is updated.\n\n~~~js\nfileCreate(\"file/path/to/create.ext\", [\"pathA\", \"pathB\"], function (t) {\n    // create file...\n    t.done();\n});\n~~~\n\n\n(A)Synchronicity and Tasks\n--------------------------\n\nIn **saké** all task actions are assumed to be *asynchronous* and an action must call its task's `done` method to tell **saké** that it is done processing stuff.\n\n~~~js\ntask(\"long task\", function (t) {\n    sh(\"some long running shell command\", function (err, result) {\n        // do stuff...\n        t.done();\n    });\n});\n~~~\n\nAlternatively, you can use the `Sync` version of a task to add a *synchronous* action, and `done` will be called for you after the function completes.\n\n~~~js\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n~~~\n\nThere are `Sync` versions of all the core tasks: `taskSync`, `fileSync`, and `fileCreateSync`. Thre are also `Async` versions of each task: `taskAsync`, `fileAsync`, and `fileCreateAsync`. The actions created for a `directory` task are *synchronous*. You can add *asynchronous* task actions after the initial definition.\n\nThirdly, you can specify that all of the core task creation functions generate *synchronous* actions by setting **saké's** \"sync\" option to `true`, or by use of the command-line option `-S, --sync`.\n\n~~~js\nsake.options.sync = true;\n\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n\n//... define more synchronous tasks\n\n//... and then revert to async\nsake.options.sync = false;\n~~~\n\nUltimately, it is up to the **saké** script author to correctly designate a task action as *synchronous* or *asynchronous*. Nothing prevents the running of an *asynchronous* function within a task's *synchronous* action. If nothing is dependent on the result of that action, then no problem would occur. It's when other tasks rely on the completion of certain *asynchronous* actions, that problems may arise.\n\nIn the case of *asynchronous* actions, **Saké** will issue a `WARNING` when it can not detect a `done()` call within that action.\n\n\nNamespaces\n----------\n\n**Saké** supports simple name spacing of tasks. Simply prepend the namespace before the task name with a colon \":\". This can be done when defining a task, or in the list of prerequisites for a task.\n\n~~~js\n// Defines a task 'fuz' in the namespace 'foo' that depends on the task 'buz'\n// in the namespace 'baz'\ntask(\"foo:fuz\", [\"baz:buz\"], function (t) {\n    //...\n    t.done();\n});\n~~~\n\nThen invoke the task as so:\n\n~~~\n% sake foo:fuz\n~~~\n\nYou can also use the convenience function `namespace` to wrap your task definitions for a particular namespace. Any _namespace naked_ definitions will first be tried in the local namespace, otherwise they will fall-back to the default namespace:\n\n~~~js\n\ntask(\"default\", function (t) {\n    //...\n    t.done():\n});\n\ntask(\"bazil\", function (t) {\n    //...\n    t.done():\n});\n\n// define within the 'foo' namespace\nnamespace(\"foo\", function () {\n    \n    // defines 'foo:foom' task\n    task(\"foom\", function (t) {\n        //...\n        t.done():\n    });\n    \n});\n\nnamespace(\"baz\", function () {\n    \n    // this task is defined in the 'baz' namespace, and depends on the\n    // 'foom' task from the 'foo' namespace\n    task(\"bazil\", [\"foo:foom\"], function (t) {\n        //...\n        t.done():\n    });\n    // This task is also defined in the 'baz' namespace. It depends on \n    // the 'bazil' task, which is also defined in 'baz' namespace. It\n    // also depends on the 'default' task in the 'default' (top-level)\n    // namespace.\n    task(\"buzil\", [\"bazil\", \"default\"], function (t), {\n        //...\n        t.done():\n    });\n    // If 'bazil' wasn't defined in the 'baz' namespace, it would resolve\n    // to the 'default' namespace task.\n});\n~~~\n\n**Note:** prerequisite names are tied to the defined task's namespace. i.e: If a task \"foo:fuz\" depends on \"foom\" **saké** will look in the \"foo\" namespace for \"foom\", and then the \"default\" namespace.\n\n**Note:** although the `namespace` functions can be nested, **saké** does not track the hierarchy of `namespace` calls -- if a dependent task is not found in the current task's namespace, it will look for it in the default namespace.\n\n\nPassing Arguments to A Task\n---------------------------\n\nThere are two ways to pass arguments to a task.\n\nFirst, **saké** translates any arguments in the form of `ENV=VALUE` on the command-line into `process.env` values:\n\n~~~\n% sake build BUILD_TYPE=debug ENVIRONMENT=prod\n~~~\n\nWill set `process.env.BUILD_TYPE` to \"debug\" and `process.env.ENVIRONMENT` to \"prod\". The values are JSON parsed; so the values are translated into real JavaScript values (numbers, true, false, etc...).\n\nSecondly, **saké** passes all non-option, and non-ENV=VALUE, looking arguments from the command-line to the invoked task:\n\n~~~\n% sake foo 3.14 pie true\n~~~\n\nWill invoke the \"foo\" task and pass to each of foo's actions (after the task instance itself) `3.14`, \"pie\" and `true`. The arguments are also JSON parsed to get real JavaScript values.\n\n~~~js\ntask(\"foo\", function (t, amt, word, flag) {\n    log(amt);   // => 3.14\n    log(word);  // => \"pie\"\n    log(flag);  // => true\n});\n~~~\n\n**Note:** This differs from how **rake**, and **jake** do things. In **saké** you can only invoke one task on the command-line. All other arguments on the command-line are considered task arguments.\n\n\nIncluding Other Saké Files\n-------------------------------------\n\nYou can include other **saké** files with the `include` and `load` methods. The included files will be run in the **saké** context, so any variables they do not declare with the `var` keyword will be set on the global **saké** context. This allows you to break your project build files up into discreet files.\n\nAll `require` and `include`, or `load` statements, are resolved relative to the current file, so you can create your own hierarchy of build dependencies.\n\nYou can also add your own paths to the list of ones that **saké** uses to resolve `requires`: `[sake.]includePaths` is an array of directory paths to search. They are tried in reverse order, so if you push a path on to the array that path will be tried first, followed by any others.\n\n~~~js\n// in a Sakefile\nincludePaths.push(\"some/file/path\");\n\nrequire(\"some-module\"); // will be tried in some/file/path/some-module.js\n~~~\n\nAlso, the `__dirname` and `__filename` properties are available in `included` files to help resolve local includes.\n\n~~~js\nvar Path = require(\"path\");\n\ninclude(Path.join(__dirname, \"include-dir/include-file\"));\n~~~\n\nSake Library\n------------\n\n**Saké** will load any `.sake`, `.sake.js`, or `.sake.coffee` files located in a `sakelib` directory relative to the `Sakefile` being run. This directory name can be modified with the `-l, --sakelib` option, and multiple directories can be specified. This allows you to re-use common tasks across multiple projects.\n\n\nFile Lists\n----------\n\nFileLists are lists of file paths.\n\n~~~js\nnew FileList(\"*.scss\");\n~~~\n\nWould contain all the file paths with a \".scss\" extension in the top-level directory of your project.\n\nYou can use FileLists pretty much like an `Array`. You can iterate them (with `forEach, filter, reduce`, etc...), `concat` them, `splice` them, and you get back a new FileList object.\n\nTo add files, or glob patterns to them, use the `#include` method:\n\n~~~js\nvar fl = new FileList(\"*.scss\");\nfl.include(\"core.css\", \"reset.css\", \"*.css\");\n~~~\n\nYou can also `exlucude` files by Glob pattern, `Regular Expression` pattern, or by use of a `function` that takes the file path as an argument and returns a `truthy` value to exclude a file.\n\n~~~js\n// Exclude by RegExp\nfl.exclude(/^dev-.*\\.css/);\n\n// Exclude by Glob pattern\nfl.exclude(\"dev-*.css\");\n\n// Exclude by function\nfl.exclude(function (path) {\n    return FS.statSync(path).mtime.getTime() < (Date.now() - 60 * 60 * 1000);\n});\n~~~\n\nTo get to the actual items of the FileList, use the `#items` property, or the `#toArray` method, to get a plain array back. You can also use the `#get` or `#set` methods to retrieve or set an item.\n\nFileLists are *lazy*, in that the actual file paths are not determined from the include and exclude patterns until the individual items are requested. This allows you to define a FileList and incrementally add patterns to it in the Sakefile file. The FileList paths will not be resolved until the task that uses it as a prerequisite actually asks for the final paths.\n\n\n### FileList Properties & Methods ###\n\n*   `existing` &mdash; will return a new `FileList` with all of the files that actually exist.\n*   `notExisting` &mdash; will return a new `FileList` of all the files that do not exist.\n*   `extension(ext)` &mdash; returns a new `FileList` with all paths that match the given extension.\n\n~~~js\nfl.extension(\".scss\").forEach(function (path) {\n    //...\n});\n~~~\n\n*   `grep(pattern)` &mdash; get a `FileList` of all the files that match the given `pattern`. `pattern` can be a plain `String`, a `Glob` pattern, a `RegExp`, or a `function` that receives each path and can return a truthy value to include it.\n*   `clearExcludes()` &mdash; clear all exclude patterns/functions.\n*   `clearIncludes()` &mdash; clear all include patterns.\n\nBy default, a `FileList` excludes directories. To allow directories call `FileList#clearExcludes()` before requesting any items.\n\n\nThe \"clean\" and \"clobber\" Tasks, and The CLEAN and CLOBBER FileLists\n--------------------------------------------------------------------\n\nWithin a `Sakefile`:\n\n~~~js\n// defines the CLEAN FileList and 'clean' task\nrequire(\"sake/clean\");\n\n// defines the above, and also the CLOBBER FileTask and 'clobber' task\nrequire(\"sake/clobber\");\n~~~\n\nWhen the \"clean\" task is run, it will remove any files that have been included in the `CLEAN FileList`. \"clobber\" will remove any file, or directory, included in the `CLOBBER FileList`.\n\n\nSaké Utility Functions\n----------------------\n\nSaké defines a few utility functions to make life a little easier in an asynchronous world. Most of these are just wrappers for `node`'s File System (`require(\"fs\")`) utility methods.\n\n### Synchronous Utilities ###\n\n*   `mkdir(dirpath, mode=\"777\")` &mdash; create the `dirpath` directory, if it doesn't already exist.\n*   `mkdir_p(dirpath, mode=\"777\"])` &mdash; as above, but create all intermediate directories as needed.\n*   `rm(path, [path1, ..., pathN])` &mdash; remove one or more paths from the file system.\n*   `rm_rf(path, [path1, ..., pathN])` &mdash; as above, and remove directories and their contents.\n*   `cp(from, to)` &mdash; copy a file from `from` path to `to` path.\n*   `cp_r(from, to)` &mdash; copy all files from `from` path to `to` path.\n*   `mv(from, to)` &mdash; move a file from `from` path to `to` path.\n*   `ln(from, to)` &mdash; create a hard link from `from` path to `to` path.\n*   `ln_s(from, to)` &mdash; create a symlink from `from` path to `to` path.\n*   `cat(path, [path1, ..., pathN]) {string}` &mdash; read all supplied paths and return their contents as a string. If an argument is an `Array` it will be expanded and those paths will be read.\n*   `readdir(path) {array[string]}` &mdash; returns the files of directory `path`.\n*   `read(path, [enc]) {string|Buffer}` &mdash; read the supplied file path. Returns a `buffer`, or a `string` if `enc` is given.\n*   `write(path, data, [enc], mode=\"w\")` &mdash; write the `data` to the supplied file `path`. `data` should be a `buffer` or a `string` if `enc` is given. `mode` is a `string` of either \"w\", for over write,  or \"a\" for append.\n*   `slurp(path, [env]) {sring|Buffer}` &mdash; alias for `read`\n*   `spit(path, data, [enc], mode=\"w\")` &mdash; alias for `write`\n\n\n### Asynchronous Utilities ###\n\n*   `sh(cmd, fn(error, result))` &mdash; execute shell `cmd`. In the callback function, `error` will be a truthy value if there was an error, and `result` will contain the STDERR returned from `cmd`. Otherwise, `result` will contain the STDOUT from the `cmd`. If `cmd` is an array of shell commands, each one will be run before the next, and only when they all complete, or an error is encountered, will the callback `fn` be called, and `result` be an array of the individual commands.\n\n\nReport an Issue\n---------------\n\n* [Bugs](http://github.com/jhamlet/node-sake/issues)\n* Contact the author: <jhamlet@hamletink.com>\n\n\nLicense\n-------\n\n> Copyright (c) 2012 Jerry Hamlet <jerry@hamletink.com>\n> \n> Permission is hereby granted, free of charge, to any person\n> obtaining a copy of this software and associated documentation\n> files (the \"Software\"), to deal in the Software without\n> restriction, including without limitation the rights to use,\n> copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the\n> Software is furnished to do so, subject to the following\n> conditions:\n> \n> The above copyright notice and this permission notice shall be\n> included in all copies or substantial portions of the Software.\n> \n> The Software shall be used for Good, not Evil.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n> OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n> HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n> WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n> FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n> OTHER DEALINGS IN THE SOFTWARE.\n\n","maintainers":[{"name":"jhamlet","email":"jerry@hamletink.com"}]},"0.1.16":{"name":"sake","description":"[S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.","version":"0.1.16","keywords":["build","make","rake","jake"],"main":"./lib/node_modules/sake/index.js","bin":{"sake":"./bin/sake"},"directories":{"lib":"lib"},"dependencies":{"nomnom":">=1.5.x","async":">=0.1.x","resolve":">=0.2.x","proteus":">=0.0.x","wordwrap":">=0.0.2","glob":">=2.1.x"},"devDependencies":{"mocha":">=0.3.x","should":">=0.5.x","underscore":">=1.3.x"},"scripts":{"test":"mocha test/test-*"},"licenses":[{"type":"MIT","url":"http://github.com/jhamlet/node-sake/raw/master/LICENSE"}],"repository":{"type":"git","url":"git://github.com/jhamlet/node-sake.git"},"bugs":{"url":"http://github.com/jhamlet/node-sake/issues"},"preferGlobal":true,"_npmUser":{"name":"jhamlet","email":"jerry@hamletink.com"},"_id":"sake@0.1.16","contributors":[{"name":"Jerry Hamlet","email":"jerry@hamletink.com"}],"optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.12","_nodeVersion":"v0.6.10","_defaultsLoaded":true,"dist":{"shasum":"37af6e617f492b4ddbcd270853e4ad78ca00f4b8","tarball":"https://registry.npmjs.org/sake/-/sake-0.1.16.tgz","integrity":"sha512-SEPdgsKJaNZ+MACoLniEJ3Ef2eZzePRQCQ6mj3u9om/fvVuWRgywWNjf9uqk5OdMHXef9zodN8pprvpzat9nuA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICbA/V4kA1fo/xer3bAgZPwMICDqlWQXsALsu76nKTmGAiAUuKseut5iPn1BFjHZHLJytorioVnXnho6dhDVri305Q=="}]},"readme":"\nSaké\n====\n\n> [S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.\n\n\nOverview\n--------\n\nThis package contains **saké**, a JavaScript build program that runs in node with capabilities similar to ruby's Rake.\n\nSaké has the following features:\n\n1.  `Sakefiles` (**saké’s** version of Rakefiles) are completely defined in standard JavaScript (or CoffeeScript, for those who want an even more Rake-like feel).\n2.  Flexible `FileLists` that act like arrays but know about manipulating file names and paths.\n3.  `clean` and `clobber` tasks are available for tidying up.\n4.  _Asynchronous_ task handling, with easy options for specifying _synchronous_ tasks.\n5.  Simple _namespacing_ of tasks to break projects into discreet parts.\n5.  Many utility methods for handling common build tasks (rm, rm_rf, mkdir, mkdir_p, sh, cat, etc...)\n\n\nInstallation\n------------\n\n### Install with npm\n\nDownload and install with the following:\n\n~~~\nnpm install -g sake\n~~~\n\nCommand-Line Usage\n------------------\n\n~~~\n% sake -h\n\nusage: sake [TASKNAME] [ARGUMENTS ...] [ENV=VALUE ...] [options]\n\n[TASKNAME]     Name of the task to run. Defaults to 'default'.\n[ARGUMENTS ...]     Zero or more arguments to pass to the task invoked.\n[ENV=VALUE ...]     Zero or more arguments to translate into environment variables.\n\noptions:\n   -f, --sakefile PATH       PATH to Sakefile to run instead of searching for one.\n   -T, --tasks [PATTERN]     List tasks with descriptions (optionally, just those\n                             matching PATTERN) and exit.\n   -P, --prereqs [PATTERN]   List tasks and their prerequisites (optionally, just\n                             those matching PATTERN) and exit.\n   -r, --require MODULE      Require MODULE before executing Sakefile and expose the\n                             MODULE under a sanitized namespace (i.e.: coffee-script\n                             => [sake.]coffeeScript). Can be specified multiple\n                             times.\n   -l, --sakelib PATH        Auto-include any .sake[.js|.coffeee] files in PATH.\n                             (default is 'sakelib'.) Can be specified multiple times\n   -n, --dry-run             Do a dry run without executing actions.\n   -C, --no-chdir            Do not change directory to the Sakefile location.\n   -N, --no-search           Do not search parent directories for a Sakefile.\n   -G, --no-system           Do not use SAKE_PATH environment variable to search for\n                             a Sakefile.\n   -S, --sync                Make all standard tasks 'synchronous' by default.\n   -d, --debug               Enable additional debugging output.\n   -q, --quiet               Suppress informational messages.\n   -V, --version             Print the version of sake and exit.\n   -h, --help                Print this help information and exit.\n\nIf a Sakefile is not specified, sake searches the current directory, and all parent\ndirectories, for one (unless -N, --no-search is set). Otherwise, if the SAKE_PATH\nenvironment variable is defined it searches those path(s) (unless -G, --no-system is\nset).\n\nIf specified, or found through normal searching (not in SAKE_PATH(s)), sake changes the\nprocess' current working directory to the directory of the found Sakefile (unless -C,\n--no-chdir is set), otherwise it stays where it was run from.\n\nSake then invokes the specified TASKNAME, or the \"default\" one.\n\nSakefile can be one of \"Sakefile\", or \"sakefile\", with an optional extension of \".js\",\nor \".coffee\".\n~~~\n\n### Dependencies ###\n\nThese are installed when **sake** is installed.\n\n~~~\nnomnom:   >=1.5.x\nasync:    >=0.1.x\nresolve:  >=0.2.x\nproteus:  >=0.0.x\nwordwrap: >=0.0.2\n~~~\n\n\n### Development Dependencies ###\n\nInstalled when you run `npm link` in the package directory.\n\n~~~\nmocha:      >=0.3.x\nshould:     >=0.5.x\nunderscore: >=1.3.x\n~~~\n\n\nSakefile Usage\n--------------\n\nWithin a `Sakefile`, Saké's methods are exported to the global scope, so you can invoke them directly:\n\n~~~js\ntask(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n~~~\n    \nWithin another node module you can `require(\"sake\")` and access the methods on the exported object, or even run a block of code in the **saké** context (virtual machine):\n\n~~~js\nvar sake = require(\"sake\");\n    \nsake.task(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n\n// The function passed to sake#run is compiled and run in the sake context.\n// The function **will not** have access to any variables in this scope,\n// nor, will variables leak from the function's scope into this one.\nsake.run(function () {\n    var jsFiles = new FileList(\"src/js/**/*.js\");\n    \n    require(\"sake/clean\");\n    \n    task(\"script-min.js\", jsFiles, function (t) {\n        var cmd = \"infuse \" + jsFiles.map(function (path) {\n                return \"-i \" + path;\n            }) + \" -E\";\n            \n        sh(cmd, function (err, result) {\n            write(t.name, result, \"utf8\");\n            t.done();\n        })\n    });\n    \n    CLEAN.include(\"script-min.js\");\n});\n~~~\n\nThe remainder of this documentation will assume that we are calling the methods from within a `Sakefile`.\n\n\nDefining Tasks\n--------------\n\nThe various task methods take the following arguments:\n\n1.   `taskname`: `string` &mdash; naming the task\n2.   `prerequisites`: _optional_ \n    *   an `array` of:\n        *   `string` task name, or\n        *   a `FileLists`, or \n        *   a `function` that returns one of the above.\n    *   or, you can also pass a `FileList` in directly for `prerequisites`.\n3.   `action`: an _optional_ `function` that will be called when the task is invoked. It will be passed the task instance as its first argument, followed by any arguments that it was invoked with (either from the command-line, or through code). Task arguments can also be accessed through the instance's `arguments` property. i.e: `t.arguments`.\n\nAll task methods return the task *instance*.\n\nIf a task is already defined, it will be augmented by the additional arguments. So, this:\n\n~~~js\ntask(\"one\", [\"othertask\"], function (t) {\n    // do action one...\n    t.done();\n});\n\ntask(\"one\", function (t) {\n    // do action two...\n    t.done();\n});\n\ntask(\"othertask\");\n~~~\n\nWould result in a task \"othertask\" with no prerequisites, and no action, and a task \"one\" with \"othertask\" as a prerequisite and the two functions as its actions.\n\n**Note** how the dependent task was defined *after* it was required as a prerequisite. Task prerequisites are not resolved until the task is invoked. This leads to flexibility in how to compose your tasks and prerequisite tasks.\n\n\n### Task Instance Properties and Methods ###\n\n*   `name {string}` &mdash; the name of the task.\n*   `namespace {string}` &mdash; the task's namespace.\n*   `type {string}` &mdash; one of \"task\", \"file-task\", or \"file-create-task\"\n*   `fqn {string}` &mdash; the fully qualified name of the task. i.e: \"namespace:name\".\n*   `prerequisites {array}` &mdash; the list of prerequisite names for the task.\n*   `isNeeded {boolean}` &mdash; whether or not this task needs to run.\n*   `timestamp {boolean}` &mdash; the last modification time for the task.\n*   `invoke([args ...]) {Task}` &mdash; invoke the task passing args to each action for the task. Will run any prerequisites first. Returns the task instance.\n*   `execute([args ...]) {Task}` &mdash; Like `invoke`, but run the task even if it has already been run, or is not needed.\n*   `done()` &mdash; signal that the current task's action is done running.\n*   `abort([msg], [exitCode])` &mdash; abort the currently running task's actions, if _exitCode_ is specified **saké** will exit with that exit code and no other tasks will be processed. Otherwise, task processing will continue as normal.\n\n\n### Task Static Properties and Methods ###\n\n*   `namespace {string}` &mdash; the current namespace.\n*   `invoke(name, [rest ...]) {Task}` &mdash; invoke the named task and pass it the rest of the arguments.\n*   `get(name, [namespace]) {Task}` &mdash; get the task _name_, optionally start looking in _namespace_. Will throw an error if it can not find a task.\n*   `lookup(name, [namespace]) {Task|null}` &mdash; lookup a task with _name_, optionally start looking in _namespace_.\n*   `getAll() {array[Task]}` &mdash; return all defined tasks.\n*   `has(name, [namespace]) {boolean}` &mdash; does the task _name_ exist?\n*   `find(args, sortFn) {array[Task]}` &mdash; search for a task. _args_ can be an object with keys specifying which properties to match on, and their values denoting the value to match. _args_ can also be a function that accepts a task and returns a boolean whether or not that task matches.\n\n\nFile Tasks\n----------\n\nFile tasks are created with the (appropriately named) `file` method. File tasks are only triggered if the file doesn't exist, or the modification time of any of its prerequisites is newer than itself.\n\n~~~js\nfile(\"path/to/some/file\", function (t) {\n    cp(\"other/path\", t.name);\n    t.done();\n});\n~~~\n\nThe above task would only be triggered if `path/to/some/file` did not exist.\n\nThe following:\n\n~~~js\nfile(\"combined/file/path\", [\"pathA\", \"pathB\", \"pathC\"], function (t) {\n    write(t.name, cat(t.prerequisites), \"utf8\");\n    t.done();\n});\n~~~\n\nwould be triggered if `path/to/some/file` did not exist, or its modification time was earlier than any of its prerequisites (`pathA`, `pathB`, or  `pathC`).\n\n\nDirectory Tasks\n---------------\n\nDirectory tasks, created with the `directory` method, are tasks that will only be called if they do not exist. A task will be created for the named directory (and for all directories along the way) with the action of creating the directory.\n\nDirectory tasks do not take any `prerequisites` or an `action` when first defined, however, they may be augmented with such after they are created:\n\n~~~js\ndirectory(\"dir/path/to/create\");\n\ntask(\"dir/path/to/create\", [\"othertask\"], action (t) {\n    //... do stuff\n    t.done();\n});\n~~~\n\n\nFile Create Tasks\n-----------------\n\nA file create task is a file task, that when used as a prerequisite, will be needed if, and only if, the file has not been created. Once created, it is not re-triggered if any of its prerequisites are newer, nor does it trigger any rebuilds of tasks that depend on it whenever the file is updated.\n\n~~~js\nfileCreate(\"file/path/to/create.ext\", [\"pathA\", \"pathB\"], function (t) {\n    // create file...\n    t.done();\n});\n~~~\n\n\n(A)Synchronicity and Tasks\n--------------------------\n\nIn **saké** all task actions are assumed to be *asynchronous* and an action must call its task's `done` method to tell **saké** that it is done processing stuff.\n\n~~~js\ntask(\"long task\", function (t) {\n    sh(\"some long running shell command\", function (err, result) {\n        // do stuff...\n        t.done();\n    });\n});\n~~~\n\nAlternatively, you can use the `Sync` version of a task to add a *synchronous* action, and `done` will be called for you after the function completes.\n\n~~~js\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n~~~\n\nThere are `Sync` versions of all the core tasks: `taskSync`, `fileSync`, and `fileCreateSync`. There are also `Async` versions of each task: `taskAsync`, `fileAsync`, and `fileCreateAsync`. The actions created for a `directory` task are *synchronous*. You can add *asynchronous* task actions after the initial definition.\n\nThirdly, you can specify that all of the core task creation functions generate *synchronous* actions by setting **saké's** \"sync\" option to `true`, or by use of the command-line option `-S, --sync`.\n\n~~~js\nsake.options.sync = true;\n\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n\n//... define more synchronous tasks\n\n//... and then revert to async\nsake.options.sync = false;\n~~~\n\nUltimately, it is up to the **saké** script author to correctly designate a task action as *synchronous* or *asynchronous*. Nothing prevents the running of an *asynchronous* function within a task's *synchronous* action. If nothing is dependent on the result of that action, then no problem would occur. It's when other tasks rely on the completion of certain *asynchronous* actions, that problems may arise.\n\nIn the case of *asynchronous* actions, **Saké** will issue a `WARNING` when it can not detect a `done()` call within that action.\n\n\nNamespaces\n----------\n\n**Saké** supports simple name spacing of tasks. Simply prepend the namespace before the task name with a colon \":\". This can be done when defining a task, or in the list of prerequisites for a task.\n\n~~~js\n// Defines a task 'fuz' in the namespace 'foo' that depends on the task 'buz'\n// in the namespace 'baz'\ntask(\"foo:fuz\", [\"baz:buz\"], function (t) {\n    //...\n    t.done();\n});\n~~~\n\nThen invoke the task as so:\n\n~~~\n% sake foo:fuz\n~~~\n\nYou can also use the convenience function `namespace` to wrap your task definitions for a particular namespace. Any _namespace naked_ definitions will first be tried in the local namespace, otherwise they will fall-back to the default namespace:\n\n~~~js\n\ntask(\"default\", function (t) {\n    //...\n    t.done():\n});\n\ntask(\"bazil\", function (t) {\n    //...\n    t.done():\n});\n\n// define within the 'foo' namespace\nnamespace(\"foo\", function () {\n    \n    // defines 'foo:foom' task\n    task(\"foom\", function (t) {\n        //...\n        t.done():\n    });\n    \n});\n\nnamespace(\"baz\", function () {\n    \n    // this task is defined in the 'baz' namespace, and depends on the\n    // 'foom' task from the 'foo' namespace\n    task(\"bazil\", [\"foo:foom\"], function (t) {\n        //...\n        t.done():\n    });\n    // This task is also defined in the 'baz' namespace. It depends on \n    // the 'bazil' task, which is also defined in 'baz' namespace. It\n    // also depends on the 'default' task in the 'default' (top-level)\n    // namespace.\n    task(\"buzil\", [\"bazil\", \"default\"], function (t), {\n        //...\n        t.done():\n    });\n    // If 'bazil' wasn't defined in the 'baz' namespace, it would resolve\n    // to the 'default' namespace task.\n});\n~~~\n\n**Note:** prerequisite names are tied to the defined task's namespace. i.e: If a task \"foo:fuz\" depends on \"foom\" **saké** will look in the \"foo\" namespace for \"foom\", and then the \"default\" namespace.\n\n**Note:** although the `namespace` functions can be nested, **saké** does not track the hierarchy of `namespace` calls -- if a dependent task is not found in the current task's namespace, it will look for it in the default namespace.\n\n\nPassing Arguments to A Task\n---------------------------\n\nThere are two ways to pass arguments to a task.\n\nFirst, **saké** translates any arguments in the form of `ENV=VALUE` on the command-line into `process.env` values:\n\n~~~\n% sake build BUILD_TYPE=debug ENVIRONMENT=prod\n~~~\n\nWill set `process.env.BUILD_TYPE` to \"debug\" and `process.env.ENVIRONMENT` to \"prod\". The values are JSON parsed; so the values are translated into real JavaScript values (numbers, true, false, etc...).\n\nSecondly, **saké** passes all non-option, and non-ENV=VALUE, looking arguments from the command-line to the invoked task:\n\n~~~\n% sake foo 3.14 pie true\n~~~\n\nWill invoke the \"foo\" task and pass to each of foo's actions (after the task instance itself) `3.14`, \"pie\" and `true`. The arguments are also JSON parsed to get real JavaScript values.\n\n~~~js\ntask(\"foo\", function (t, amt, word, flag) {\n    log(amt);   // => 3.14\n    log(word);  // => \"pie\"\n    log(flag);  // => true\n});\n~~~\n\n**Note:** This differs from how **rake**, and **jake** do things. In **saké** you can only invoke one task on the command-line. All other arguments on the command-line are considered task arguments.\n\n\nIncluding Other Saké Files\n-------------------------------------\n\nYou can include other **saké** files with the `include` and `load` methods. The included files will be run in the **saké** context, so any variables they do not declare with the `var` keyword will be set on the global **saké** context. This allows you to break your project build files up into discreet files.\n\nAll `require` and `include`, or `load` statements, are resolved relative to the current file, so you can create your own hierarchy of build dependencies.\n\nYou can also add your own paths to the list of ones that **saké** uses to resolve `requires`: `[sake.]includePaths` is an array of directory paths to search. They are tried in reverse order, so if you push a path on to the array that path will be tried first, followed by any others.\n\n~~~js\n// in a Sakefile\nincludePaths.push(\"some/path\");\n\nrequire(\"some-module\"); // will be tried in some/path/some-module.js\n~~~\n\nAlso, the `__dirname` and `__filename` properties are available in `included` files to help resolve local includes.\n\n~~~js\nvar Path = require(\"path\");\n\ninclude(Path.join(__dirname, \"include-dir/include-file\"));\n~~~\n\nSake Library\n------------\n\n**Saké** will load any `.sake`, `.sake.js`, or `.sake.coffee` files located in a `sakelib` directory relative to the `Sakefile` being run. This directory name can be modified with the `-l, --sakelib` option, and multiple directories can be specified. This allows you to re-use common tasks across multiple projects.\n\n\nFile Lists\n----------\n\nFileLists are lists of file paths.\n\n~~~js\nnew FileList(\"*.scss\");\n~~~\n\nWould contain all the file paths with a \".scss\" extension in the top-level directory of your project.\n\nYou can use FileLists pretty much like an `Array`. You can iterate them (with `forEach, filter, reduce`, etc...), `concat` them, `splice` them, and you get back a new FileList object.\n\nTo add files, or glob patterns to them, use the `#include` method:\n\n~~~js\nvar fl = new FileList(\"*.scss\");\nfl.include(\"core.css\", \"reset.css\", \"*.css\");\n~~~\n\nYou can also `exlucude` files by Glob pattern, `Regular Expression` pattern, or by use of a `function` that takes the file path as an argument and returns a `truthy` value to exclude a file.\n\n~~~js\n// Exclude by RegExp\nfl.exclude(/^dev-.*\\.css/);\n\n// Exclude by Glob pattern\nfl.exclude(\"dev-*.css\");\n\n// Exclude by function\nfl.exclude(function (path) {\n    return FS.statSync(path).mtime.getTime() < (Date.now() - 60 * 60 * 1000);\n});\n~~~\n\nTo get to the actual items of the FileList, use the `#items` property, or the `#toArray` method, to get a plain array back. You can also use the `#get` or `#set` methods to retrieve or set an item.\n\nFileLists are *lazy*, in that the actual file paths are not determined from the include and exclude patterns until the individual items are requested. This allows you to define a FileList and incrementally add patterns to it in the Sakefile file. The FileList paths will not be resolved until the task that uses it as a prerequisite actually asks for the final paths.\n\n\n### FileList Properties & Methods ###\n\n*   `existing` &mdash; will return a new `FileList` with all of the files that actually exist.\n*   `notExisting` &mdash; will return a new `FileList` of all the files that do not exist.\n*   `extension(ext)` &mdash; returns a new `FileList` with all paths that match the given extension.\n\n~~~js\nfl.extension(\".scss\").forEach(function (path) {\n    //...\n});\n~~~\n\n*   `grep(pattern)` &mdash; get a `FileList` of all the files that match the given `pattern`. `pattern` can be a plain `String`, a `Glob` pattern, a `RegExp`, or a `function` that receives each path and can return a truthy value to include it.\n*   `clearExcludes()` &mdash; clear all exclude patterns/functions.\n*   `clearIncludes()` &mdash; clear all include patterns.\n\nBy default, a `FileList` excludes directories. To allow directories call `FileList#clearExcludes()` before requesting any items.\n\n\nThe \"clean\" and \"clobber\" Tasks, and The CLEAN and CLOBBER FileLists\n--------------------------------------------------------------------\n\nWithin a `Sakefile`:\n\n~~~js\n// defines the CLEAN FileList and 'clean' task\nrequire(\"sake/clean\");\n\n// defines the above, and also the CLOBBER FileTask and 'clobber' task\nrequire(\"sake/clobber\");\n~~~\n\nWhen the \"clean\" task is run, it will remove any files that have been included in the `CLEAN FileList`. \"clobber\" will remove any file, or directory, included in the `CLOBBER FileList`.\n\n\nSaké Utility Functions\n----------------------\n\nSaké defines a few utility functions to make life a little easier in an asynchronous world. Most of these are just wrappers for `node`'s File System (`require(\"fs\")`) utility methods.\n\n### Synchronous Utilities ###\n\n*   `mkdir(dirpath, mode=\"777\")` &mdash; create the `dirpath` directory, if it doesn't already exist.\n*   `mkdir_p(dirpath, mode=\"777\"])` &mdash; as above, but create all intermediate directories as needed.\n*   `rm(path, [path1, ..., pathN])` &mdash; remove one or more paths from the file system.\n*   `rm_rf(path, [path1, ..., pathN])` &mdash; as above, and remove directories and their contents.\n*   `cp(from, to)` &mdash; copy a file from `from` path to `to` path.\n*   `cp_r(from, to)` &mdash; copy all files from `from` path to `to` path.\n*   `mv(from, to)` &mdash; move a file from `from` path to `to` path.\n*   `ln(from, to)` &mdash; create a hard link from `from` path to `to` path.\n*   `ln_s(from, to)` &mdash; create a symlink from `from` path to `to` path.\n*   `cat(path, [path1, ..., pathN]) {string}` &mdash; read all supplied paths and return their contents as a string. If an argument is an `Array` it will be expanded and those paths will be read.\n*   `readdir(path) {array[string]}` &mdash; returns the files of directory `path`.\n*   `read(path, [enc]) {string|Buffer}` &mdash; read the supplied file path. Returns a `buffer`, or a `string` if `enc` is given.\n*   `write(path, data, [enc], mode=\"w\")` &mdash; write the `data` to the supplied file `path`. `data` should be a `buffer` or a `string` if `enc` is given. `mode` is a `string` of either \"w\", for over write,  or \"a\" for append.\n*   `slurp(path, [env]) {sring|Buffer}` &mdash; alias for `read`\n*   `spit(path, data, [enc], mode=\"w\")` &mdash; alias for `write`\n\n\n### Asynchronous Utilities ###\n\n*   `sh(cmd, fn(error, result))` &mdash; execute shell `cmd`. In the callback function, `error` will be a truthy value if there was an error, and `result` will contain the STDERR returned from `cmd`. Otherwise, `result` will contain the STDOUT from the `cmd`. If `cmd` is an array of shell commands, each one will be run before the next, and only when they all complete, or an error is encountered, will the callback `fn` be called, and `result` be an array of the results of the individual commands.\n\n\nReport an Issue\n---------------\n\n* [Bugs](http://github.com/jhamlet/node-sake/issues)\n* Contact the author: <jhamlet@hamletink.com>\n\n\nLicense\n-------\n\n> Copyright (c) 2012 Jerry Hamlet <jerry@hamletink.com>\n> \n> Permission is hereby granted, free of charge, to any person\n> obtaining a copy of this software and associated documentation\n> files (the \"Software\"), to deal in the Software without\n> restriction, including without limitation the rights to use,\n> copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the\n> Software is furnished to do so, subject to the following\n> conditions:\n> \n> The above copyright notice and this permission notice shall be\n> included in all copies or substantial portions of the Software.\n> \n> The Software shall be used for Good, not Evil.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n> OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n> HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n> WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n> FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n> OTHER DEALINGS IN THE SOFTWARE.\n\n","maintainers":[{"name":"jhamlet","email":"jerry@hamletink.com"}]},"0.1.17":{"name":"sake","description":"[S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.","version":"0.1.17","keywords":["build","make","rake","jake"],"main":"./lib/node_modules/sake/index.js","bin":{"sake":"./bin/sake"},"directories":{"lib":"./lib"},"dependencies":{"nomnom":">=1.5.x","async":">=0.1.x","resolve":">=0.2.x","proteus":">=0.0.x","wordwrap":">=0.0.2","glob":">=2.1.x"},"devDependencies":{"mocha":">=0.3.x","should":">=0.5.x","underscore":">=1.3.x"},"scripts":{"test":"mocha test/test-*"},"licenses":[{"type":"MIT","url":"http://github.com/jhamlet/node-sake/raw/master/LICENSE"}],"repository":{"type":"git","url":"git://github.com/jhamlet/node-sake.git"},"bugs":{"url":"http://github.com/jhamlet/node-sake/issues"},"preferGlobal":true,"_npmUser":{"name":"jhamlet","email":"jerry@hamletink.com"},"_id":"sake@0.1.17","contributors":[{"name":"Jerry Hamlet","email":"jerry@hamletink.com"}],"optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.12","_nodeVersion":"v0.6.10","_defaultsLoaded":true,"dist":{"shasum":"8bb72a08d18e6e09baf8bf33899b0032c72f4c2a","tarball":"https://registry.npmjs.org/sake/-/sake-0.1.17.tgz","integrity":"sha512-7A0Wwud3TBZwYo6NkGCru1j/e+klKgDLEHzum6WPm4lCzy6ENfdt5QN/+kWWJfFx1ZJC0Re4XOmBnbmo4xJ7Rg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDtM24RcatZUVZeZ3UTcywL++DjJUuIqBcpz3sxidY7iAIgMpHUGZIbDD0BYoZDFsCwyRZb+je6qXGQM42w2+q5eA8="}]},"readme":"\nSaké\n====\n\n> [S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.\n\n\nOverview\n--------\n\nThis package contains **saké**, a JavaScript build program that runs in node with capabilities similar to ruby's Rake.\n\nSaké has the following features:\n\n1.  `Sakefiles` (**saké’s** version of Rakefiles) are completely defined in standard JavaScript (or CoffeeScript, for those who want an even more Rake-like feel).\n2.  Flexible `FileLists` that act like arrays but know about manipulating file names and paths.\n3.  `clean` and `clobber` tasks are available for tidying up.\n4.  _Asynchronous_ task handling, with easy options for specifying _synchronous_ tasks.\n5.  Simple _namespacing_ of tasks to break projects into discreet parts.\n5.  Many utility methods for handling common build tasks (rm, rm_rf, mkdir, mkdir_p, sh, cat, etc...)\n\n\nInstallation\n------------\n\n### Install with npm\n\nDownload and install with the following:\n\n~~~\nnpm install -g sake\n~~~\n\nCommand-Line Usage\n------------------\n\n~~~\n% sake -h\n\nusage: sake [TASKNAME] [ARGUMENTS ...] [ENV=VALUE ...] [options]\n\n[TASKNAME]     Name of the task to run. Defaults to 'default'.\n[ARGUMENTS ...]     Zero or more arguments to pass to the task invoked.\n[ENV=VALUE ...]     Zero or more arguments to translate into environment variables.\n\noptions:\n   -f, --sakefile PATH       PATH to Sakefile to run instead of searching for one.\n   -T, --tasks [PATTERN]     List tasks with descriptions (optionally, just those\n                             matching PATTERN) and exit.\n   -P, --prereqs [PATTERN]   List tasks and their prerequisites (optionally, just\n                             those matching PATTERN) and exit.\n   -r, --require MODULE      Require MODULE before executing Sakefile and expose the\n                             MODULE under a sanitized namespace (i.e.: coffee-script\n                             => [sake.]coffeeScript). Can be specified multiple\n                             times.\n   -l, --sakelib PATH        Auto-include any .sake[.js|.coffeee] files in PATH.\n                             (default is 'sakelib'.) Can be specified multiple times\n   -n, --dry-run             Do a dry run without executing actions.\n   -C, --no-chdir            Do not change directory to the Sakefile location.\n   -N, --no-search           Do not search parent directories for a Sakefile.\n   -G, --no-system           Do not use SAKE_PATH environment variable to search for\n                             a Sakefile.\n   -S, --sync                Make all standard tasks 'synchronous' by default.\n   -d, --debug               Enable additional debugging output.\n   -q, --quiet               Suppress informational messages.\n   -V, --version             Print the version of sake and exit.\n   -h, --help                Print this help information and exit.\n\nIf a Sakefile is not specified, sake searches the current directory, and all parent\ndirectories, for one (unless -N, --no-search is set). Otherwise, if the SAKE_PATH\nenvironment variable is defined it searches those path(s) (unless -G, --no-system is\nset).\n\nIf specified, or found through normal searching (not in SAKE_PATH(s)), sake changes the\nprocess' current working directory to the directory of the found Sakefile (unless -C,\n--no-chdir is set), otherwise it stays where it was run from.\n\nSake then invokes the specified TASKNAME, or the \"default\" one.\n\nSakefile can be one of \"Sakefile\", or \"sakefile\", with an optional extension of \".js\",\nor \".coffee\".\n~~~\n\n### Dependencies ###\n\nThese are installed when **sake** is installed.\n\n~~~\nnomnom:   >=1.5.x\nasync:    >=0.1.x\nresolve:  >=0.2.x\nproteus:  >=0.0.x\nwordwrap: >=0.0.2\nglob:     >=2.1.x\n~~~\n\n\n### Development Dependencies ###\n\nInstalled when you run `npm link` in the package directory.\n\n~~~\nmocha:      >=0.3.x\nshould:     >=0.5.x\nunderscore: >=1.3.x\n~~~\n\n\nSakefile Usage\n--------------\n\nWithin a `Sakefile`, Saké's methods are exported to the global scope, so you can invoke them directly:\n\n~~~js\ntask(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n~~~\n    \nWithin another node module you can `require(\"sake\")` and access the methods on the exported object, or even run a block of code in the **saké** context (virtual machine):\n\n~~~js\nvar sake = require(\"sake\");\n    \nsake.task(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n\n// The function passed to sake#run is compiled and run in the sake context.\n// The function **will not** have access to any variables in this scope,\n// nor, will variables leak from the function's scope into this one.\nsake.run(function () {\n    var jsFiles = new FileList(\"src/js/**/*.js\");\n    \n    require(\"sake/clean\");\n    \n    task(\"script-min.js\", jsFiles, function (t) {\n        var cmd = \"infuse \" + jsFiles.map(function (path) {\n                return \"-i \" + path;\n            }) + \" -E\";\n            \n        sh(cmd, function (err, result) {\n            write(t.name, result, \"utf8\");\n            t.done();\n        })\n    });\n    \n    CLEAN.include(\"script-min.js\");\n});\n~~~\n\nThe remainder of this documentation will assume that we are calling the methods from within a `Sakefile`.\n\n\nDefining Tasks\n--------------\n\nThe various task methods take the following arguments:\n\n1.   `taskname`: `string` &mdash; naming the task\n2.   `prerequisites`: _optional_ \n    *   an `array` of:\n        *   `string` task name, or\n        *   a `FileLists`, or \n        *   a `function` that returns one of the above.\n    *   or, you can also pass a `FileList` in directly for `prerequisites`.\n3.   `action`: an _optional_ `function` that will be called when the task is invoked. It will be passed the task instance as its first argument, followed by any arguments that it was invoked with (either from the command-line, or through code). Task arguments can also be accessed through the instance's `arguments` property. i.e: `t.arguments`.\n\nAll task methods return the task *instance*.\n\nIf a task is already defined, it will be augmented by the additional arguments. So, this:\n\n~~~js\ntask(\"one\", [\"othertask\"], function (t) {\n    // do action one...\n    t.done();\n});\n\ntask(\"one\", function (t) {\n    // do action two...\n    t.done();\n});\n\ntask(\"othertask\");\n~~~\n\nWould result in a task \"othertask\" with no prerequisites, and no action, and a task \"one\" with \"othertask\" as a prerequisite and the two functions as its actions.\n\n**Note** how the dependent task was defined *after* it was required as a prerequisite. Task prerequisites are not resolved until the task is invoked. This leads to flexibility in how to compose your tasks and prerequisite tasks.\n\n\n### Task Instance Properties and Methods ###\n\n*   `name {string}` &mdash; the name of the task.\n*   `namespace {string}` &mdash; the task's namespace.\n*   `type {string}` &mdash; one of \"task\", \"file-task\", or \"file-create-task\"\n*   `fqn {string}` &mdash; the fully qualified name of the task. i.e: \"namespace:name\".\n*   `prerequisites {array}` &mdash; the list of prerequisite names for the task.\n*   `isNeeded {boolean}` &mdash; whether or not this task needs to run.\n*   `timestamp {boolean}` &mdash; the last modification time for the task.\n*   `invoke([args ...]) {Task}` &mdash; invoke the task passing args to each action for the task. Will run any prerequisites first. Returns the task instance.\n*   `execute([args ...]) {Task}` &mdash; Like `invoke`, but run the task even if it has already been run, or is not needed.\n*   `done()` &mdash; signal that the current task's action is done running.\n*   `abort([msg], [exitCode])` &mdash; abort the currently running task's actions, if _exitCode_ is specified **saké** will exit with that exit code and no other tasks will be processed. Otherwise, task processing will continue as normal.\n\n\n### Task Static Properties and Methods ###\n\n*   `namespace {string}` &mdash; the current namespace.\n*   `invoke(name, [rest ...]) {Task}` &mdash; invoke the named task and pass it the rest of the arguments.\n*   `get(name, [namespace]) {Task}` &mdash; get the task _name_, optionally start looking in _namespace_. Will throw an error if it can not find a task.\n*   `lookup(name, [namespace]) {Task|null}` &mdash; lookup a task with _name_, optionally start looking in _namespace_.\n*   `getAll() {array[Task]}` &mdash; return all defined tasks.\n*   `has(name, [namespace]) {boolean}` &mdash; does the task _name_ exist?\n*   `find(args, sortFn) {array[Task]}` &mdash; search for a task. _args_ can be an object with keys specifying which properties to match on, and their values denoting the value to match. _args_ can also be a function that accepts a task and returns a boolean whether or not that task matches.\n\n\nFile Tasks\n----------\n\nFile tasks are created with the (appropriately named) `file` method. File tasks are only triggered if the file doesn't exist, or the modification time of any of its prerequisites is newer than itself.\n\n~~~js\nfile(\"path/to/some/file\", function (t) {\n    cp(\"other/path\", t.name);\n    t.done();\n});\n~~~\n\nThe above task would only be triggered if `path/to/some/file` did not exist.\n\nThe following:\n\n~~~js\nfile(\"combined/file/path\", [\"pathA\", \"pathB\", \"pathC\"], function (t) {\n    write(t.name, cat(t.prerequisites), \"utf8\");\n    t.done();\n});\n~~~\n\nwould be triggered if `path/to/some/file` did not exist, or its modification time was earlier than any of its prerequisites (`pathA`, `pathB`, or  `pathC`).\n\n\nDirectory Tasks\n---------------\n\nDirectory tasks, created with the `directory` method, are tasks that will only be called if they do not exist. A task will be created for the named directory (and for all directories along the way) with the action of creating the directory.\n\nDirectory tasks do not take any `prerequisites` or an `action` when first defined, however, they may be augmented with such after they are created:\n\n~~~js\ndirectory(\"dir/path/to/create\");\n\ntask(\"dir/path/to/create\", [\"othertask\"], action (t) {\n    //... do stuff\n    t.done();\n});\n~~~\n\n\nFile Create Tasks\n-----------------\n\nA file create task is a file task, that when used as a prerequisite, will be needed if, and only if, the file has not been created. Once created, it is not re-triggered if any of its prerequisites are newer, nor does it trigger any rebuilds of tasks that depend on it whenever the file is updated.\n\n~~~js\nfileCreate(\"file/path/to/create.ext\", [\"pathA\", \"pathB\"], function (t) {\n    // create file...\n    t.done();\n});\n~~~\n\n\n(A)Synchronicity and Tasks\n--------------------------\n\nIn **saké** all task actions are assumed to be *asynchronous* and an action must call its task's `done` method to tell **saké** that it is done processing stuff.\n\n~~~js\ntask(\"long task\", function (t) {\n    sh(\"some long running shell command\", function (err, result) {\n        // do stuff...\n        t.done();\n    });\n});\n~~~\n\nAlternatively, you can use the `Sync` version of a task to add a *synchronous* action, and `done` will be called for you after the function completes.\n\n~~~js\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n~~~\n\nThere are `Sync` versions of all the core tasks: `taskSync`, `fileSync`, and `fileCreateSync`. There are also `Async` versions of each task: `taskAsync`, `fileAsync`, and `fileCreateAsync`. The actions created for a `directory` task are *synchronous*. You can add *asynchronous* task actions after the initial definition.\n\nThirdly, you can specify that all of the core task creation functions generate *synchronous* actions by setting **saké's** \"sync\" option to `true`, or by use of the command-line option `-S, --sync`.\n\n~~~js\nsake.options.sync = true;\n\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n\n//... define more synchronous tasks\n\n//... and then revert to async\nsake.options.sync = false;\n~~~\n\nUltimately, it is up to the **saké** script author to correctly designate a task action as *synchronous* or *asynchronous*. Nothing prevents the running of an *asynchronous* function within a task's *synchronous* action. If nothing is dependent on the result of that action, then no problem would occur. It's when other tasks rely on the completion of certain *asynchronous* actions, that problems may arise.\n\nIn the case of *asynchronous* actions, **Saké** will issue a `WARNING` when it can not detect a `done()` call within that action.\n\n\nNamespaces\n----------\n\n**Saké** supports simple name spacing of tasks. Simply prepend the namespace before the task name with a colon \":\". This can be done when defining a task, or in the list of prerequisites for a task.\n\n~~~js\n// Defines a task 'fuz' in the namespace 'foo' that depends on the task 'buz'\n// in the namespace 'baz'\ntask(\"foo:fuz\", [\"baz:buz\"], function (t) {\n    //...\n    t.done();\n});\n~~~\n\nThen invoke the task as so:\n\n~~~\n% sake foo:fuz\n~~~\n\nYou can also use the convenience function `namespace` to wrap your task definitions for a particular namespace. Any _namespace naked_ definitions will first be tried in the local namespace, otherwise they will fall-back to the default namespace:\n\n~~~js\n\ntask(\"default\", function (t) {\n    //...\n    t.done():\n});\n\ntask(\"bazil\", function (t) {\n    //...\n    t.done():\n});\n\n// define within the 'foo' namespace\nnamespace(\"foo\", function () {\n    \n    // defines 'foo:foom' task\n    task(\"foom\", function (t) {\n        //...\n        t.done():\n    });\n    \n});\n\nnamespace(\"baz\", function () {\n    \n    // this task is defined in the 'baz' namespace, and depends on the\n    // 'foom' task from the 'foo' namespace\n    task(\"bazil\", [\"foo:foom\"], function (t) {\n        //...\n        t.done():\n    });\n    // This task is also defined in the 'baz' namespace. It depends on \n    // the 'bazil' task, which is also defined in 'baz' namespace. It\n    // also depends on the 'default' task in the 'default' (top-level)\n    // namespace.\n    task(\"buzil\", [\"bazil\", \"default\"], function (t), {\n        //...\n        t.done():\n    });\n    // If 'bazil' wasn't defined in the 'baz' namespace, it would resolve\n    // to the 'default' namespace task.\n});\n~~~\n\n**Note:** prerequisite names are tied to the defined task's namespace. i.e: If a task \"foo:fuz\" depends on \"foom\" **saké** will look in the \"foo\" namespace for \"foom\", and then the \"default\" namespace.\n\n**Note:** although the `namespace` functions can be nested, **saké** does not track the hierarchy of `namespace` calls -- if a dependent task is not found in the current task's namespace, it will look for it in the default namespace.\n\n\nPassing Arguments to A Task\n---------------------------\n\nThere are two ways to pass arguments to a task.\n\nFirst, **saké** translates any arguments in the form of `ENV=VALUE` on the command-line into `process.env` values:\n\n~~~\n% sake build BUILD_TYPE=debug ENVIRONMENT=prod\n~~~\n\nWill set `process.env.BUILD_TYPE` to \"debug\" and `process.env.ENVIRONMENT` to \"prod\". The values are JSON parsed; so the values are translated into real JavaScript values (numbers, true, false, etc...).\n\nSecondly, **saké** passes all non-option, and non-ENV=VALUE, looking arguments from the command-line to the invoked task:\n\n~~~\n% sake foo 3.14 pie true\n~~~\n\nWill invoke the \"foo\" task and pass to each of foo's actions (after the task instance itself) `3.14`, \"pie\" and `true`. The arguments are also JSON parsed to get real JavaScript values.\n\n~~~js\ntask(\"foo\", function (t, amt, word, flag) {\n    log(amt);   // => 3.14\n    log(word);  // => \"pie\"\n    log(flag);  // => true\n});\n~~~\n\n**Note:** This differs from how **rake**, and **jake** do things. In **saké** you can only invoke one task on the command-line. All other arguments on the command-line are considered task arguments.\n\n\nIncluding Other Saké Files\n-------------------------------------\n\nYou can include other **saké** files with the `include` and `load` methods. The included files will be run in the **saké** context, so any variables they do not declare with the `var` keyword will be set on the global **saké** context. This allows you to break your project build files up into discreet files.\n\nAll `require` and `include`, or `load` statements, are resolved relative to the current file, so you can create your own hierarchy of build dependencies.\n\nYou can also add your own paths to the list of ones that **saké** uses to resolve `requires`: `[sake.]includePaths` is an array of directory paths to search. They are tried in reverse order, so if you push a path on to the array that path will be tried first, followed by any others.\n\n~~~js\n// in a Sakefile\nincludePaths.push(\"some/path\");\n\nrequire(\"some-module\"); // will be tried in some/path/some-module.js\n~~~\n\nAlso, the `__dirname` and `__filename` properties are available in `included` files to help resolve local includes.\n\n~~~js\nvar Path = require(\"path\");\n\ninclude(Path.join(__dirname, \"include-dir/include-file\"));\n~~~\n\nSake Library\n------------\n\n**Saké** will load any `.sake`, `.sake.js`, or `.sake.coffee` files located in a `sakelib` directory relative to the `Sakefile` being run. This directory name can be modified with the `-l, --sakelib` option, and multiple directories can be specified. This allows you to re-use common tasks across multiple projects.\n\n\nFile Lists\n----------\n\nFileLists are lists of file paths.\n\n~~~js\nnew FileList(\"*.scss\");\n~~~\n\nWould contain all the file paths with a \".scss\" extension in the top-level directory of your project.\n\nYou can use FileLists pretty much like an `Array`. You can iterate them (with `forEach, filter, reduce`, etc...), `concat` them, `splice` them, and you get back a new FileList object.\n\nTo add files, or glob patterns to them, use the `#include` method:\n\n~~~js\nvar fl = new FileList(\"*.scss\");\nfl.include(\"core.css\", \"reset.css\", \"*.css\");\n~~~\n\nYou can also `exlucude` files by Glob pattern, `Regular Expression` pattern, or by use of a `function` that takes the file path as an argument and returns a `truthy` value to exclude a file.\n\n~~~js\n// Exclude by RegExp\nfl.exclude(/^dev-.*\\.css/);\n\n// Exclude by Glob pattern\nfl.exclude(\"dev-*.css\");\n\n// Exclude by function\nfl.exclude(function (path) {\n    return FS.statSync(path).mtime.getTime() < (Date.now() - 60 * 60 * 1000);\n});\n~~~\n\nTo get to the actual items of the FileList, use the `#items` property, or the `#toArray` method, to get a plain array back. You can also use the `#get` or `#set` methods to retrieve or set an item.\n\nFileLists are *lazy*, in that the actual file paths are not determined from the include and exclude patterns until the individual items are requested. This allows you to define a FileList and incrementally add patterns to it in the Sakefile file. The FileList paths will not be resolved until the task that uses it as a prerequisite actually asks for the final paths.\n\n\n### FileList Properties & Methods ###\n\n*   `existing` &mdash; will return a new `FileList` with all of the files that actually exist.\n*   `notExisting` &mdash; will return a new `FileList` of all the files that do not exist.\n*   `extension(ext)` &mdash; returns a new `FileList` with all paths that match the given extension.\n\n~~~js\nfl.extension(\".scss\").forEach(function (path) {\n    //...\n});\n~~~\n\n*   `grep(pattern)` &mdash; get a `FileList` of all the files that match the given `pattern`. `pattern` can be a plain `String`, a `Glob` pattern, a `RegExp`, or a `function` that receives each path and can return a truthy value to include it.\n*   `clearExcludes()` &mdash; clear all exclude patterns/functions.\n*   `clearIncludes()` &mdash; clear all include patterns.\n\nBy default, a `FileList` excludes directories. To allow directories call `FileList#clearExcludes()` before requesting any items.\n\n\nThe \"clean\" and \"clobber\" Tasks, and The CLEAN and CLOBBER FileLists\n--------------------------------------------------------------------\n\nWithin a `Sakefile`:\n\n~~~js\n// defines the CLEAN FileList and 'clean' task\nrequire(\"sake/clean\");\n\n// defines the above, and also the CLOBBER FileTask and 'clobber' task\nrequire(\"sake/clobber\");\n~~~\n\nWhen the \"clean\" task is run, it will remove any files that have been included in the `CLEAN FileList`. \"clobber\" will remove any file, or directory, included in the `CLOBBER FileList`.\n\n\nSaké Utility Functions\n----------------------\n\nSaké defines a few utility functions to make life a little easier in an asynchronous world. Most of these are just wrappers for `node`'s File System (`require(\"fs\")`) utility methods.\n\n### Synchronous Utilities ###\n\n*   `mkdir(dirpath, mode=\"777\")` &mdash; create the `dirpath` directory, if it doesn't already exist.\n*   `mkdir_p(dirpath, mode=\"777\"])` &mdash; as above, but create all intermediate directories as needed.\n*   `rm(path, [path1, ..., pathN])` &mdash; remove one or more paths from the file system.\n*   `rm_rf(path, [path1, ..., pathN])` &mdash; as above, and remove directories and their contents.\n*   `cp(from, to)` &mdash; copy a file from `from` path to `to` path.\n*   `cp_r(from, to)` &mdash; copy all files from `from` path to `to` path.\n*   `mv(from, to)` &mdash; move a file from `from` path to `to` path.\n*   `ln(from, to)` &mdash; create a hard link from `from` path to `to` path.\n*   `ln_s(from, to)` &mdash; create a symlink from `from` path to `to` path.\n*   `cat(path, [path1, ..., pathN]) {string}` &mdash; read all supplied paths and return their contents as a string. If an argument is an `Array` it will be expanded and those paths will be read.\n*   `readdir(path) {array[string]}` &mdash; returns the files of directory `path`.\n*   `read(path, [enc]) {string|Buffer}` &mdash; read the supplied file path. Returns a `buffer`, or a `string` if `enc` is given.\n*   `write(path, data, [enc], mode=\"w\")` &mdash; write the `data` to the supplied file `path`. `data` should be a `buffer` or a `string` if `enc` is given. `mode` is a `string` of either \"w\", for over write,  or \"a\" for append.\n*   `slurp(path, [env]) {sring|Buffer}` &mdash; alias for `read`\n*   `spit(path, data, [enc], mode=\"w\")` &mdash; alias for `write`\n\n\n### Asynchronous Utilities ###\n\n*   `sh(cmd, fn(error, result))` &mdash; execute shell `cmd`. In the callback function, `error` will be a truthy value if there was an error, and `result` will contain the STDERR returned from `cmd`. Otherwise, `result` will contain the STDOUT from the `cmd`. If `cmd` is an array of shell commands, each one will be run before the next, and only when they all complete, or an error is encountered, will the callback `fn` be called, and `result` be an array of the results of the individual commands.\n\n\nReport an Issue\n---------------\n\n* [Bugs](http://github.com/jhamlet/node-sake/issues)\n* Contact the author: <jhamlet@hamletink.com>\n\n\nLicense\n-------\n\n> Copyright (c) 2012 Jerry Hamlet <jerry@hamletink.com>\n> \n> Permission is hereby granted, free of charge, to any person\n> obtaining a copy of this software and associated documentation\n> files (the \"Software\"), to deal in the Software without\n> restriction, including without limitation the rights to use,\n> copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the\n> Software is furnished to do so, subject to the following\n> conditions:\n> \n> The above copyright notice and this permission notice shall be\n> included in all copies or substantial portions of the Software.\n> \n> The Software shall be used for Good, not Evil.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n> OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n> HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n> WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n> FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n> OTHER DEALINGS IN THE SOFTWARE.\n\n","maintainers":[{"name":"jhamlet","email":"jerry@hamletink.com"}]},"0.1.18":{"name":"sake","description":"[S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.","version":"0.1.18","keywords":["build","make","rake","jake"],"main":"./node_modules/sake/index.js","bin":{"sake":"./bin/sake"},"dependencies":{"nomnom":">=1.5.x","async":">=0.1.x","resolve":">=0.2.x","proteus":">=0.0.x","wordwrap":">=0.0.2","glob":">=2.1.x"},"devDependencies":{"mocha":">=0.3.x","should":">=0.5.x","underscore":">=1.3.x"},"bundleDependencies":["sake"],"scripts":{"test":"mocha test/test-*"},"licenses":[{"type":"MIT","url":"http://github.com/jhamlet/node-sake/raw/master/LICENSE"}],"repository":{"type":"git","url":"git://github.com/jhamlet/node-sake.git"},"bugs":{"url":"http://github.com/jhamlet/node-sake/issues"},"preferGlobal":true,"_npmUser":{"name":"jhamlet","email":"jerry@hamletink.com"},"_id":"sake@0.1.18","contributors":[{"name":"Jerry Hamlet","email":"jerry@hamletink.com"}],"optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.22","_nodeVersion":"v0.6.10","_defaultsLoaded":true,"dist":{"shasum":"880b5f0e6859ce26e988c7cee37a5a249a13b16e","tarball":"https://registry.npmjs.org/sake/-/sake-0.1.18.tgz","integrity":"sha512-UGkU5/1f8R1e6DfmocOPmTaqkrGqEWAMMB79l7AsKuTE7/2T3pfyw5KgHYAEyCEc33fXkWWz3vUmKHq0rt5Qhw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCLXHiBNH9Feny2FRUYZugMHdX/JXbo3Laxu3th6C9EPQIgQ7R4tTsEXt1510zHkWppm9vgrzeFHHOMXU+q+D1Qq+I="}]},"readme":"\nSaké\n====\n\n> [S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.\n\n\nOverview\n--------\n\nThis package contains **saké**, a JavaScript build program that runs in node with capabilities similar to ruby's Rake.\n\nSaké has the following features:\n\n1.  `Sakefiles` (**saké’s** version of Rakefiles) are completely defined in standard JavaScript (or CoffeeScript, for those who want an even more Rake-like feel).\n2.  Flexible `FileLists` that act like arrays but know about manipulating file names and paths.\n3.  `clean` and `clobber` tasks are available for tidying up.\n4.  _Asynchronous_ task handling, with easy options for specifying _synchronous_ tasks.\n5.  Simple _namespacing_ of tasks to break projects into discreet parts.\n5.  Many utility methods for handling common build tasks (rm, rm_rf, mkdir, mkdir_p, sh, cat, etc...)\n\n\nInstallation\n------------\n\n### Install with npm\n\nDownload and install with the following:\n\n~~~\nnpm install -g sake\n~~~\n\nCommand-Line Usage\n------------------\n\n~~~\n% sake -h\n\nusage: sake [TASKNAME] [ARGUMENTS ...] [ENV=VALUE ...] [options]\n\n[TASKNAME]     Name of the task to run. Defaults to 'default'.\n[ARGUMENTS ...]     Zero or more arguments to pass to the task invoked.\n[ENV=VALUE ...]     Zero or more arguments to translate into environment variables.\n\noptions:\n   -f, --sakefile PATH       PATH to Sakefile to run instead of searching for one.\n   -T, --tasks [PATTERN]     List tasks with descriptions (optionally, just those\n                             matching PATTERN) and exit.\n   -P, --prereqs [PATTERN]   List tasks and their prerequisites (optionally, just\n                             those matching PATTERN) and exit.\n   -r, --require MODULE      Require MODULE before executing Sakefile and expose the\n                             MODULE under a sanitized namespace (i.e.: coffee-script\n                             => [sake.]coffeeScript). Can be specified multiple\n                             times.\n   -l, --sakelib PATH        Auto-include any .sake[.js|.coffeee] files in PATH.\n                             (default is 'sakelib'.) Can be specified multiple times\n   -n, --dry-run             Do a dry run without executing actions.\n   -C, --no-chdir            Do not change directory to the Sakefile location.\n   -N, --no-search           Do not search parent directories for a Sakefile.\n   -G, --no-system           Do not use SAKE_PATH environment variable to search for\n                             a Sakefile.\n   -S, --sync                Make all standard tasks 'synchronous' by default.\n   -d, --debug               Enable additional debugging output.\n   -q, --quiet               Suppress informational messages.\n   -V, --version             Print the version of sake and exit.\n   -h, --help                Print this help information and exit.\n\nIf a Sakefile is not specified, sake searches the current directory, and all parent\ndirectories, for one (unless -N, --no-search is set). Otherwise, if the SAKE_PATH\nenvironment variable is defined it searches those path(s) (unless -G, --no-system is\nset).\n\nIf specified, or found through normal searching (not in SAKE_PATH(s)), sake changes the\nprocess' current working directory to the directory of the found Sakefile (unless -C,\n--no-chdir is set), otherwise it stays where it was run from.\n\nSake then invokes the specified TASKNAME, or the \"default\" one.\n\nSakefile can be one of \"Sakefile\", or \"sakefile\", with an optional extension of \".js\",\nor \".coffee\".\n~~~\n\n### Dependencies ###\n\nThese are installed when **sake** is installed.\n\n~~~\nnomnom:   >=1.5.x\nasync:    >=0.1.x\nresolve:  >=0.2.x\nproteus:  >=0.0.x\nwordwrap: >=0.0.2\nglob:     >=2.1.x\n~~~\n\n\n### Development Dependencies ###\n\nInstalled when you run `npm link` in the package directory.\n\n~~~\nmocha:      >=0.3.x\nshould:     >=0.5.x\nunderscore: >=1.3.x\n~~~\n\n\nSakefile Usage\n--------------\n\nWithin a `Sakefile`, Saké's methods are exported to the global scope, so you can invoke them directly:\n\n~~~js\ntask(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n~~~\n    \nWithin another node module you can `require(\"sake\")` and access the methods on the exported object, or even run a block of code in the **saké** context (virtual machine):\n\n~~~js\nvar sake = require(\"sake\");\n    \nsake.task(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n\n// The function passed to sake#run is compiled and run in the sake context.\n// The function **will not** have access to any variables in this scope,\n// nor, will variables leak from the function's scope into this one.\nsake.run(function () {\n    var jsFiles = new FileList(\"src/js/**/*.js\");\n    \n    require(\"sake/clean\");\n    \n    task(\"script-min.js\", jsFiles, function (t) {\n        var cmd = \"infuse \" + jsFiles.map(function (path) {\n                return \"-i \" + path;\n            }) + \" -E\";\n            \n        sh(cmd, function (err, result) {\n            write(t.name, result, \"utf8\");\n            t.done();\n        })\n    });\n    \n    CLEAN.include(\"script-min.js\");\n});\n~~~\n\nThe remainder of this documentation will assume that we are calling the methods from within a `Sakefile`.\n\n\nDefining Tasks\n--------------\n\nThe various task methods take the following arguments:\n\n1.   `taskname`: `string` &mdash; naming the task\n2.   `prerequisites`: _optional_ \n    *   an `array` of:\n        *   `string` task name, or\n        *   a `FileLists`, or \n        *   a `function` that returns one of the above.\n    *   or, you can also pass a `FileList` in directly for `prerequisites`.\n3.   `action`: an _optional_ `function` that will be called when the task is invoked. It will be passed the task instance as its first argument, followed by any arguments that it was invoked with (either from the command-line, or through code). Task arguments can also be accessed through the instance's `arguments` property. i.e: `t.arguments`.\n\nAll task methods return the task *instance*.\n\nIf a task is already defined, it will be augmented by the additional arguments. So, this:\n\n~~~js\ntask(\"one\", [\"othertask\"], function (t) {\n    // do action one...\n    t.done();\n});\n\ntask(\"one\", function (t) {\n    // do action two...\n    t.done();\n});\n\ntask(\"othertask\");\n~~~\n\nWould result in a task \"othertask\" with no prerequisites, and no action, and a task \"one\" with \"othertask\" as a prerequisite and the two functions as its actions.\n\n**Note** how the dependent task was defined *after* it was required as a prerequisite. Task prerequisites are not resolved until the task is invoked. This leads to flexibility in how to compose your tasks and prerequisite tasks.\n\n\n### Task Instance Properties and Methods ###\n\n*   `name {string}` &mdash; the name of the task.\n*   `namespace {string}` &mdash; the task's namespace.\n*   `type {string}` &mdash; one of \"task\", \"file-task\", or \"file-create-task\"\n*   `fqn {string}` &mdash; the fully qualified name of the task. i.e: \"namespace:name\".\n*   `prerequisites {array}` &mdash; the list of prerequisite names for the task.\n*   `isNeeded {boolean}` &mdash; whether or not this task needs to run.\n*   `timestamp {boolean}` &mdash; the last modification time for the task.\n*   `invoke([args ...]) {Task}` &mdash; invoke the task passing args to each action for the task. Will run any prerequisites first. Returns the task instance.\n*   `execute([args ...]) {Task}` &mdash; Like `invoke`, but run the task even if it has already been run, or is not needed.\n*   `done()` &mdash; signal that the current task's action is done running.\n*   `abort([msg], [exitCode])` &mdash; abort the currently running task's actions, if _exitCode_ is specified **saké** will exit with that exit code and no other tasks will be processed. Otherwise, task processing will continue as normal.\n\n\n### Task Static Properties and Methods ###\n\n*   `namespace {string}` &mdash; the current namespace.\n*   `invoke(name, [rest ...]) {Task}` &mdash; invoke the named task and pass it the rest of the arguments.\n*   `get(name, [namespace]) {Task}` &mdash; get the task _name_, optionally start looking in _namespace_. Will throw an error if it can not find a task.\n*   `lookup(name, [namespace]) {Task|null}` &mdash; lookup a task with _name_, optionally start looking in _namespace_.\n*   `getAll() {array[Task]}` &mdash; return all defined tasks.\n*   `has(name, [namespace]) {boolean}` &mdash; does the task _name_ exist?\n*   `find(args, sortFn) {array[Task]}` &mdash; search for a task. _args_ can be an object with keys specifying which properties to match on, and their values denoting the value to match. _args_ can also be a function that accepts a task and returns a boolean whether or not that task matches.\n\n\nFile Tasks\n----------\n\nFile tasks are created with the (appropriately named) `file` method. File tasks are only triggered if the file doesn't exist, or the modification time of any of its prerequisites is newer than itself.\n\n~~~js\nfile(\"path/to/some/file\", function (t) {\n    cp(\"other/path\", t.name);\n    t.done();\n});\n~~~\n\nThe above task would only be triggered if `path/to/some/file` did not exist.\n\nThe following:\n\n~~~js\nfile(\"combined/file/path\", [\"pathA\", \"pathB\", \"pathC\"], function (t) {\n    write(t.name, cat(t.prerequisites), \"utf8\");\n    t.done();\n});\n~~~\n\nwould be triggered if `path/to/some/file` did not exist, or its modification time was earlier than any of its prerequisites (`pathA`, `pathB`, or  `pathC`).\n\n\nDirectory Tasks\n---------------\n\nDirectory tasks, created with the `directory` method, are tasks that will only be called if they do not exist. A task will be created for the named directory (and for all directories along the way) with the action of creating the directory.\n\nDirectory tasks do not take any `prerequisites` or an `action` when first defined, however, they may be augmented with such after they are created:\n\n~~~js\ndirectory(\"dir/path/to/create\");\n\ntask(\"dir/path/to/create\", [\"othertask\"], action (t) {\n    //... do stuff\n    t.done();\n});\n~~~\n\n\nFile Create Tasks\n-----------------\n\nA file create task is a file task, that when used as a prerequisite, will be needed if, and only if, the file has not been created. Once created, it is not re-triggered if any of its prerequisites are newer, nor does it trigger any rebuilds of tasks that depend on it whenever the file is updated.\n\n~~~js\nfileCreate(\"file/path/to/create.ext\", [\"pathA\", \"pathB\"], function (t) {\n    // create file...\n    t.done();\n});\n~~~\n\n\n(A)Synchronicity and Tasks\n--------------------------\n\nIn **saké** all task actions are assumed to be *asynchronous* and an action must call its task's `done` method to tell **saké** that it is done processing stuff.\n\n~~~js\ntask(\"long task\", function (t) {\n    sh(\"some long running shell command\", function (err, result) {\n        // do stuff...\n        t.done();\n    });\n});\n~~~\n\nAlternatively, you can use the `Sync` version of a task to add a *synchronous* action, and `done` will be called for you after the function completes.\n\n~~~js\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n~~~\n\nThere are `Sync` versions of all the core tasks: `taskSync`, `fileSync`, and `fileCreateSync`. There are also `Async` versions of each task: `taskAsync`, `fileAsync`, and `fileCreateAsync`. The actions created for a `directory` task are *synchronous*. You can add *asynchronous* task actions after the initial definition.\n\nThirdly, you can specify that all of the core task creation functions generate *synchronous* actions by setting **saké's** \"sync\" option to `true`, or by use of the command-line option `-S, --sync`.\n\n~~~js\nsake.options.sync = true;\n\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n\n//... define more synchronous tasks\n\n//... and then revert to async\nsake.options.sync = false;\n~~~\n\nUltimately, it is up to the **saké** script author to correctly designate a task action as *synchronous* or *asynchronous*. Nothing prevents the running of an *asynchronous* function within a task's *synchronous* action. If nothing is dependent on the result of that action, then no problem would occur. It's when other tasks rely on the completion of certain *asynchronous* actions, that problems may arise.\n\nIn the case of *asynchronous* actions, **Saké** will issue a `WARNING` when it can not detect a `done()` call within that action.\n\n\nNamespaces\n----------\n\n**Saké** supports simple name spacing of tasks. Simply prepend the namespace before the task name with a colon \":\". This can be done when defining a task, or in the list of prerequisites for a task.\n\n~~~js\n// Defines a task 'fuz' in the namespace 'foo' that depends on the task 'buz'\n// in the namespace 'baz'\ntask(\"foo:fuz\", [\"baz:buz\"], function (t) {\n    //...\n    t.done();\n});\n~~~\n\nThen invoke the task as so:\n\n~~~\n% sake foo:fuz\n~~~\n\nYou can also use the convenience function `namespace` to wrap your task definitions for a particular namespace. Any _namespace naked_ definitions will first be tried in the local namespace, otherwise they will fall-back to the default namespace:\n\n~~~js\n\ntask(\"default\", function (t) {\n    //...\n    t.done():\n});\n\ntask(\"bazil\", function (t) {\n    //...\n    t.done():\n});\n\n// define within the 'foo' namespace\nnamespace(\"foo\", function () {\n    \n    // defines 'foo:foom' task\n    task(\"foom\", function (t) {\n        //...\n        t.done():\n    });\n    \n});\n\nnamespace(\"baz\", function () {\n    \n    // this task is defined in the 'baz' namespace, and depends on the\n    // 'foom' task from the 'foo' namespace\n    task(\"bazil\", [\"foo:foom\"], function (t) {\n        //...\n        t.done():\n    });\n    // This task is also defined in the 'baz' namespace. It depends on \n    // the 'bazil' task, which is also defined in 'baz' namespace. It\n    // also depends on the 'default' task in the 'default' (top-level)\n    // namespace.\n    task(\"buzil\", [\"bazil\", \"default\"], function (t), {\n        //...\n        t.done():\n    });\n    // If 'bazil' wasn't defined in the 'baz' namespace, it would resolve\n    // to the 'default' namespace task.\n});\n~~~\n\n**Note:** prerequisite names are tied to the defined task's namespace. i.e: If a task \"foo:fuz\" depends on \"foom\" **saké** will look in the \"foo\" namespace for \"foom\", and then the \"default\" namespace.\n\n**Note:** although the `namespace` functions can be nested, **saké** does not track the hierarchy of `namespace` calls -- if a dependent task is not found in the current task's namespace, it will look for it in the default namespace.\n\n\nPassing Arguments to A Task\n---------------------------\n\nThere are two ways to pass arguments to a task.\n\nFirst, **saké** translates any arguments in the form of `ENV=VALUE` on the command-line into `process.env` values:\n\n~~~\n% sake build BUILD_TYPE=debug ENVIRONMENT=prod\n~~~\n\nWill set `process.env.BUILD_TYPE` to \"debug\" and `process.env.ENVIRONMENT` to \"prod\". The values are JSON parsed; so the values are translated into real JavaScript values (numbers, true, false, etc...).\n\nSecondly, **saké** passes all non-option, and non-ENV=VALUE, looking arguments from the command-line to the invoked task:\n\n~~~\n% sake foo 3.14 pie true\n~~~\n\nWill invoke the \"foo\" task and pass to each of foo's actions (after the task instance itself) `3.14`, \"pie\" and `true`. The arguments are also JSON parsed to get real JavaScript values.\n\n~~~js\ntask(\"foo\", function (t, amt, word, flag) {\n    log(amt);   // => 3.14\n    log(word);  // => \"pie\"\n    log(flag);  // => true\n});\n~~~\n\n**Note:** This differs from how **rake**, and **jake** do things. In **saké** you can only invoke one task on the command-line. All other arguments on the command-line are considered task arguments.\n\n\nIncluding Other Saké Files\n-------------------------------------\n\nYou can include other **saké** files with the `include` and `load` methods. The included files will be run in the **saké** context, so any variables they do not declare with the `var` keyword will be set on the global **saké** context. This allows you to break your project build files up into discreet files.\n\nAll `require` and `include`, or `load` statements, are resolved relative to the current file, so you can create your own hierarchy of build dependencies.\n\nYou can also add your own paths to the list of ones that **saké** uses to resolve `requires`: `[sake.]includePaths` is an array of directory paths to search. They are tried in reverse order, so if you push a path on to the array that path will be tried first, followed by any others.\n\n~~~js\n// in a Sakefile\nincludePaths.push(\"some/path\");\n\nrequire(\"some-module\"); // will be tried in some/path/some-module.js\n~~~\n\nAlso, the `__dirname` and `__filename` properties are available in `included` files to help resolve local includes.\n\n~~~js\nvar Path = require(\"path\");\n\ninclude(Path.join(__dirname, \"include-dir/include-file\"));\n~~~\n\nSake Library\n------------\n\n**Saké** will load any `.sake`, `.sake.js`, or `.sake.coffee` files located in a `sakelib` directory relative to the `Sakefile` being run. This directory name can be modified with the `-l, --sakelib` option, and multiple directories can be specified. This allows you to re-use common tasks across multiple projects.\n\n\nFile Lists\n----------\n\nFileLists are lists of file paths.\n\n~~~js\nnew FileList(\"*.scss\");\n~~~\n\nWould contain all the file paths with a \".scss\" extension in the top-level directory of your project.\n\nYou can use FileLists pretty much like an `Array`. You can iterate them (with `forEach, filter, reduce`, etc...), `concat` them, `splice` them, and you get back a new FileList object.\n\nTo add files, or glob patterns to them, use the `#include` method:\n\n~~~js\nvar fl = new FileList(\"*.scss\");\nfl.include(\"core.css\", \"reset.css\", \"*.css\");\n~~~\n\nYou can also `exlucude` files by Glob pattern, `Regular Expression` pattern, or by use of a `function` that takes the file path as an argument and returns a `truthy` value to exclude a file.\n\n~~~js\n// Exclude by RegExp\nfl.exclude(/^dev-.*\\.css/);\n\n// Exclude by Glob pattern\nfl.exclude(\"dev-*.css\");\n\n// Exclude by function\nfl.exclude(function (path) {\n    return FS.statSync(path).mtime.getTime() < (Date.now() - 60 * 60 * 1000);\n});\n~~~\n\nTo get to the actual items of the FileList, use the `#items` property, or the `#toArray` method, to get a plain array back. You can also use the `#get` or `#set` methods to retrieve or set an item.\n\nFileLists are *lazy*, in that the actual file paths are not determined from the include and exclude patterns until the individual items are requested. This allows you to define a FileList and incrementally add patterns to it in the Sakefile file. The FileList paths will not be resolved until the task that uses it as a prerequisite actually asks for the final paths.\n\n\n### FileList Properties & Methods ###\n\n*   `existing` &mdash; will return a new `FileList` with all of the files that actually exist.\n*   `notExisting` &mdash; will return a new `FileList` of all the files that do not exist.\n*   `extension(ext)` &mdash; returns a new `FileList` with all paths that match the given extension.\n\n~~~js\nfl.extension(\".scss\").forEach(function (path) {\n    //...\n});\n~~~\n\n*   `grep(pattern)` &mdash; get a `FileList` of all the files that match the given `pattern`. `pattern` can be a plain `String`, a `Glob` pattern, a `RegExp`, or a `function` that receives each path and can return a truthy value to include it.\n*   `clearExcludes()` &mdash; clear all exclude patterns/functions.\n*   `clearIncludes()` &mdash; clear all include patterns.\n\nBy default, a `FileList` excludes directories. To allow directories call `FileList#clearExcludes()` before requesting any items.\n\n\nThe \"clean\" and \"clobber\" Tasks, and The CLEAN and CLOBBER FileLists\n--------------------------------------------------------------------\n\nWithin a `Sakefile`:\n\n~~~js\n// defines the CLEAN FileList and 'clean' task\nrequire(\"sake/clean\");\n\n// defines the above, and also the CLOBBER FileTask and 'clobber' task\nrequire(\"sake/clobber\");\n~~~\n\nWhen the \"clean\" task is run, it will remove any files that have been included in the `CLEAN FileList`. \"clobber\" will remove any file, or directory, included in the `CLOBBER FileList`.\n\n\nSaké Utility Functions\n----------------------\n\nSaké defines a few utility functions to make life a little easier in an asynchronous world. Most of these are just wrappers for `node`'s File System (`require(\"fs\")`) utility methods.\n\n### Synchronous Utilities ###\n\n*   `mkdir(dirpath, mode=\"777\")` &mdash; create the `dirpath` directory, if it doesn't already exist.\n*   `mkdir_p(dirpath, mode=\"777\"])` &mdash; as above, but create all intermediate directories as needed.\n*   `rm(path, [path1, ..., pathN])` &mdash; remove one or more paths from the file system.\n*   `rm_rf(path, [path1, ..., pathN])` &mdash; as above, and remove directories and their contents.\n*   `cp(from, to)` &mdash; copy a file from `from` path to `to` path.\n*   `cp_r(from, to)` &mdash; copy all files from `from` path to `to` path.\n*   `mv(from, to)` &mdash; move a file from `from` path to `to` path.\n*   `ln(from, to)` &mdash; create a hard link from `from` path to `to` path.\n*   `ln_s(from, to)` &mdash; create a symlink from `from` path to `to` path.\n*   `cat(path, [path1, ..., pathN]) {string}` &mdash; read all supplied paths and return their contents as a string. If an argument is an `Array` it will be expanded and those paths will be read.\n*   `readdir(path) {array[string]}` &mdash; returns the files of directory `path`.\n*   `read(path, [enc]) {string|Buffer}` &mdash; read the supplied file path. Returns a `buffer`, or a `string` if `enc` is given.\n*   `write(path, data, [enc], mode=\"w\")` &mdash; write the `data` to the supplied file `path`. `data` should be a `buffer` or a `string` if `enc` is given. `mode` is a `string` of either \"w\", for over write,  or \"a\" for append.\n*   `slurp(path, [env]) {sring|Buffer}` &mdash; alias for `read`\n*   `spit(path, data, [enc], mode=\"w\")` &mdash; alias for `write`\n\n\n### Asynchronous Utilities ###\n\n*   `sh(cmd, fn(error, result))` &mdash; execute shell `cmd`. In the callback function, `error` will be a truthy value if there was an error, and `result` will contain the STDERR returned from `cmd`. Otherwise, `result` will contain the STDOUT from the `cmd`. If `cmd` is an array of shell commands, each one will be run before the next, and only when they all complete, or an error is encountered, will the callback `fn` be called, and `result` be an array of the results of the individual commands.\n\n\nDeveloper Notes\n---------------\n\n*   Due to an issue with npm v1.1.13 and up (see issue [#2490](https://github.com/isaacs/npm/issues/2490)), I had to move my code into the `node_modules/sake` directory and add a `bundleDependencies` array to the `package.json` file.\n\nReport an Issue\n---------------\n\n* [Bugs](http://github.com/jhamlet/node-sake/issues)\n* Contact the author: <jhamlet@hamletink.com>\n\n\nLicense\n-------\n\n> Copyright (c) 2012 Jerry Hamlet <jerry@hamletink.com>\n> \n> Permission is hereby granted, free of charge, to any person\n> obtaining a copy of this software and associated documentation\n> files (the \"Software\"), to deal in the Software without\n> restriction, including without limitation the rights to use,\n> copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the\n> Software is furnished to do so, subject to the following\n> conditions:\n> \n> The above copyright notice and this permission notice shall be\n> included in all copies or substantial portions of the Software.\n> \n> The Software shall be used for Good, not Evil.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n> OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n> HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n> WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n> FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n> OTHER DEALINGS IN THE SOFTWARE.\n\n","maintainers":[{"name":"jhamlet","email":"jerry@hamletink.com"}],"directories":{}},"0.1.19":{"name":"sake","description":"[S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.","version":"0.1.19","keywords":["build","make","rake","jake"],"main":"./node_modules/sake/index.js","bin":{"sake":"./bin/sake"},"dependencies":{"nomnom":">=1.5.x","async":">=0.1.x","resolve":">=0.2.x","proteus":">=0.0.x","wordwrap":">=0.0.2","glob":">=2.1.x"},"devDependencies":{"mocha":">=0.3.x","should":">=0.5.x","underscore":">=1.3.x"},"bundleDependencies":["sake"],"scripts":{"test":"mocha test/test-*"},"licenses":[{"type":"MIT","url":"http://github.com/jhamlet/node-sake/raw/master/LICENSE"}],"repository":{"type":"git","url":"git://github.com/jhamlet/node-sake.git"},"bugs":{"url":"http://github.com/jhamlet/node-sake/issues"},"preferGlobal":true,"_npmUser":{"name":"jhamlet","email":"jerry@hamletink.com"},"_id":"sake@0.1.19","contributors":[{"name":"Jerry Hamlet","email":"jerry@hamletink.com"}],"optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.22","_nodeVersion":"v0.6.10","_defaultsLoaded":true,"dist":{"shasum":"ea0b6071d392a7f9a54f3d029b78664f7880075b","tarball":"https://registry.npmjs.org/sake/-/sake-0.1.19.tgz","integrity":"sha512-tl3cC8UXR92M2LpvthTIj3Yz9K4tuMvJd8tTcSwG3OsN2g/UA5qDXZ4II91sXuclvPYLRFMEHXfqjaOJ7Lsb2A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIESx95CcZlnnVU40xxqocPE5R2sOYrD9fWt0YIW74EWxAiA+j6QTRypq9O8h1RvpAe7epENn0mvLdNJdhHnyeZ7yRg=="}]},"readme":"\nSaké\n====\n\n> [S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.\n\n\nOverview\n--------\n\nThis package contains **saké**, a JavaScript build program that runs in node with capabilities similar to ruby's Rake.\n\nSaké has the following features:\n\n1.  `Sakefiles` (**saké’s** version of Rakefiles) are completely defined in standard JavaScript (or CoffeeScript, for those who want an even more Rake-like feel).\n2.  Flexible `FileLists` that act like arrays but know about manipulating file names and paths.\n3.  `clean` and `clobber` tasks are available for tidying up.\n4.  _Asynchronous_ task handling, with easy options for specifying _synchronous_ tasks.\n5.  Simple _namespacing_ of tasks to break projects into discreet parts.\n5.  Many utility methods for handling common build tasks (rm, rm_rf, mkdir, mkdir_p, sh, cat, etc...)\n\n\nInstallation\n------------\n\n### Install with npm\n\nDownload and install with the following:\n\n~~~\nnpm install -g sake\n~~~\n\nCommand-Line Usage\n------------------\n\n~~~\n% sake -h\n\nusage: sake [TASKNAME] [ARGUMENTS ...] [ENV=VALUE ...] [options]\n\n[TASKNAME]     Name of the task to run. Defaults to 'default'.\n[ARGUMENTS ...]     Zero or more arguments to pass to the task invoked.\n[ENV=VALUE ...]     Zero or more arguments to translate into environment variables.\n\noptions:\n   -f, --sakefile PATH       PATH to Sakefile to run instead of searching for one.\n   -T, --tasks [PATTERN]     List tasks with descriptions (optionally, just those\n                             matching PATTERN) and exit.\n   -P, --prereqs [PATTERN]   List tasks and their prerequisites (optionally, just\n                             those matching PATTERN) and exit.\n   -r, --require MODULE      Require MODULE before executing Sakefile and expose the\n                             MODULE under a sanitized namespace (i.e.: coffee-script\n                             => [sake.]coffeeScript). Can be specified multiple\n                             times.\n   -l, --sakelib PATH        Auto-include any .sake[.js|.coffeee] files in PATH.\n                             (default is 'sakelib'.) Can be specified multiple times\n   -n, --dry-run             Do a dry run without executing actions.\n   -C, --no-chdir            Do not change directory to the Sakefile location.\n   -N, --no-search           Do not search parent directories for a Sakefile.\n   -G, --no-system           Do not use SAKE_PATH environment variable to search for\n                             a Sakefile.\n   -S, --sync                Make all standard tasks 'synchronous' by default.\n   -d, --debug               Enable additional debugging output.\n   -q, --quiet               Suppress informational messages.\n   -V, --version             Print the version of sake and exit.\n   -h, --help                Print this help information and exit.\n\nIf a Sakefile is not specified, sake searches the current directory, and all parent\ndirectories, for one (unless -N, --no-search is set). Otherwise, if the SAKE_PATH\nenvironment variable is defined it searches those path(s) (unless -G, --no-system is\nset).\n\nIf specified, or found through normal searching (not in SAKE_PATH(s)), sake changes the\nprocess' current working directory to the directory of the found Sakefile (unless -C,\n--no-chdir is set), otherwise it stays where it was run from.\n\nSake then invokes the specified TASKNAME, or the \"default\" one.\n\nSakefile can be one of \"Sakefile\", or \"sakefile\", with an optional extension of \".js\",\nor \".coffee\".\n~~~\n\n### Dependencies ###\n\nThese are installed when **sake** is installed.\n\n~~~\nnomnom:   >=1.5.x\nasync:    >=0.1.x\nresolve:  >=0.2.x\nproteus:  >=0.0.x\nwordwrap: >=0.0.2\nglob:     >=2.1.x\n~~~\n\n\n### Development Dependencies ###\n\nInstalled when you run `npm link` in the package directory.\n\n~~~\nmocha:      >=0.3.x\nshould:     >=0.5.x\nunderscore: >=1.3.x\n~~~\n\n\nSakefile Usage\n--------------\n\nWithin a `Sakefile`, Saké's methods are exported to the global scope, so you can invoke them directly:\n\n~~~js\ntask(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n~~~\n    \nWithin another node module you can `require(\"sake\")` and access the methods on the exported object, or even run a block of code in the **saké** context (virtual machine):\n\n~~~js\nvar sake = require(\"sake\");\n    \nsake.task(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n\n// The function passed to sake#run is compiled and run in the sake context.\n// The function **will not** have access to any variables in this scope,\n// nor, will variables leak from the function's scope into this one.\nsake.run(function () {\n    var jsFiles = new FileList(\"src/js/**/*.js\");\n    \n    require(\"sake/clean\");\n    \n    task(\"script-min.js\", jsFiles, function (t) {\n        var cmd = \"infuse \" + jsFiles.map(function (path) {\n                return \"-i \" + path;\n            }) + \" -E\";\n            \n        sh(cmd, function (err, result) {\n            write(t.name, result, \"utf8\");\n            t.done();\n        })\n    });\n    \n    CLEAN.include(\"script-min.js\");\n});\n~~~\n\nThe remainder of this documentation will assume that we are calling the methods from within a `Sakefile`.\n\n\nDefining Tasks\n--------------\n\nThe various task methods take the following arguments:\n\n1.   `taskname`: `string` &mdash; naming the task\n2.   `prerequisites`: _optional_ \n    *   an `array` of:\n        *   `string` task name, or\n        *   a `FileLists`, or \n        *   a `function` that returns one of the above.\n    *   or, you can also pass a `FileList` in directly for `prerequisites`.\n3.   `action`: an _optional_ `function` that will be called when the task is invoked. It will be passed the task instance as its first argument, followed by any arguments that it was invoked with (either from the command-line, or through code). Task arguments can also be accessed through the instance's `arguments` property. i.e: `t.arguments`.\n\nAll task methods return the task *instance*.\n\nIf a task is already defined, it will be augmented by the additional arguments. So, this:\n\n~~~js\ntask(\"one\", [\"othertask\"], function (t) {\n    // do action one...\n    t.done();\n});\n\ntask(\"one\", function (t) {\n    // do action two...\n    t.done();\n});\n\ntask(\"othertask\");\n~~~\n\nWould result in a task \"othertask\" with no prerequisites, and no action, and a task \"one\" with \"othertask\" as a prerequisite and the two functions as its actions.\n\n**Note** how the dependent task was defined *after* it was required as a prerequisite. Task prerequisites are not resolved until the task is invoked. This leads to flexibility in how to compose your tasks and prerequisite tasks.\n\n\n### Task Instance Properties and Methods ###\n\n*   `name {string}` &mdash; the name of the task.\n*   `namespace {string}` &mdash; the task's namespace.\n*   `type {string}` &mdash; one of \"task\", \"file-task\", or \"file-create-task\"\n*   `fqn {string}` &mdash; the fully qualified name of the task. i.e: \"namespace:name\".\n*   `prerequisites {array}` &mdash; the list of prerequisite names for the task.\n*   `isNeeded {boolean}` &mdash; whether or not this task needs to run.\n*   `timestamp {boolean}` &mdash; the last modification time for the task.\n*   `invoke([args ...]) {Task}` &mdash; invoke the task passing args to each action for the task. Will run any prerequisites first. Returns the task instance.\n*   `execute([args ...]) {Task}` &mdash; Like `invoke`, but run the task even if it has already been run, or is not needed.\n*   `done()` &mdash; signal that the current task's action is done running.\n*   `abort([msg], [exitCode])` &mdash; abort the currently running task's actions, if _exitCode_ is specified **saké** will exit with that exit code and no other tasks will be processed. Otherwise, task processing will continue as normal.\n\n\n### Task Static Properties and Methods ###\n\n*   `namespace {string}` &mdash; the current namespace.\n*   `invoke(name, [rest ...]) {Task}` &mdash; invoke the named task and pass it the rest of the arguments.\n*   `get(name, [namespace]) {Task}` &mdash; get the task _name_, optionally start looking in _namespace_. Will throw an error if it can not find a task.\n*   `lookup(name, [namespace]) {Task|null}` &mdash; lookup a task with _name_, optionally start looking in _namespace_.\n*   `getAll() {array[Task]}` &mdash; return all defined tasks.\n*   `has(name, [namespace]) {boolean}` &mdash; does the task _name_ exist?\n*   `find(args, sortFn) {array[Task]}` &mdash; search for a task. _args_ can be an object with keys specifying which properties to match on, and their values denoting the value to match. _args_ can also be a function that accepts a task and returns a boolean whether or not that task matches.\n\n\nFile Tasks\n----------\n\nFile tasks are created with the (appropriately named) `file` method. File tasks are only triggered if the file doesn't exist, or the modification time of any of its prerequisites is newer than itself.\n\n~~~js\nfile(\"path/to/some/file\", function (t) {\n    cp(\"other/path\", t.name);\n    t.done();\n});\n~~~\n\nThe above task would only be triggered if `path/to/some/file` did not exist.\n\nThe following:\n\n~~~js\nfile(\"combined/file/path\", [\"pathA\", \"pathB\", \"pathC\"], function (t) {\n    write(t.name, cat(t.prerequisites), \"utf8\");\n    t.done();\n});\n~~~\n\nwould be triggered if `path/to/some/file` did not exist, or its modification time was earlier than any of its prerequisites (`pathA`, `pathB`, or  `pathC`).\n\n\nDirectory Tasks\n---------------\n\nDirectory tasks, created with the `directory` method, are tasks that will only be called if they do not exist. A task will be created for the named directory (and for all directories along the way) with the action of creating the directory.\n\nDirectory tasks do not take any `prerequisites` or an `action` when first defined, however, they may be augmented with such after they are created:\n\n~~~js\ndirectory(\"dir/path/to/create\");\n\ntask(\"dir/path/to/create\", [\"othertask\"], action (t) {\n    //... do stuff\n    t.done();\n});\n~~~\n\n\nFile Create Tasks\n-----------------\n\nA file create task is a file task, that when used as a prerequisite, will be needed if, and only if, the file has not been created. Once created, it is not re-triggered if any of its prerequisites are newer, nor does it trigger any rebuilds of tasks that depend on it whenever the file is updated.\n\n~~~js\nfileCreate(\"file/path/to/create.ext\", [\"pathA\", \"pathB\"], function (t) {\n    // create file...\n    t.done();\n});\n~~~\n\n\n(A)Synchronicity and Tasks\n--------------------------\n\nIn **saké** all task actions are assumed to be *asynchronous* and an action must call its task's `done` method to tell **saké** that it is done processing stuff.\n\n~~~js\ntask(\"long task\", function (t) {\n    sh(\"some long running shell command\", function (err, result) {\n        // do stuff...\n        t.done();\n    });\n});\n~~~\n\nAlternatively, you can use the `Sync` version of a task to add a *synchronous* action, and `done` will be called for you after the function completes.\n\n~~~js\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n~~~\n\nThere are `Sync` versions of all the core tasks: `taskSync`, `fileSync`, and `fileCreateSync`. There are also `Async` versions of each task: `taskAsync`, `fileAsync`, and `fileCreateAsync`. The actions created for a `directory` task are *synchronous*. You can add *asynchronous* task actions after the initial definition.\n\nThirdly, you can specify that all of the core task creation functions generate *synchronous* actions by setting **saké's** \"sync\" option to `true`, or by use of the command-line option `-S, --sync`.\n\n~~~js\nsake.options.sync = true;\n\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n\n//... define more synchronous tasks\n\n//... and then revert to async\nsake.options.sync = false;\n~~~\n\nUltimately, it is up to the **saké** script author to correctly designate a task action as *synchronous* or *asynchronous*. Nothing prevents the running of an *asynchronous* function within a task's *synchronous* action. If nothing is dependent on the result of that action, then no problem would occur. It's when other tasks rely on the completion of certain *asynchronous* actions, that problems may arise.\n\nIn the case of *asynchronous* actions, **Saké** will issue a `WARNING` when it can not detect a `done()` call within that action.\n\n\nNamespaces\n----------\n\n**Saké** supports simple name spacing of tasks. Simply prepend the namespace before the task name with a colon \":\". This can be done when defining a task, or in the list of prerequisites for a task.\n\n~~~js\n// Defines a task 'fuz' in the namespace 'foo' that depends on the task 'buz'\n// in the namespace 'baz'\ntask(\"foo:fuz\", [\"baz:buz\"], function (t) {\n    //...\n    t.done();\n});\n~~~\n\nThen invoke the task as so:\n\n~~~\n% sake foo:fuz\n~~~\n\nYou can also use the convenience function `namespace` to wrap your task definitions for a particular namespace. Any _namespace naked_ definitions will first be tried in the local namespace, otherwise they will fall-back to the default namespace:\n\n~~~js\n\ntask(\"default\", function (t) {\n    //...\n    t.done():\n});\n\ntask(\"bazil\", function (t) {\n    //...\n    t.done():\n});\n\n// define within the 'foo' namespace\nnamespace(\"foo\", function () {\n    \n    // defines 'foo:foom' task\n    task(\"foom\", function (t) {\n        //...\n        t.done():\n    });\n    \n});\n\nnamespace(\"baz\", function () {\n    \n    // this task is defined in the 'baz' namespace, and depends on the\n    // 'foom' task from the 'foo' namespace\n    task(\"bazil\", [\"foo:foom\"], function (t) {\n        //...\n        t.done():\n    });\n    // This task is also defined in the 'baz' namespace. It depends on \n    // the 'bazil' task, which is also defined in 'baz' namespace. It\n    // also depends on the 'default' task in the 'default' (top-level)\n    // namespace.\n    task(\"buzil\", [\"bazil\", \"default\"], function (t), {\n        //...\n        t.done():\n    });\n    // If 'bazil' wasn't defined in the 'baz' namespace, it would resolve\n    // to the 'default' namespace task.\n});\n~~~\n\n**Note:** prerequisite names are tied to the defined task's namespace. i.e: If a task \"foo:fuz\" depends on \"foom\" **saké** will look in the \"foo\" namespace for \"foom\", and then the \"default\" namespace.\n\n**Note:** although the `namespace` functions can be nested, **saké** does not track the hierarchy of `namespace` calls -- if a dependent task is not found in the current task's namespace, it will look for it in the default namespace.\n\n\nPassing Arguments to A Task\n---------------------------\n\nThere are two ways to pass arguments to a task.\n\nFirst, **saké** translates any arguments in the form of `ENV=VALUE` on the command-line into `process.env` values:\n\n~~~\n% sake build BUILD_TYPE=debug ENVIRONMENT=prod\n~~~\n\nWill set `process.env.BUILD_TYPE` to \"debug\" and `process.env.ENVIRONMENT` to \"prod\". The values are JSON parsed; so the values are translated into real JavaScript values (numbers, true, false, etc...).\n\nSecondly, **saké** passes all non-option, and non-ENV=VALUE, looking arguments from the command-line to the invoked task:\n\n~~~\n% sake foo 3.14 pie true\n~~~\n\nWill invoke the \"foo\" task and pass to each of foo's actions (after the task instance itself) `3.14`, \"pie\" and `true`. The arguments are also JSON parsed to get real JavaScript values.\n\n~~~js\ntask(\"foo\", function (t, amt, word, flag) {\n    log(amt);   // => 3.14\n    log(word);  // => \"pie\"\n    log(flag);  // => true\n});\n~~~\n\n**Note:** This differs from how **rake**, and **jake** do things. In **saké** you can only invoke one task on the command-line. All other arguments on the command-line are considered task arguments.\n\n\nIncluding Other Saké Files\n-------------------------------------\n\nYou can include other **saké** files with the `include` and `load` methods. The included files will be run in the **saké** context, so any variables they do not declare with the `var` keyword will be set on the global **saké** context. This allows you to break your project build files up into discreet files.\n\nAll `require` and `include`, or `load` statements, are resolved relative to the current file, so you can create your own hierarchy of build dependencies.\n\nYou can also add your own paths to the list of ones that **saké** uses to resolve `requires`: `[sake.]includePaths` is an array of directory paths to search. They are tried in reverse order, so if you push a path on to the array that path will be tried first, followed by any others.\n\n~~~js\n// in a Sakefile\nincludePaths.push(\"some/path\");\n\nrequire(\"some-module\"); // will be tried in some/path/some-module.js\n~~~\n\nAlso, the `__dirname` and `__filename` properties are available in `included` files to help resolve local includes.\n\n~~~js\nvar Path = require(\"path\");\n\ninclude(Path.join(__dirname, \"include-dir/include-file\"));\n~~~\n\nSake Library\n------------\n\n**Saké** will load any `.sake`, `.sake.js`, or `.sake.coffee` files located in a `sakelib` directory relative to the `Sakefile` being run. This directory name can be modified with the `-l, --sakelib` option, and multiple directories can be specified. This allows you to re-use common tasks across multiple projects.\n\n\nFile Lists\n----------\n\nFileLists are lists of file paths.\n\n~~~js\nnew FileList(\"*.scss\");\n~~~\n\nWould contain all the file paths with a \".scss\" extension in the top-level directory of your project.\n\nYou can use FileLists pretty much like an `Array`. You can iterate them (with `forEach, filter, reduce`, etc...), `concat` them, `splice` them, and you get back a new FileList object.\n\nTo add files, or glob patterns to them, use the `#include` method:\n\n~~~js\nvar fl = new FileList(\"*.scss\");\nfl.include(\"core.css\", \"reset.css\", \"*.css\");\n~~~\n\nYou can also `exlucude` files by Glob pattern, `Regular Expression` pattern, or by use of a `function` that takes the file path as an argument and returns a `truthy` value to exclude a file.\n\n~~~js\n// Exclude by RegExp\nfl.exclude(/^dev-.*\\.css/);\n\n// Exclude by Glob pattern\nfl.exclude(\"dev-*.css\");\n\n// Exclude by function\nfl.exclude(function (path) {\n    return FS.statSync(path).mtime.getTime() < (Date.now() - 60 * 60 * 1000);\n});\n~~~\n\nTo get to the actual items of the FileList, use the `#items` property, or the `#toArray` method, to get a plain array back. You can also use the `#get` or `#set` methods to retrieve or set an item.\n\nFileLists are *lazy*, in that the actual file paths are not determined from the include and exclude patterns until the individual items are requested. This allows you to define a FileList and incrementally add patterns to it in the Sakefile file. The FileList paths will not be resolved until the task that uses it as a prerequisite actually asks for the final paths.\n\n\n### FileList Properties & Methods ###\n\n*   `existing` &mdash; will return a new `FileList` with all of the files that actually exist.\n*   `notExisting` &mdash; will return a new `FileList` of all the files that do not exist.\n*   `extension(ext)` &mdash; returns a new `FileList` with all paths that match the given extension.\n\n~~~js\nfl.extension(\".scss\").forEach(function (path) {\n    //...\n});\n~~~\n\n*   `grep(pattern)` &mdash; get a `FileList` of all the files that match the given `pattern`. `pattern` can be a plain `String`, a `Glob` pattern, a `RegExp`, or a `function` that receives each path and can return a truthy value to include it.\n*   `clearExcludes()` &mdash; clear all exclude patterns/functions.\n*   `clearIncludes()` &mdash; clear all include patterns.\n\nBy default, a `FileList` excludes directories. To allow directories call `FileList#clearExcludes()` before requesting any items.\n\n\nThe \"clean\" and \"clobber\" Tasks, and The CLEAN and CLOBBER FileLists\n--------------------------------------------------------------------\n\nWithin a `Sakefile`:\n\n~~~js\n// defines the CLEAN FileList and 'clean' task\nrequire(\"sake/clean\");\n\n// defines the above, and also the CLOBBER FileTask and 'clobber' task\nrequire(\"sake/clobber\");\n~~~\n\nWhen the \"clean\" task is run, it will remove any files that have been included in the `CLEAN FileList`. \"clobber\" will remove any file, or directory, included in the `CLOBBER FileList`.\n\n\nSaké Utility Functions\n----------------------\n\nSaké defines a few utility functions to make life a little easier in an asynchronous world. Most of these are just wrappers for `node`'s File System (`require(\"fs\")`) utility methods.\n\n### Synchronous Utilities ###\n\n*   `mkdir(dirpath, mode=\"777\")` &mdash; create the `dirpath` directory, if it doesn't already exist.\n*   `mkdir_p(dirpath, mode=\"777\"])` &mdash; as above, but create all intermediate directories as needed.\n*   `rm(path, [path1, ..., pathN])` &mdash; remove one or more paths from the file system.\n*   `rm_rf(path, [path1, ..., pathN])` &mdash; as above, and remove directories and their contents.\n*   `cp(from, to)` &mdash; copy a file from `from` path to `to` path.\n*   `cp_r(from, to)` &mdash; copy all files from `from` path to `to` path.\n*   `mv(from, to)` &mdash; move a file from `from` path to `to` path.\n*   `ln(from, to)` &mdash; create a hard link from `from` path to `to` path.\n*   `ln_s(from, to)` &mdash; create a symlink from `from` path to `to` path.\n*   `cat(path, [path1, ..., pathN]) {string}` &mdash; read all supplied paths and return their contents as a string. If an argument is an `Array` it will be expanded and those paths will be read.\n*   `readdir(path) {array[string]}` &mdash; returns the files of directory `path`.\n*   `read(path, [enc]) {string|Buffer}` &mdash; read the supplied file path. Returns a `buffer`, or a `string` if `enc` is given.\n*   `write(path, data, [enc], mode=\"w\")` &mdash; write the `data` to the supplied file `path`. `data` should be a `buffer` or a `string` if `enc` is given. `mode` is a `string` of either \"w\", for over write,  or \"a\" for append.\n*   `slurp(path, [env]) {sring|Buffer}` &mdash; alias for `read`\n*   `spit(path, data, [enc], mode=\"w\")` &mdash; alias for `write`\n\n\n### Asynchronous Utilities ###\n\n*   `sh(cmd, fn(error, result))` &mdash; execute shell `cmd`. In the callback function, `error` will be a truthy value if there was an error, and `result` will contain the STDERR returned from `cmd`. Otherwise, `result` will contain the STDOUT from the `cmd`. If `cmd` is an array of shell commands, each one will be run before the next, and only when they all complete, or an error is encountered, will the callback `fn` be called, and `result` be an array of the results of the individual commands.\n\n\nDeveloper Notes\n---------------\n\n*   Due to an issue with npm v1.1.13 and up (see issue [#2490](https://github.com/isaacs/npm/issues/2490)), I had to move my code into the `node_modules/sake` directory and add a `bundleDependencies` array to the `package.json` file.\n\nReport an Issue\n---------------\n\n* [Bugs](http://github.com/jhamlet/node-sake/issues)\n* Contact the author: <jhamlet@hamletink.com>\n\n\nLicense\n-------\n\n> Copyright (c) 2012 Jerry Hamlet <jerry@hamletink.com>\n> \n> Permission is hereby granted, free of charge, to any person\n> obtaining a copy of this software and associated documentation\n> files (the \"Software\"), to deal in the Software without\n> restriction, including without limitation the rights to use,\n> copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the\n> Software is furnished to do so, subject to the following\n> conditions:\n> \n> The above copyright notice and this permission notice shall be\n> included in all copies or substantial portions of the Software.\n> \n> The Software shall be used for Good, not Evil.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n> OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n> HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n> WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n> FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n> OTHER DEALINGS IN THE SOFTWARE.\n\n","maintainers":[{"name":"jhamlet","email":"jerry@hamletink.com"}],"directories":{}},"0.1.20":{"name":"sake","description":"[S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.","version":"0.1.20","keywords":["build","make","rake","jake"],"main":"./node_modules/sake/index.js","bin":{"sake":"./bin/sake"},"dependencies":{"nomnom":">=1.5.x","async":">=0.1.x","resolve":">=0.2.x","proteus":">=0.0.x","wordwrap":">=0.0.2","glob":">=3.1.x","minimatch":">=0.2.x"},"devDependencies":{"mocha":">=0.3.x","should":">=0.5.x","underscore":">=1.3.x"},"bundleDependencies":["sake"],"scripts":{"test":"mocha test/test-*"},"licenses":[{"type":"MIT","url":"http://github.com/jhamlet/node-sake/raw/master/LICENSE"}],"repository":{"type":"git","url":"git://github.com/jhamlet/node-sake.git"},"bugs":{"url":"http://github.com/jhamlet/node-sake/issues"},"preferGlobal":true,"_npmUser":{"name":"jhamlet","email":"jerry@hamletink.com"},"_id":"sake@0.1.20","contributors":[{"name":"Jerry Hamlet","email":"jerry@hamletink.com"}],"optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.22","_nodeVersion":"v0.6.10","_defaultsLoaded":true,"dist":{"shasum":"f8015b31d7f33850e54df7efcd24c7d3202df450","tarball":"https://registry.npmjs.org/sake/-/sake-0.1.20.tgz","integrity":"sha512-/3Rya4h+GT6oXROf1mOthAi5+u5RmHc2vOTEdXT+LLIErb3ysfZYUZwJNK+6tBC/MSpek9PRKmf44i7Fom73OA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCRv8I2kOG5slBsWaL+4jeeb54x6+tk9xfJMf8pkkbQBAIhAONjGQOWCPyWIrMoeK6p1EqNKE8w2FGC0jqfNpqxJass"}]},"readme":"\nSaké\n====\n\n> [S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.\n\n\nOverview\n--------\n\nThis package contains **saké**, a JavaScript build program that runs in node with capabilities similar to ruby's Rake.\n\nSaké has the following features:\n\n1.  `Sakefiles` (**saké’s** version of Rakefiles) are completely defined in standard JavaScript (or CoffeeScript, for those who want an even more Rake-like feel).\n2.  Flexible `FileLists` that act like arrays but know about manipulating file names and paths.\n3.  `clean` and `clobber` tasks are available for tidying up.\n4.  _Asynchronous_ task handling, with easy options for specifying _synchronous_ tasks.\n5.  Simple _namespacing_ of tasks to break projects into discreet parts.\n5.  Many utility methods for handling common build tasks (rm, rm_rf, mkdir, mkdir_p, sh, cat, etc...)\n\n\nInstallation\n------------\n\n### Install with npm\n\nDownload and install with the following:\n\n~~~\nnpm install -g sake\n~~~\n\nCommand-Line Usage\n------------------\n\n~~~\n% sake -h\n\nusage: sake [TASKNAME] [ARGUMENTS ...] [ENV=VALUE ...] [options]\n\n[TASKNAME]     Name of the task to run. Defaults to 'default'.\n[ARGUMENTS ...]     Zero or more arguments to pass to the task invoked.\n[ENV=VALUE ...]     Zero or more arguments to translate into environment variables.\n\noptions:\n   -f, --sakefile PATH       PATH to Sakefile to run instead of searching for one.\n   -T, --tasks [PATTERN]     List tasks with descriptions (optionally, just those\n                             matching PATTERN) and exit.\n   -P, --prereqs [PATTERN]   List tasks and their prerequisites (optionally, just\n                             those matching PATTERN) and exit.\n   -r, --require MODULE      Require MODULE before executing Sakefile and expose the\n                             MODULE under a sanitized namespace (i.e.: coffee-script\n                             => [sake.]coffeeScript). Can be specified multiple\n                             times.\n   -l, --sakelib PATH        Auto-include any .sake[.js|.coffeee] files in PATH.\n                             (default is 'sakelib'.) Can be specified multiple times\n   -n, --dry-run             Do a dry run without executing actions.\n   -C, --no-chdir            Do not change directory to the Sakefile location.\n   -N, --no-search           Do not search parent directories for a Sakefile.\n   -G, --no-system           Do not use SAKE_PATH environment variable to search for\n                             a Sakefile.\n   -S, --sync                Make all standard tasks 'synchronous' by default.\n   -d, --debug               Enable additional debugging output.\n   -q, --quiet               Suppress informational messages.\n   -V, --version             Print the version of sake and exit.\n   -h, --help                Print this help information and exit.\n\nIf a Sakefile is not specified, sake searches the current directory, and all parent\ndirectories, for one (unless -N, --no-search is set). Otherwise, if the SAKE_PATH\nenvironment variable is defined it searches those path(s) (unless -G, --no-system is\nset).\n\nIf specified, or found through normal searching (not in SAKE_PATH(s)), sake changes the\nprocess' current working directory to the directory of the found Sakefile (unless -C,\n--no-chdir is set), otherwise it stays where it was run from.\n\nSake then invokes the specified TASKNAME, or the \"default\" one.\n\nSakefile can be one of \"Sakefile\", or \"sakefile\", with an optional extension of \".js\",\nor \".coffee\".\n~~~\n\n### Dependencies ###\n\nThese are installed when **sake** is installed.\n\n~~~\nnomnom:   >=1.5.x\nasync:    >=0.1.x\nresolve:  >=0.2.x\nproteus:  >=0.0.x\nwordwrap: >=0.0.2\nglob:     >=2.1.x\n~~~\n\n\n### Development Dependencies ###\n\nInstalled when you run `npm link` in the package directory.\n\n~~~\nmocha:      >=0.3.x\nshould:     >=0.5.x\nunderscore: >=1.3.x\n~~~\n\n\nSakefile Usage\n--------------\n\nWithin a `Sakefile`, Saké's methods are exported to the global scope, so you can invoke them directly:\n\n~~~js\ntask(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n~~~\n    \nWithin another node module you can `require(\"sake\")` and access the methods on the exported object, or even run a block of code in the **saké** context (virtual machine):\n\n~~~js\nvar sake = require(\"sake\");\n    \nsake.task(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n\n// The function passed to sake#run is compiled and run in the sake context.\n// The function **will not** have access to any variables in this scope,\n// nor, will variables leak from the function's scope into this one.\nsake.run(function () {\n    var jsFiles = new FileList(\"src/js/**/*.js\");\n    \n    require(\"sake/clean\");\n    \n    task(\"script-min.js\", jsFiles, function (t) {\n        var cmd = \"infuse \" + jsFiles.map(function (path) {\n                return \"-i \" + path;\n            }) + \" -E\";\n            \n        sh(cmd, function (err, result) {\n            write(t.name, result, \"utf8\");\n            t.done();\n        })\n    });\n    \n    CLEAN.include(\"script-min.js\");\n});\n~~~\n\nThe remainder of this documentation will assume that we are calling the methods from within a `Sakefile`.\n\n\nDefining Tasks\n--------------\n\nThe various task methods take the following arguments:\n\n1.   `taskname`: `string` &mdash; naming the task\n2.   `prerequisites`: _optional_ \n    *   an `array` of:\n        *   `string` task name, or\n        *   a `FileLists`, or \n        *   a `function` that returns one of the above.\n    *   or, you can also pass a `FileList` in directly for `prerequisites`.\n3.   `action`: an _optional_ `function` that will be called when the task is invoked. It will be passed the task instance as its first argument, followed by any arguments that it was invoked with (either from the command-line, or through code). Task arguments can also be accessed through the instance's `arguments` property. i.e: `t.arguments`.\n\nAll task methods return the task *instance*.\n\nIf a task is already defined, it will be augmented by the additional arguments. So, this:\n\n~~~js\ntask(\"one\", [\"othertask\"], function (t) {\n    // do action one...\n    t.done();\n});\n\ntask(\"one\", function (t) {\n    // do action two...\n    t.done();\n});\n\ntask(\"othertask\");\n~~~\n\nWould result in a task \"othertask\" with no prerequisites, and no action, and a task \"one\" with \"othertask\" as a prerequisite and the two functions as its actions.\n\n**Note** how the dependent task was defined *after* it was required as a prerequisite. Task prerequisites are not resolved until the task is invoked. This leads to flexibility in how to compose your tasks and prerequisite tasks.\n\n\n### Task Instance Properties and Methods ###\n\n*   `name {string}` &mdash; the name of the task.\n*   `namespace {string}` &mdash; the task's namespace.\n*   `type {string}` &mdash; one of \"task\", \"file-task\", or \"file-create-task\"\n*   `fqn {string}` &mdash; the fully qualified name of the task. i.e: \"namespace:name\".\n*   `prerequisites {array}` &mdash; the list of prerequisite names for the task.\n*   `isNeeded {boolean}` &mdash; whether or not this task needs to run.\n*   `timestamp {boolean}` &mdash; the last modification time for the task.\n*   `invoke([args ...]) {Task}` &mdash; invoke the task passing args to each action for the task. Will run any prerequisites first. Returns the task instance.\n*   `execute([args ...]) {Task}` &mdash; Like `invoke`, but run the task even if it has already been run, or is not needed.\n*   `done()` &mdash; signal that the current task's action is done running.\n*   `abort([msg], [exitCode])` &mdash; abort the currently running task's actions, if _exitCode_ is specified **saké** will exit with that exit code and no other tasks will be processed. Otherwise, task processing will continue as normal.\n\n\n### Task Static Properties and Methods ###\n\n*   `namespace {string}` &mdash; the current namespace.\n*   `invoke(name, [rest ...]) {Task}` &mdash; invoke the named task and pass it the rest of the arguments.\n*   `get(name, [namespace]) {Task}` &mdash; get the task _name_, optionally start looking in _namespace_. Will throw an error if it can not find a task.\n*   `lookup(name, [namespace]) {Task|null}` &mdash; lookup a task with _name_, optionally start looking in _namespace_.\n*   `getAll() {array[Task]}` &mdash; return all defined tasks.\n*   `has(name, [namespace]) {boolean}` &mdash; does the task _name_ exist?\n*   `find(args, sortFn) {array[Task]}` &mdash; search for a task. _args_ can be an object with keys specifying which properties to match on, and their values denoting the value to match. _args_ can also be a function that accepts a task and returns a boolean whether or not that task matches.\n\n\nFile Tasks\n----------\n\nFile tasks are created with the (appropriately named) `file` method. File tasks are only triggered if the file doesn't exist, or the modification time of any of its prerequisites is newer than itself.\n\n~~~js\nfile(\"path/to/some/file\", function (t) {\n    cp(\"other/path\", t.name);\n    t.done();\n});\n~~~\n\nThe above task would only be triggered if `path/to/some/file` did not exist.\n\nThe following:\n\n~~~js\nfile(\"combined/file/path\", [\"pathA\", \"pathB\", \"pathC\"], function (t) {\n    write(t.name, cat(t.prerequisites), \"utf8\");\n    t.done();\n});\n~~~\n\nwould be triggered if `path/to/some/file` did not exist, or its modification time was earlier than any of its prerequisites (`pathA`, `pathB`, or  `pathC`).\n\n\nDirectory Tasks\n---------------\n\nDirectory tasks, created with the `directory` method, are tasks that will only be called if they do not exist. A task will be created for the named directory (and for all directories along the way) with the action of creating the directory.\n\nDirectory tasks do not take any `prerequisites` or an `action` when first defined, however, they may be augmented with such after they are created:\n\n~~~js\ndirectory(\"dir/path/to/create\");\n\ntask(\"dir/path/to/create\", [\"othertask\"], action (t) {\n    //... do stuff\n    t.done();\n});\n~~~\n\n\nFile Create Tasks\n-----------------\n\nA file create task is a file task, that when used as a prerequisite, will be needed if, and only if, the file has not been created. Once created, it is not re-triggered if any of its prerequisites are newer, nor does it trigger any rebuilds of tasks that depend on it whenever the file is updated.\n\n~~~js\nfileCreate(\"file/path/to/create.ext\", [\"pathA\", \"pathB\"], function (t) {\n    // create file...\n    t.done();\n});\n~~~\n\n\n(A)Synchronicity and Tasks\n--------------------------\n\nIn **saké** all task actions are assumed to be *asynchronous* and an action must call its task's `done` method to tell **saké** that it is done processing stuff.\n\n~~~js\ntask(\"long task\", function (t) {\n    sh(\"some long running shell command\", function (err, result) {\n        // do stuff...\n        t.done();\n    });\n});\n~~~\n\nAlternatively, you can use the `Sync` version of a task to add a *synchronous* action, and `done` will be called for you after the function completes.\n\n~~~js\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n~~~\n\nThere are `Sync` versions of all the core tasks: `taskSync`, `fileSync`, and `fileCreateSync`. There are also `Async` versions of each task: `taskAsync`, `fileAsync`, and `fileCreateAsync`. The actions created for a `directory` task are *synchronous*. You can add *asynchronous* task actions after the initial definition.\n\nThirdly, you can specify that all of the core task creation functions generate *synchronous* actions by setting **saké's** \"sync\" option to `true`, or by use of the command-line option `-S, --sync`.\n\n~~~js\nsake.options.sync = true;\n\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n\n//... define more synchronous tasks\n\n//... and then revert to async\nsake.options.sync = false;\n~~~\n\nUltimately, it is up to the **saké** script author to correctly designate a task action as *synchronous* or *asynchronous*. Nothing prevents the running of an *asynchronous* function within a task's *synchronous* action. If nothing is dependent on the result of that action, then no problem would occur. It's when other tasks rely on the completion of certain *asynchronous* actions, that problems may arise.\n\nIn the case of *asynchronous* actions, **Saké** will issue a `WARNING` when it can not detect a `done()` call within that action.\n\n\nNamespaces\n----------\n\n**Saké** supports simple name spacing of tasks. Simply prepend the namespace before the task name with a colon \":\". This can be done when defining a task, or in the list of prerequisites for a task.\n\n~~~js\n// Defines a task 'fuz' in the namespace 'foo' that depends on the task 'buz'\n// in the namespace 'baz'\ntask(\"foo:fuz\", [\"baz:buz\"], function (t) {\n    //...\n    t.done();\n});\n~~~\n\nThen invoke the task as so:\n\n~~~\n% sake foo:fuz\n~~~\n\nYou can also use the convenience function `namespace` to wrap your task definitions for a particular namespace. Any _namespace naked_ definitions will first be tried in the local namespace, otherwise they will fall-back to the default namespace:\n\n~~~js\n\ntask(\"default\", function (t) {\n    //...\n    t.done():\n});\n\ntask(\"bazil\", function (t) {\n    //...\n    t.done():\n});\n\n// define within the 'foo' namespace\nnamespace(\"foo\", function () {\n    \n    // defines 'foo:foom' task\n    task(\"foom\", function (t) {\n        //...\n        t.done():\n    });\n    \n});\n\nnamespace(\"baz\", function () {\n    \n    // this task is defined in the 'baz' namespace, and depends on the\n    // 'foom' task from the 'foo' namespace\n    task(\"bazil\", [\"foo:foom\"], function (t) {\n        //...\n        t.done():\n    });\n    // This task is also defined in the 'baz' namespace. It depends on \n    // the 'bazil' task, which is also defined in 'baz' namespace. It\n    // also depends on the 'default' task in the 'default' (top-level)\n    // namespace.\n    task(\"buzil\", [\"bazil\", \"default\"], function (t), {\n        //...\n        t.done():\n    });\n    // If 'bazil' wasn't defined in the 'baz' namespace, it would resolve\n    // to the 'default' namespace task.\n});\n~~~\n\n**Note:** prerequisite names are tied to the defined task's namespace. i.e: If a task \"foo:fuz\" depends on \"foom\" **saké** will look in the \"foo\" namespace for \"foom\", and then the \"default\" namespace.\n\n**Note:** although the `namespace` functions can be nested, **saké** does not track the hierarchy of `namespace` calls -- if a dependent task is not found in the current task's namespace, it will look for it in the default namespace.\n\n\nPassing Arguments to A Task\n---------------------------\n\nThere are two ways to pass arguments to a task.\n\nFirst, **saké** translates any arguments in the form of `ENV=VALUE` on the command-line into `process.env` values:\n\n~~~\n% sake build BUILD_TYPE=debug ENVIRONMENT=prod\n~~~\n\nWill set `process.env.BUILD_TYPE` to \"debug\" and `process.env.ENVIRONMENT` to \"prod\". The values are JSON parsed; so the values are translated into real JavaScript values (numbers, true, false, etc...).\n\nSecondly, **saké** passes all non-option, and non-ENV=VALUE, looking arguments from the command-line to the invoked task:\n\n~~~\n% sake foo 3.14 pie true\n~~~\n\nWill invoke the \"foo\" task and pass to each of foo's actions (after the task instance itself) `3.14`, \"pie\" and `true`. The arguments are also JSON parsed to get real JavaScript values.\n\n~~~js\ntask(\"foo\", function (t, amt, word, flag) {\n    log(amt);   // => 3.14\n    log(word);  // => \"pie\"\n    log(flag);  // => true\n});\n~~~\n\n**Note:** This differs from how **rake**, and **jake** do things. In **saké** you can only invoke one task on the command-line. All other arguments on the command-line are considered task arguments.\n\n\nIncluding Other Saké Files\n-------------------------------------\n\nYou can include other **saké** files with the `include` and `load` methods. The included files will be run in the **saké** context, so any variables they do not declare with the `var` keyword will be set on the global **saké** context. This allows you to break your project build files up into discreet files.\n\nAll `require` and `include`, or `load` statements, are resolved relative to the current file, so you can create your own hierarchy of build dependencies.\n\nYou can also add your own paths to the list of ones that **saké** uses to resolve `requires`: `[sake.]includePaths` is an array of directory paths to search. They are tried in reverse order, so if you push a path on to the array that path will be tried first, followed by any others.\n\n~~~js\n// in a Sakefile\nincludePaths.push(\"some/path\");\n\nrequire(\"some-module\"); // will be tried in some/path/some-module.js\n~~~\n\nAlso, the `__dirname` and `__filename` properties are available in `included` files to help resolve local includes.\n\n~~~js\nvar Path = require(\"path\");\n\ninclude(Path.join(__dirname, \"include-dir/include-file\"));\n~~~\n\nSake Library\n------------\n\n**Saké** will load any `.sake`, `.sake.js`, or `.sake.coffee` files located in a `sakelib` directory relative to the `Sakefile` being run. This directory name can be modified with the `-l, --sakelib` option, and multiple directories can be specified. This allows you to re-use common tasks across multiple projects.\n\n\nFile Lists\n----------\n\nFileLists are lists of file paths.\n\n~~~js\nnew FileList(\"*.scss\");\n~~~\n\nWould contain all the file paths with a \".scss\" extension in the top-level directory of your project.\n\nYou can use FileLists pretty much like an `Array`. You can iterate them (with `forEach, filter, reduce`, etc...), `concat` them, `splice` them, and you get back a new FileList object.\n\nTo add files, or glob patterns to them, use the `#include` method:\n\n~~~js\nvar fl = new FileList(\"*.scss\");\nfl.include(\"core.css\", \"reset.css\", \"*.css\");\n~~~\n\nYou can also `exlucude` files by Glob pattern, `Regular Expression` pattern, or by use of a `function` that takes the file path as an argument and returns a `truthy` value to exclude a file.\n\n~~~js\n// Exclude by RegExp\nfl.exclude(/^dev-.*\\.css/);\n\n// Exclude by Glob pattern\nfl.exclude(\"dev-*.css\");\n\n// Exclude by function\nfl.exclude(function (path) {\n    return FS.statSync(path).mtime.getTime() < (Date.now() - 60 * 60 * 1000);\n});\n~~~\n\nTo get to the actual items of the FileList, use the `#items` property, or the `#toArray` method, to get a plain array back. You can also use the `#get` or `#set` methods to retrieve or set an item.\n\nFileLists are *lazy*, in that the actual file paths are not determined from the include and exclude patterns until the individual items are requested. This allows you to define a FileList and incrementally add patterns to it in the Sakefile file. The FileList paths will not be resolved until the task that uses it as a prerequisite actually asks for the final paths.\n\n\n### FileList Properties & Methods ###\n\n*   `existing` &mdash; will return a new `FileList` with all of the files that actually exist.\n*   `notExisting` &mdash; will return a new `FileList` of all the files that do not exist.\n*   `extension(ext)` &mdash; returns a new `FileList` with all paths that match the given extension.\n\n~~~js\nfl.extension(\".scss\").forEach(function (path) {\n    //...\n});\n~~~\n\n*   `grep(pattern)` &mdash; get a `FileList` of all the files that match the given `pattern`. `pattern` can be a plain `String`, a `Glob` pattern, a `RegExp`, or a `function` that receives each path and can return a truthy value to include it.\n*   `clearExcludes()` &mdash; clear all exclude patterns/functions.\n*   `clearIncludes()` &mdash; clear all include patterns.\n\nBy default, a `FileList` excludes directories. To allow directories call `FileList#clearExcludes()` before requesting any items.\n\n\nThe \"clean\" and \"clobber\" Tasks, and The CLEAN and CLOBBER FileLists\n--------------------------------------------------------------------\n\nWithin a `Sakefile`:\n\n~~~js\n// defines the CLEAN FileList and 'clean' task\nrequire(\"sake/clean\");\n\n// defines the above, and also the CLOBBER FileTask and 'clobber' task\nrequire(\"sake/clobber\");\n~~~\n\nWhen the \"clean\" task is run, it will remove any files that have been included in the `CLEAN FileList`. \"clobber\" will remove any file, or directory, included in the `CLOBBER FileList`.\n\n\nSaké Utility Functions\n----------------------\n\nSaké defines a few utility functions to make life a little easier in an asynchronous world. Most of these are just wrappers for `node`'s File System (`require(\"fs\")`) utility methods.\n\n### Synchronous Utilities ###\n\n*   `mkdir(dirpath, mode=\"777\")` &mdash; create the `dirpath` directory, if it doesn't already exist.\n*   `mkdir_p(dirpath, mode=\"777\"])` &mdash; as above, but create all intermediate directories as needed.\n*   `rm(path, [path1, ..., pathN])` &mdash; remove one or more paths from the file system.\n*   `rm_rf(path, [path1, ..., pathN])` &mdash; as above, and remove directories and their contents.\n*   `cp(from, to)` &mdash; copy a file from `from` path to `to` path.\n*   `cp_r(from, to)` &mdash; copy all files from `from` path to `to` path.\n*   `mv(from, to)` &mdash; move a file from `from` path to `to` path.\n*   `ln(from, to)` &mdash; create a hard link from `from` path to `to` path.\n*   `ln_s(from, to)` &mdash; create a symlink from `from` path to `to` path.\n*   `cat(path, [path1, ..., pathN]) {string}` &mdash; read all supplied paths and return their contents as a string. If an argument is an `Array` it will be expanded and those paths will be read.\n*   `readdir(path) {array[string]}` &mdash; returns the files of directory `path`.\n*   `read(path, [enc]) {string|Buffer}` &mdash; read the supplied file path. Returns a `buffer`, or a `string` if `enc` is given.\n*   `write(path, data, [enc], mode=\"w\")` &mdash; write the `data` to the supplied file `path`. `data` should be a `buffer` or a `string` if `enc` is given. `mode` is a `string` of either \"w\", for over write,  or \"a\" for append.\n*   `slurp(path, [env]) {sring|Buffer}` &mdash; alias for `read`\n*   `spit(path, data, [enc], mode=\"w\")` &mdash; alias for `write`\n\n\n### Asynchronous Utilities ###\n\n*   `sh(cmd, fn(error, result))` &mdash; execute shell `cmd`. In the callback function, `error` will be a truthy value if there was an error, and `result` will contain the STDERR returned from `cmd`. Otherwise, `result` will contain the STDOUT from the `cmd`. If `cmd` is an array of shell commands, each one will be run before the next, and only when they all complete, or an error is encountered, will the callback `fn` be called, and `result` be an array of the results of the individual commands.\n\n\nDeveloper Notes\n---------------\n\n*   Due to an issue with npm v1.1.13 and up (see issue [#2490](https://github.com/isaacs/npm/issues/2490)), I had to move my code into the `node_modules/sake` directory and add a `bundleDependencies` array to the `package.json` file.\n\nReport an Issue\n---------------\n\n* [Bugs](http://github.com/jhamlet/node-sake/issues)\n* Contact the author: <jhamlet@hamletink.com>\n\n\nLicense\n-------\n\n> Copyright (c) 2012 Jerry Hamlet <jerry@hamletink.com>\n> \n> Permission is hereby granted, free of charge, to any person\n> obtaining a copy of this software and associated documentation\n> files (the \"Software\"), to deal in the Software without\n> restriction, including without limitation the rights to use,\n> copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the\n> Software is furnished to do so, subject to the following\n> conditions:\n> \n> The above copyright notice and this permission notice shall be\n> included in all copies or substantial portions of the Software.\n> \n> The Software shall be used for Good, not Evil.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n> OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n> HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n> WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n> FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n> OTHER DEALINGS IN THE SOFTWARE.\n\n","maintainers":[{"name":"jhamlet","email":"jerry@hamletink.com"}],"directories":{}},"0.1.21":{"name":"sake","description":"[S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.","version":"0.1.21","keywords":["build","make","rake","jake"],"main":"./node_modules/sake/sake.js","bin":{"sake":"./bin/sake"},"dependencies":{"nomnom":">=1.5.x","async":">=0.1.x","resolve":">=0.2.x","proteus":">=0.0.x","wordwrap":">=0.0.2","glob":">=3.1.x","minimatch":">=0.2.x"},"devDependencies":{"mocha":">=0.3.x","should":">=0.5.x","underscore":">=1.3.x"},"bundleDependencies":["sake"],"scripts":{"test":"mocha test/test-*"},"licenses":[{"type":"MIT","url":"http://github.com/jhamlet/node-sake/raw/master/LICENSE"}],"repository":{"type":"git","url":"git://github.com/jhamlet/node-sake.git"},"bugs":{"url":"http://github.com/jhamlet/node-sake/issues"},"preferGlobal":true,"_npmUser":{"name":"jhamlet","email":"jerry@hamletink.com"},"_id":"sake@0.1.21","contributors":[{"name":"Jerry Hamlet","email":"jerry@hamletink.com"}],"optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.22","_nodeVersion":"v0.6.10","_defaultsLoaded":true,"dist":{"shasum":"e5038a9f45c9545f0e7033469ec53016273dc673","tarball":"https://registry.npmjs.org/sake/-/sake-0.1.21.tgz","integrity":"sha512-A3gtlmplO+4HZVw148TTqGmuHf+E8+TRDnloS/2VzWwRWyeprltMfVYYTk1mcuVVdR973lA+mMYh0gMLW2G2tw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDjVZKu38mQNznMMOIaL0MVCC5yao13UOWHc8O3yASTjAIgXTEn/uwz4rimiayt+PnOaTEuXzbDbJNpoS2+K/ioIN8="}]},"readme":"\nSaké\n====\n\n> [S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.\n\n\nOverview\n--------\n\nThis package contains **saké**, a JavaScript build program that runs in node with capabilities similar to ruby's Rake.\n\nSaké has the following features:\n\n1.  `Sakefiles` (**saké’s** version of Rakefiles) are completely defined in standard JavaScript (or CoffeeScript, for those who want an even more Rake-like feel).\n2.  Flexible `FileLists` that act like arrays but know about manipulating file names and paths.\n3.  `clean` and `clobber` tasks are available for tidying up.\n4.  _Asynchronous_ task handling, with easy options for specifying _synchronous_ tasks.\n5.  Simple _namespacing_ of tasks to break projects into discreet parts.\n5.  Many utility methods for handling common build tasks (rm, rm_rf, mkdir, mkdir_p, sh, cat, etc...)\n\n\nInstallation\n------------\n\n### Install with npm\n\nDownload and install with the following:\n\n~~~\nnpm install -g sake\n~~~\n\nCommand-Line Usage\n------------------\n\n~~~\n% sake -h\n\nusage: sake [TASKNAME] [ARGUMENTS ...] [ENV=VALUE ...] [options]\n\n[TASKNAME]     Name of the task to run. Defaults to 'default'.\n[ARGUMENTS ...]     Zero or more arguments to pass to the task invoked.\n[ENV=VALUE ...]     Zero or more arguments to translate into environment variables.\n\noptions:\n   -f, --sakefile PATH       PATH to Sakefile to run instead of searching for one.\n   -T, --tasks [PATTERN]     List tasks with descriptions (optionally, just those\n                             matching PATTERN) and exit.\n   -P, --prereqs [PATTERN]   List tasks and their prerequisites (optionally, just\n                             those matching PATTERN) and exit.\n   -r, --require MODULE      Require MODULE before executing Sakefile and expose the\n                             MODULE under a sanitized namespace (i.e.: coffee-script\n                             => [sake.]coffeeScript). Can be specified multiple\n                             times.\n   -l, --sakelib PATH        Auto-include any .sake[.js|.coffeee] files in PATH.\n                             (default is 'sakelib'.) Can be specified multiple times\n   -n, --dry-run             Do a dry run without executing actions.\n   -C, --no-chdir            Do not change directory to the Sakefile location.\n   -N, --no-search           Do not search parent directories for a Sakefile.\n   -G, --no-system           Do not use SAKE_PATH environment variable to search for\n                             a Sakefile.\n   -S, --sync                Make all standard tasks 'synchronous' by default.\n   -d, --debug               Enable additional debugging output.\n   -q, --quiet               Suppress informational messages.\n   -V, --version             Print the version of sake and exit.\n   -h, --help                Print this help information and exit.\n\nIf a Sakefile is not specified, sake searches the current directory, and all parent\ndirectories, for one (unless -N, --no-search is set). Otherwise, if the SAKE_PATH\nenvironment variable is defined it searches those path(s) (unless -G, --no-system is\nset).\n\nIf specified, or found through normal searching (not in SAKE_PATH(s)), sake changes the\nprocess' current working directory to the directory of the found Sakefile (unless -C,\n--no-chdir is set), otherwise it stays where it was run from.\n\nSake then invokes the specified TASKNAME, or the \"default\" one.\n\nSakefile can be one of \"Sakefile\", or \"sakefile\", with an optional extension of \".js\",\nor \".coffee\".\n~~~\n\n### Dependencies ###\n\nThese are installed when **sake** is installed.\n\n~~~\nnomnom:   >=1.5.x\nasync:    >=0.1.x\nresolve:  >=0.2.x\nproteus:  >=0.0.x\nwordwrap: >=0.0.2\nglob:     >=2.1.x\n~~~\n\n\n### Development Dependencies ###\n\nInstalled when you run `npm link` in the package directory.\n\n~~~\nmocha:      >=0.3.x\nshould:     >=0.5.x\nunderscore: >=1.3.x\n~~~\n\n\nSakefile Usage\n--------------\n\nWithin a `Sakefile`, Saké's methods are exported to the global scope, so you can invoke them directly:\n\n~~~js\ntask(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n~~~\n    \nWithin another node module you can `require(\"sake\")` and access the methods on the exported object, or even run a block of code in the **saké** context (virtual machine):\n\n~~~js\nvar sake = require(\"sake\");\n    \nsake.task(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n\n// The function passed to sake#run is compiled and run in the sake context.\n// The function **will not** have access to any variables in this scope,\n// nor, will variables leak from the function's scope into this one.\nsake.run(function () {\n    var jsFiles = new FileList(\"src/js/**/*.js\");\n    \n    require(\"sake/clean\");\n    \n    task(\"script-min.js\", jsFiles, function (t) {\n        var cmd = \"infuse \" + jsFiles.map(function (path) {\n                return \"-i \" + path;\n            }) + \" -E\";\n            \n        sh(cmd, function (err, result) {\n            write(t.name, result, \"utf8\");\n            t.done();\n        })\n    });\n    \n    CLEAN.include(\"script-min.js\");\n});\n~~~\n\nThe remainder of this documentation will assume that we are calling the methods from within a `Sakefile`.\n\n\nDefining Tasks\n--------------\n\nThe various task methods take the following arguments:\n\n1.   `taskname`: `string` &mdash; naming the task\n2.   `prerequisites`: _optional_ \n    *   an `array` of:\n        *   `string` task name, or\n        *   a `FileLists`, or \n        *   a `function` that returns one of the above.\n    *   or, you can also pass a `FileList` in directly for `prerequisites`.\n3.   `action`: an _optional_ `function` that will be called when the task is invoked. It will be passed the task instance as its first argument, followed by any arguments that it was invoked with (either from the command-line, or through code). Task arguments can also be accessed through the instance's `arguments` property. i.e: `t.arguments`.\n\nAll task methods return the task *instance*.\n\nIf a task is already defined, it will be augmented by the additional arguments. So, this:\n\n~~~js\ntask(\"one\", [\"othertask\"], function (t) {\n    // do action one...\n    t.done();\n});\n\ntask(\"one\", function (t) {\n    // do action two...\n    t.done();\n});\n\ntask(\"othertask\");\n~~~\n\nWould result in a task \"othertask\" with no prerequisites, and no action, and a task \"one\" with \"othertask\" as a prerequisite and the two functions as its actions.\n\n**Note** how the dependent task was defined *after* it was required as a prerequisite. Task prerequisites are not resolved until the task is invoked. This leads to flexibility in how to compose your tasks and prerequisite tasks.\n\n\n### Task Instance Properties and Methods ###\n\n*   `name {string}` &mdash; the name of the task.\n*   `namespace {string}` &mdash; the task's namespace.\n*   `type {string}` &mdash; one of \"task\", \"file-task\", or \"file-create-task\"\n*   `fqn {string}` &mdash; the fully qualified name of the task. i.e: \"namespace:name\".\n*   `prerequisites {array}` &mdash; the list of prerequisite names for the task.\n*   `isNeeded {boolean}` &mdash; whether or not this task needs to run.\n*   `timestamp {boolean}` &mdash; the last modification time for the task.\n*   `invoke([args ...]) {Task}` &mdash; invoke the task passing args to each action for the task. Will run any prerequisites first. Returns the task instance.\n*   `execute([args ...]) {Task}` &mdash; Like `invoke`, but run the task even if it has already been run, or is not needed.\n*   `done()` &mdash; signal that the current task's action is done running.\n*   `abort([msg], [exitCode])` &mdash; abort the currently running task's actions, if _exitCode_ is specified **saké** will exit with that exit code and no other tasks will be processed. Otherwise, task processing will continue as normal.\n\n\n### Task Static Properties and Methods ###\n\n*   `namespace {string}` &mdash; the current namespace.\n*   `invoke(name, [rest ...]) {Task}` &mdash; invoke the named task and pass it the rest of the arguments.\n*   `get(name, [namespace]) {Task}` &mdash; get the task _name_, optionally start looking in _namespace_. Will throw an error if it can not find a task.\n*   `lookup(name, [namespace]) {Task|null}` &mdash; lookup a task with _name_, optionally start looking in _namespace_.\n*   `getAll() {array[Task]}` &mdash; return all defined tasks.\n*   `has(name, [namespace]) {boolean}` &mdash; does the task _name_ exist?\n*   `find(args, sortFn) {array[Task]}` &mdash; search for a task. _args_ can be an object with keys specifying which properties to match on, and their values denoting the value to match. _args_ can also be a function that accepts a task and returns a boolean whether or not that task matches.\n\n\nFile Tasks\n----------\n\nFile tasks are created with the (appropriately named) `file` method. File tasks are only triggered if the file doesn't exist, or the modification time of any of its prerequisites is newer than itself.\n\n~~~js\nfile(\"path/to/some/file\", function (t) {\n    cp(\"other/path\", t.name);\n    t.done();\n});\n~~~\n\nThe above task would only be triggered if `path/to/some/file` did not exist.\n\nThe following:\n\n~~~js\nfile(\"combined/file/path\", [\"pathA\", \"pathB\", \"pathC\"], function (t) {\n    write(t.name, cat(t.prerequisites), \"utf8\");\n    t.done();\n});\n~~~\n\nwould be triggered if `path/to/some/file` did not exist, or its modification time was earlier than any of its prerequisites (`pathA`, `pathB`, or  `pathC`).\n\n\nDirectory Tasks\n---------------\n\nDirectory tasks, created with the `directory` method, are tasks that will only be called if they do not exist. A task will be created for the named directory (and for all directories along the way) with the action of creating the directory.\n\nDirectory tasks do not take any `prerequisites` or an `action` when first defined, however, they may be augmented with such after they are created:\n\n~~~js\ndirectory(\"dir/path/to/create\");\n\ntask(\"dir/path/to/create\", [\"othertask\"], action (t) {\n    //... do stuff\n    t.done();\n});\n~~~\n\n\nFile Create Tasks\n-----------------\n\nA file create task is a file task, that when used as a prerequisite, will be needed if, and only if, the file has not been created. Once created, it is not re-triggered if any of its prerequisites are newer, nor does it trigger any rebuilds of tasks that depend on it whenever the file is updated.\n\n~~~js\nfileCreate(\"file/path/to/create.ext\", [\"pathA\", \"pathB\"], function (t) {\n    // create file...\n    t.done();\n});\n~~~\n\n\n(A)Synchronicity and Tasks\n--------------------------\n\nIn **saké** all task actions are assumed to be *asynchronous* and an action must call its task's `done` method to tell **saké** that it is done processing stuff.\n\n~~~js\ntask(\"long task\", function (t) {\n    sh(\"some long running shell command\", function (err, result) {\n        // do stuff...\n        t.done();\n    });\n});\n~~~\n\nAlternatively, you can use the `Sync` version of a task to add a *synchronous* action, and `done` will be called for you after the function completes.\n\n~~~js\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n~~~\n\nThere are `Sync` versions of all the core tasks: `taskSync`, `fileSync`, and `fileCreateSync`. There are also `Async` versions of each task: `taskAsync`, `fileAsync`, and `fileCreateAsync`. The actions created for a `directory` task are *synchronous*. You can add *asynchronous* task actions after the initial definition.\n\nThirdly, you can specify that all of the core task creation functions generate *synchronous* actions by setting **saké's** \"sync\" option to `true`, or by use of the command-line option `-S, --sync`.\n\n~~~js\nsake.options.sync = true;\n\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n\n//... define more synchronous tasks\n\n//... and then revert to async\nsake.options.sync = false;\n~~~\n\nUltimately, it is up to the **saké** script author to correctly designate a task action as *synchronous* or *asynchronous*. Nothing prevents the running of an *asynchronous* function within a task's *synchronous* action. If nothing is dependent on the result of that action, then no problem would occur. It's when other tasks rely on the completion of certain *asynchronous* actions, that problems may arise.\n\nIn the case of *asynchronous* actions, **Saké** will issue a `WARNING` when it can not detect a `done()` call within that action.\n\n\nNamespaces\n----------\n\n**Saké** supports simple name spacing of tasks. Simply prepend the namespace before the task name with a colon \":\". This can be done when defining a task, or in the list of prerequisites for a task.\n\n~~~js\n// Defines a task 'fuz' in the namespace 'foo' that depends on the task 'buz'\n// in the namespace 'baz'\ntask(\"foo:fuz\", [\"baz:buz\"], function (t) {\n    //...\n    t.done();\n});\n~~~\n\nThen invoke the task as so:\n\n~~~\n% sake foo:fuz\n~~~\n\nYou can also use the convenience function `namespace` to wrap your task definitions for a particular namespace. Any _namespace naked_ definitions will first be tried in the local namespace, otherwise they will fall-back to the default namespace:\n\n~~~js\n\ntask(\"default\", function (t) {\n    //...\n    t.done():\n});\n\ntask(\"bazil\", function (t) {\n    //...\n    t.done():\n});\n\n// define within the 'foo' namespace\nnamespace(\"foo\", function () {\n    \n    // defines 'foo:foom' task\n    task(\"foom\", function (t) {\n        //...\n        t.done():\n    });\n    \n});\n\nnamespace(\"baz\", function () {\n    \n    // this task is defined in the 'baz' namespace, and depends on the\n    // 'foom' task from the 'foo' namespace\n    task(\"bazil\", [\"foo:foom\"], function (t) {\n        //...\n        t.done():\n    });\n    // This task is also defined in the 'baz' namespace. It depends on \n    // the 'bazil' task, which is also defined in 'baz' namespace. It\n    // also depends on the 'default' task in the 'default' (top-level)\n    // namespace.\n    task(\"buzil\", [\"bazil\", \"default\"], function (t), {\n        //...\n        t.done():\n    });\n    // If 'bazil' wasn't defined in the 'baz' namespace, it would resolve\n    // to the 'default' namespace task.\n});\n~~~\n\n**Note:** prerequisite names are tied to the defined task's namespace. i.e: If a task \"foo:fuz\" depends on \"foom\" **saké** will look in the \"foo\" namespace for \"foom\", and then the \"default\" namespace.\n\n**Note:** although the `namespace` functions can be nested, **saké** does not track the hierarchy of `namespace` calls -- if a dependent task is not found in the current task's namespace, it will look for it in the default namespace.\n\n\nPassing Arguments to A Task\n---------------------------\n\nThere are two ways to pass arguments to a task.\n\nFirst, **saké** translates any arguments in the form of `ENV=VALUE` on the command-line into `process.env` values:\n\n~~~\n% sake build BUILD_TYPE=debug ENVIRONMENT=prod\n~~~\n\nWill set `process.env.BUILD_TYPE` to \"debug\" and `process.env.ENVIRONMENT` to \"prod\". The values are JSON parsed; so the values are translated into real JavaScript values (numbers, true, false, etc...).\n\nSecondly, **saké** passes all non-option, and non-ENV=VALUE, looking arguments from the command-line to the invoked task:\n\n~~~\n% sake foo 3.14 pie true\n~~~\n\nWill invoke the \"foo\" task and pass to each of foo's actions (after the task instance itself) `3.14`, \"pie\" and `true`. The arguments are also JSON parsed to get real JavaScript values.\n\n~~~js\ntask(\"foo\", function (t, amt, word, flag) {\n    log(amt);   // => 3.14\n    log(word);  // => \"pie\"\n    log(flag);  // => true\n});\n~~~\n\n**Note:** This differs from how **rake**, and **jake** do things. In **saké** you can only invoke one task on the command-line. All other arguments on the command-line are considered task arguments.\n\n\nIncluding Other Saké Files\n-------------------------------------\n\nYou can include other **saké** files with the `include` and `load` methods. The included files will be run in the **saké** context, so any variables they do not declare with the `var` keyword will be set on the global **saké** context. This allows you to break your project build files up into discreet files.\n\nAll `require` and `include`, or `load` statements, are resolved relative to the current file, so you can create your own hierarchy of build dependencies.\n\nYou can also add your own paths to the list of ones that **saké** uses to resolve `requires`: `[sake.]includePaths` is an array of directory paths to search. They are tried in reverse order, so if you push a path on to the array that path will be tried first, followed by any others.\n\n~~~js\n// in a Sakefile\nincludePaths.push(\"some/path\");\n\nrequire(\"some-module\"); // will be tried in some/path/some-module.js\n~~~\n\nAlso, the `__dirname` and `__filename` properties are available in `included` files to help resolve local includes.\n\n~~~js\nvar Path = require(\"path\");\n\ninclude(Path.join(__dirname, \"include-dir/include-file\"));\n~~~\n\nSake Library\n------------\n\n**Saké** will load any `.sake`, `.sake.js`, or `.sake.coffee` files located in a `sakelib` directory relative to the `Sakefile` being run. This directory name can be modified with the `-l, --sakelib` option, and multiple directories can be specified. This allows you to re-use common tasks across multiple projects.\n\n\nFile Lists\n----------\n\nFileLists are lists of file paths.\n\n~~~js\nnew FileList(\"*.scss\");\n~~~\n\nWould contain all the file paths with a \".scss\" extension in the top-level directory of your project.\n\nYou can use FileLists pretty much like an `Array`. You can iterate them (with `forEach, filter, reduce`, etc...), `concat` them, `splice` them, and you get back a new FileList object.\n\nTo add files, or glob patterns to them, use the `#include` method:\n\n~~~js\nvar fl = new FileList(\"*.scss\");\nfl.include(\"core.css\", \"reset.css\", \"*.css\");\n~~~\n\nYou can also `exlucude` files by Glob pattern, `Regular Expression` pattern, or by use of a `function` that takes the file path as an argument and returns a `truthy` value to exclude a file.\n\n~~~js\n// Exclude by RegExp\nfl.exclude(/^dev-.*\\.css/);\n\n// Exclude by Glob pattern\nfl.exclude(\"dev-*.css\");\n\n// Exclude by function\nfl.exclude(function (path) {\n    return FS.statSync(path).mtime.getTime() < (Date.now() - 60 * 60 * 1000);\n});\n~~~\n\nTo get to the actual items of the FileList, use the `#items` property, or the `#toArray` method, to get a plain array back. You can also use the `#get` or `#set` methods to retrieve or set an item.\n\nFileLists are *lazy*, in that the actual file paths are not determined from the include and exclude patterns until the individual items are requested. This allows you to define a FileList and incrementally add patterns to it in the Sakefile file. The FileList paths will not be resolved until the task that uses it as a prerequisite actually asks for the final paths.\n\n\n### FileList Properties & Methods ###\n\n*   `existing` &mdash; will return a new `FileList` with all of the files that actually exist.\n*   `notExisting` &mdash; will return a new `FileList` of all the files that do not exist.\n*   `extension(ext)` &mdash; returns a new `FileList` with all paths that match the given extension.\n\n~~~js\nfl.extension(\".scss\").forEach(function (path) {\n    //...\n});\n~~~\n\n*   `grep(pattern)` &mdash; get a `FileList` of all the files that match the given `pattern`. `pattern` can be a plain `String`, a `Glob` pattern, a `RegExp`, or a `function` that receives each path and can return a truthy value to include it.\n*   `clearExcludes()` &mdash; clear all exclude patterns/functions.\n*   `clearIncludes()` &mdash; clear all include patterns.\n\nBy default, a `FileList` excludes directories. To allow directories call `FileList#clearExcludes()` before requesting any items.\n\n\nThe \"clean\" and \"clobber\" Tasks, and The CLEAN and CLOBBER FileLists\n--------------------------------------------------------------------\n\nWithin a `Sakefile`:\n\n~~~js\n// defines the CLEAN FileList and 'clean' task\nrequire(\"sake/clean\");\n\n// defines the above, and also the CLOBBER FileTask and 'clobber' task\nrequire(\"sake/clobber\");\n~~~\n\nWhen the \"clean\" task is run, it will remove any files that have been included in the `CLEAN FileList`. \"clobber\" will remove any file, or directory, included in the `CLOBBER FileList`.\n\n\nSaké Utility Functions\n----------------------\n\nSaké defines a few utility functions to make life a little easier in an asynchronous world. Most of these are just wrappers for `node`'s File System (`require(\"fs\")`) utility methods.\n\n### Synchronous Utilities ###\n\n*   `mkdir(dirpath, mode=\"777\")` &mdash; create the `dirpath` directory, if it doesn't already exist.\n*   `mkdir_p(dirpath, mode=\"777\"])` &mdash; as above, but create all intermediate directories as needed.\n*   `rm(path, [path1, ..., pathN])` &mdash; remove one or more paths from the file system.\n*   `rm_rf(path, [path1, ..., pathN])` &mdash; as above, and remove directories and their contents.\n*   `cp(from, to)` &mdash; copy a file from `from` path to `to` path.\n*   `cp_r(from, to)` &mdash; copy all files from `from` path to `to` path.\n*   `mv(from, to)` &mdash; move a file from `from` path to `to` path.\n*   `ln(from, to)` &mdash; create a hard link from `from` path to `to` path.\n*   `ln_s(from, to)` &mdash; create a symlink from `from` path to `to` path.\n*   `cat(path, [path1, ..., pathN]) {string}` &mdash; read all supplied paths and return their contents as a string. If an argument is an `Array` it will be expanded and those paths will be read.\n*   `readdir(path) {array[string]}` &mdash; returns the files of directory `path`.\n*   `read(path, [enc]) {string|Buffer}` &mdash; read the supplied file path. Returns a `buffer`, or a `string` if `enc` is given.\n*   `write(path, data, [enc], mode=\"w\")` &mdash; write the `data` to the supplied file `path`. `data` should be a `buffer` or a `string` if `enc` is given. `mode` is a `string` of either \"w\", for over write,  or \"a\" for append.\n*   `slurp(path, [env]) {sring|Buffer}` &mdash; alias for `read`\n*   `spit(path, data, [enc], mode=\"w\")` &mdash; alias for `write`\n\n\n### Asynchronous Utilities ###\n\n*   `sh(cmd, fn(error, result))` &mdash; execute shell `cmd`. In the callback function, `error` will be a truthy value if there was an error, and `result` will contain the STDERR returned from `cmd`. Otherwise, `result` will contain the STDOUT from the `cmd`. If `cmd` is an array of shell commands, each one will be run before the next, and only when they all complete, or an error is encountered, will the callback `fn` be called, and `result` be an array of the results of the individual commands.\n\n\nDeveloper Notes\n---------------\n\n*   Due to an issue with npm v1.1.13 and up (see issue [#2490](https://github.com/isaacs/npm/issues/2490)), I had to move my code into the `node_modules/sake` directory and add a `bundleDependencies` array to the `package.json` file.\n\nReport an Issue\n---------------\n\n* [Bugs](http://github.com/jhamlet/node-sake/issues)\n* Contact the author: <jhamlet@hamletink.com>\n\n\nLicense\n-------\n\n> Copyright (c) 2012 Jerry Hamlet <jerry@hamletink.com>\n> \n> Permission is hereby granted, free of charge, to any person\n> obtaining a copy of this software and associated documentation\n> files (the \"Software\"), to deal in the Software without\n> restriction, including without limitation the rights to use,\n> copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the\n> Software is furnished to do so, subject to the following\n> conditions:\n> \n> The above copyright notice and this permission notice shall be\n> included in all copies or substantial portions of the Software.\n> \n> The Software shall be used for Good, not Evil.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n> OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n> HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n> WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n> FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n> OTHER DEALINGS IN THE SOFTWARE.\n\n","maintainers":[{"name":"jhamlet","email":"jerry@hamletink.com"}],"directories":{}},"0.1.22":{"name":"sake","description":"[S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.","version":"0.1.22","keywords":["build","make","rake","jake"],"main":"./node_modules/sake/sake.js","bin":{"sake":"./bin/sake"},"dependencies":{"nomnom":">=1.5.x","async":">=0.1.x","resolve":">=0.2.x","proteus":">=0.0.x","wordwrap":">=0.0.2","glob":">=3.1.x","minimatch":">=0.2.x"},"devDependencies":{"mocha":">=0.3.x","should":">=0.5.x","underscore":">=1.3.x"},"bundleDependencies":["sake"],"scripts":{"test":"mocha test/test-*"},"licenses":[{"type":"MIT","url":"http://github.com/jhamlet/node-sake/raw/master/LICENSE"}],"repository":{"type":"git","url":"git://github.com/jhamlet/node-sake.git"},"bugs":{"url":"http://github.com/jhamlet/node-sake/issues"},"preferGlobal":true,"_npmUser":{"name":"jhamlet","email":"jerry@hamletink.com"},"_id":"sake@0.1.22","contributors":[{"name":"Jerry Hamlet","email":"jerry@hamletink.com"}],"optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.22","_nodeVersion":"v0.6.10","_defaultsLoaded":true,"dist":{"shasum":"f2abf9b3a86d086742deb7811f7628bba463bebb","tarball":"https://registry.npmjs.org/sake/-/sake-0.1.22.tgz","integrity":"sha512-wsHZ9DmEcK3HeVW7FNIRdQ/aP21bLSmyb29PBrc5vRvMQ7r5GvgvVJO45CNcvW1zlDtikgojTMdZ/PO+xajj1A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDS4OrPhnY7G//slGoi0COblQH5UHtdmPtdCEO2Fg+BPwIgclCkydoqXJDZU5kbaT/14nj12AYFqCOqkX05AfOfOko="}]},"readme":"\nSaké\n====\n\n> [S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.\n\n\nOverview\n--------\n\nThis package contains **saké**, a JavaScript build program that runs in node with capabilities similar to ruby's Rake.\n\nSaké has the following features:\n\n1.  `Sakefiles` (**saké’s** version of Rakefiles) are completely defined in standard JavaScript (or CoffeeScript, for those who want an even more Rake-like feel).\n2.  Flexible `FileLists` that act like arrays but know about manipulating file names and paths.\n3.  `clean` and `clobber` tasks are available for tidying up.\n4.  _Asynchronous_ task handling, with easy options for specifying _synchronous_ tasks.\n5.  Simple _namespacing_ of tasks to break projects into discreet parts.\n5.  Many utility methods for handling common build tasks (rm, rm_rf, mkdir, mkdir_p, sh, cat, etc...)\n\n\nInstallation\n------------\n\n### Install with npm\n\nDownload and install with the following:\n\n~~~\nnpm install -g sake\n~~~\n\nCommand-Line Usage\n------------------\n\n~~~\n% sake -h\n\nusage: sake [TASKNAME] [ARGUMENTS ...] [ENV=VALUE ...] [options]\n\n[TASKNAME]     Name of the task to run. Defaults to 'default'.\n[ARGUMENTS ...]     Zero or more arguments to pass to the task invoked.\n[ENV=VALUE ...]     Zero or more arguments to translate into environment variables.\n\noptions:\n   -f, --sakefile PATH       PATH to Sakefile to run instead of searching for one.\n   -T, --tasks [PATTERN]     List tasks with descriptions (optionally, just those\n                             matching PATTERN) and exit.\n   -P, --prereqs [PATTERN]   List tasks and their prerequisites (optionally, just\n                             those matching PATTERN) and exit.\n   -r, --require MODULE      Require MODULE before executing Sakefile and expose the\n                             MODULE under a sanitized namespace (i.e.: coffee-script\n                             => [sake.]coffeeScript). Can be specified multiple\n                             times.\n   -l, --sakelib PATH        Auto-include any .sake[.js|.coffeee] files in PATH.\n                             (default is 'sakelib'.) Can be specified multiple times\n   -n, --dry-run             Do a dry run without executing actions.\n   -C, --no-chdir            Do not change directory to the Sakefile location.\n   -N, --no-search           Do not search parent directories for a Sakefile.\n   -G, --no-system           Do not use SAKE_PATH environment variable to search for\n                             a Sakefile.\n   -S, --sync                Make all standard tasks 'synchronous' by default.\n   -d, --debug               Enable additional debugging output.\n   -q, --quiet               Suppress informational messages.\n   -V, --version             Print the version of sake and exit.\n   -h, --help                Print this help information and exit.\n\nIf a Sakefile is not specified, sake searches the current directory, and all parent\ndirectories, for one (unless -N, --no-search is set). Otherwise, if the SAKE_PATH\nenvironment variable is defined it searches those path(s) (unless -G, --no-system is\nset).\n\nIf specified, or found through normal searching (not in SAKE_PATH(s)), sake changes the\nprocess' current working directory to the directory of the found Sakefile (unless -C,\n--no-chdir is set), otherwise it stays where it was run from.\n\nSake then invokes the specified TASKNAME, or the \"default\" one.\n\nSakefile can be one of \"Sakefile\", or \"sakefile\", with an optional extension of \".js\",\nor \".coffee\".\n~~~\n\n### Dependencies ###\n\nThese are installed when **sake** is installed.\n\n~~~\nnomnom:   >=1.5.x\nasync:    >=0.1.x\nresolve:  >=0.2.x\nproteus:  >=0.0.x\nwordwrap: >=0.0.2\nglob:     >=2.1.x\n~~~\n\n\n### Development Dependencies ###\n\nInstalled when you run `npm link` in the package directory.\n\n~~~\nmocha:      >=0.3.x\nshould:     >=0.5.x\nunderscore: >=1.3.x\n~~~\n\n\nSakefile Usage\n--------------\n\nWithin a `Sakefile`, Saké's methods are exported to the global scope, so you can invoke them directly:\n\n~~~js\ntask(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n~~~\n    \nWithin another node module you can `require(\"sake\")` and access the methods on the exported object, or even run a block of code in the **saké** context (virtual machine):\n\n~~~js\nvar sake = require(\"sake\");\n    \nsake.task(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n\n// The function passed to sake#run is compiled and run in the sake context.\n// The function **will not** have access to any variables in this scope,\n// nor, will variables leak from the function's scope into this one.\nsake.run(function () {\n    var jsFiles = new FileList(\"src/js/**/*.js\");\n    \n    require(\"sake/clean\");\n    \n    task(\"script-min.js\", jsFiles, function (t) {\n        var cmd = \"infuse \" + jsFiles.map(function (path) {\n                return \"-i \" + path;\n            }) + \" -E\";\n            \n        sh(cmd, function (err, result) {\n            write(t.name, result, \"utf8\");\n            t.done();\n        })\n    });\n    \n    CLEAN.include(\"script-min.js\");\n});\n~~~\n\nThe remainder of this documentation will assume that we are calling the methods from within a `Sakefile`.\n\n\nDefining Tasks\n--------------\n\nThe various task methods take the following arguments:\n\n1.   `taskname`: `string` &mdash; naming the task\n2.   `prerequisites`: _optional_ \n    *   an `array` of:\n        *   `string` task name, or\n        *   a `FileLists`, or \n        *   a `function` that returns one of the above.\n    *   or, you can also pass a `FileList` in directly for `prerequisites`.\n3.   `action`: an _optional_ `function` that will be called when the task is invoked. It will be passed the task instance as its first argument, followed by any arguments that it was invoked with (either from the command-line, or through code). Task arguments can also be accessed through the instance's `arguments` property. i.e: `t.arguments`.\n\nAll task methods return the task *instance*.\n\nIf a task is already defined, it will be augmented by the additional arguments. So, this:\n\n~~~js\ntask(\"one\", [\"othertask\"], function (t) {\n    // do action one...\n    t.done();\n});\n\ntask(\"one\", function (t) {\n    // do action two...\n    t.done();\n});\n\ntask(\"othertask\");\n~~~\n\nWould result in a task \"othertask\" with no prerequisites, and no action, and a task \"one\" with \"othertask\" as a prerequisite and the two functions as its actions.\n\n**Note** how the dependent task was defined *after* it was required as a prerequisite. Task prerequisites are not resolved until the task is invoked. This leads to flexibility in how to compose your tasks and prerequisite tasks.\n\n\n### Task Instance Properties and Methods ###\n\n*   `name {string}` &mdash; the name of the task.\n*   `namespace {string}` &mdash; the task's namespace.\n*   `type {string}` &mdash; one of \"task\", \"file-task\", or \"file-create-task\"\n*   `fqn {string}` &mdash; the fully qualified name of the task. i.e: \"namespace:name\".\n*   `prerequisites {array}` &mdash; the list of prerequisite names for the task.\n*   `isNeeded {boolean}` &mdash; whether or not this task needs to run.\n*   `timestamp {boolean}` &mdash; the last modification time for the task.\n*   `invoke([args ...]) {Task}` &mdash; invoke the task passing args to each action for the task. Will run any prerequisites first. Returns the task instance.\n*   `execute([args ...]) {Task}` &mdash; Like `invoke`, but run the task even if it has already been run, or is not needed.\n*   `done()` &mdash; signal that the current task's action is done running.\n*   `abort([msg], [exitCode])` &mdash; abort the currently running task's actions, if _exitCode_ is specified **saké** will exit with that exit code and no other tasks will be processed. Otherwise, task processing will continue as normal.\n\n\n### Task Static Properties and Methods ###\n\n*   `namespace {string}` &mdash; the current namespace.\n*   `invoke(name, [rest ...]) {Task}` &mdash; invoke the named task and pass it the rest of the arguments.\n*   `get(name, [namespace]) {Task}` &mdash; get the task _name_, optionally start looking in _namespace_. Will throw an error if it can not find a task.\n*   `lookup(name, [namespace]) {Task|null}` &mdash; lookup a task with _name_, optionally start looking in _namespace_.\n*   `getAll() {array[Task]}` &mdash; return all defined tasks.\n*   `has(name, [namespace]) {boolean}` &mdash; does the task _name_ exist?\n*   `find(args, sortFn) {array[Task]}` &mdash; search for a task. _args_ can be an object with keys specifying which properties to match on, and their values denoting the value to match. _args_ can also be a function that accepts a task and returns a boolean whether or not that task matches.\n\n\nFile Tasks\n----------\n\nFile tasks are created with the (appropriately named) `file` method. File tasks are only triggered if the file doesn't exist, or the modification time of any of its prerequisites is newer than itself.\n\n~~~js\nfile(\"path/to/some/file\", function (t) {\n    cp(\"other/path\", t.name);\n    t.done();\n});\n~~~\n\nThe above task would only be triggered if `path/to/some/file` did not exist.\n\nThe following:\n\n~~~js\nfile(\"combined/file/path\", [\"pathA\", \"pathB\", \"pathC\"], function (t) {\n    write(t.name, cat(t.prerequisites), \"utf8\");\n    t.done();\n});\n~~~\n\nwould be triggered if `path/to/some/file` did not exist, or its modification time was earlier than any of its prerequisites (`pathA`, `pathB`, or  `pathC`).\n\n\nDirectory Tasks\n---------------\n\nDirectory tasks, created with the `directory` method, are tasks that will only be called if they do not exist. A task will be created for the named directory (and for all directories along the way) with the action of creating the directory.\n\nDirectory tasks do not take any `prerequisites` or an `action` when first defined, however, they may be augmented with such after they are created:\n\n~~~js\ndirectory(\"dir/path/to/create\");\n\ntask(\"dir/path/to/create\", [\"othertask\"], action (t) {\n    //... do stuff\n    t.done();\n});\n~~~\n\n\nFile Create Tasks\n-----------------\n\nA file create task is a file task, that when used as a prerequisite, will be needed if, and only if, the file has not been created. Once created, it is not re-triggered if any of its prerequisites are newer, nor does it trigger any rebuilds of tasks that depend on it whenever the file is updated.\n\n~~~js\nfileCreate(\"file/path/to/create.ext\", [\"pathA\", \"pathB\"], function (t) {\n    // create file...\n    t.done();\n});\n~~~\n\n\n(A)Synchronicity and Tasks\n--------------------------\n\nIn **saké** all task actions are assumed to be *asynchronous* and an action must call its task's `done` method to tell **saké** that it is done processing stuff.\n\n~~~js\ntask(\"long task\", function (t) {\n    sh(\"some long running shell command\", function (err, result) {\n        // do stuff...\n        t.done();\n    });\n});\n~~~\n\nAlternatively, you can use the `Sync` version of a task to add a *synchronous* action, and `done` will be called for you after the function completes.\n\n~~~js\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n~~~\n\nThere are `Sync` versions of all the core tasks: `taskSync`, `fileSync`, and `fileCreateSync`. There are also `Async` versions of each task: `taskAsync`, `fileAsync`, and `fileCreateAsync`. The actions created for a `directory` task are *synchronous*. You can add *asynchronous* task actions after the initial definition.\n\nThirdly, you can specify that all of the core task creation functions generate *synchronous* actions by setting **saké's** \"sync\" option to `true`, or by use of the command-line option `-S, --sync`.\n\n~~~js\nsake.options.sync = true;\n\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n\n//... define more synchronous tasks\n\n//... and then revert to async\nsake.options.sync = false;\n~~~\n\nUltimately, it is up to the **saké** script author to correctly designate a task action as *synchronous* or *asynchronous*. Nothing prevents the running of an *asynchronous* function within a task's *synchronous* action. If nothing is dependent on the result of that action, then no problem would occur. It's when other tasks rely on the completion of certain *asynchronous* actions, that problems may arise.\n\nIn the case of *asynchronous* actions, **Saké** will issue a `WARNING` when it can not detect a `done()` call within that action.\n\n\nNamespaces\n----------\n\n**Saké** supports simple name spacing of tasks. Simply prepend the namespace before the task name with a colon \":\". This can be done when defining a task, or in the list of prerequisites for a task.\n\n~~~js\n// Defines a task 'fuz' in the namespace 'foo' that depends on the task 'buz'\n// in the namespace 'baz'\ntask(\"foo:fuz\", [\"baz:buz\"], function (t) {\n    //...\n    t.done();\n});\n~~~\n\nThen invoke the task as so:\n\n~~~\n% sake foo:fuz\n~~~\n\nYou can also use the convenience function `namespace` to wrap your task definitions for a particular namespace. Any _namespace naked_ definitions will first be tried in the local namespace, otherwise they will fall-back to the default namespace:\n\n~~~js\n\ntask(\"default\", function (t) {\n    //...\n    t.done():\n});\n\ntask(\"bazil\", function (t) {\n    //...\n    t.done():\n});\n\n// define within the 'foo' namespace\nnamespace(\"foo\", function () {\n    \n    // defines 'foo:foom' task\n    task(\"foom\", function (t) {\n        //...\n        t.done():\n    });\n    \n});\n\nnamespace(\"baz\", function () {\n    \n    // this task is defined in the 'baz' namespace, and depends on the\n    // 'foom' task from the 'foo' namespace\n    task(\"bazil\", [\"foo:foom\"], function (t) {\n        //...\n        t.done():\n    });\n    // This task is also defined in the 'baz' namespace. It depends on \n    // the 'bazil' task, which is also defined in 'baz' namespace. It\n    // also depends on the 'default' task in the 'default' (top-level)\n    // namespace.\n    task(\"buzil\", [\"bazil\", \"default\"], function (t), {\n        //...\n        t.done():\n    });\n    // If 'bazil' wasn't defined in the 'baz' namespace, it would resolve\n    // to the 'default' namespace task.\n});\n~~~\n\n**Note:** prerequisite names are tied to the defined task's namespace. i.e: If a task \"foo:fuz\" depends on \"foom\" **saké** will look in the \"foo\" namespace for \"foom\", and then the \"default\" namespace.\n\n**Note:** although the `namespace` functions can be nested, **saké** does not track the hierarchy of `namespace` calls -- if a dependent task is not found in the current task's namespace, it will look for it in the default namespace.\n\n\nPassing Arguments to A Task\n---------------------------\n\nThere are two ways to pass arguments to a task.\n\nFirst, **saké** translates any arguments in the form of `ENV=VALUE` on the command-line into `process.env` values:\n\n~~~\n% sake build BUILD_TYPE=debug ENVIRONMENT=prod\n~~~\n\nWill set `process.env.BUILD_TYPE` to \"debug\" and `process.env.ENVIRONMENT` to \"prod\". The values are JSON parsed; so the values are translated into real JavaScript values (numbers, true, false, etc...).\n\nSecondly, **saké** passes all non-option, and non-ENV=VALUE, looking arguments from the command-line to the invoked task:\n\n~~~\n% sake foo 3.14 pie true\n~~~\n\nWill invoke the \"foo\" task and pass to each of foo's actions (after the task instance itself) `3.14`, \"pie\" and `true`. The arguments are also JSON parsed to get real JavaScript values.\n\n~~~js\ntask(\"foo\", function (t, amt, word, flag) {\n    log(amt);   // => 3.14\n    log(word);  // => \"pie\"\n    log(flag);  // => true\n});\n~~~\n\n**Note:** This differs from how **rake**, and **jake** do things. In **saké** you can only invoke one task on the command-line. All other arguments on the command-line are considered task arguments.\n\n\nIncluding Other Saké Files\n-------------------------------------\n\nYou can include other **saké** files with the `include` and `load` methods. The included files will be run in the **saké** context, so any variables they do not declare with the `var` keyword will be set on the global **saké** context. This allows you to break your project build files up into discreet files.\n\nAll `require` and `include`, or `load` statements, are resolved relative to the current file, so you can create your own hierarchy of build dependencies.\n\nYou can also add your own paths to the list of ones that **saké** uses to resolve `requires`: `[sake.]includePaths` is an array of directory paths to search. They are tried in reverse order, so if you push a path on to the array that path will be tried first, followed by any others.\n\n~~~js\n// in a Sakefile\nincludePaths.push(\"some/path\");\n\nrequire(\"some-module\"); // will be tried in some/path/some-module.js\n~~~\n\nAlso, the `__dirname` and `__filename` properties are available in `included` files to help resolve local includes.\n\n~~~js\nvar Path = require(\"path\");\n\ninclude(Path.join(__dirname, \"include-dir/include-file\"));\n~~~\n\nSake Library\n------------\n\n**Saké** will load any `.sake`, `.sake.js`, or `.sake.coffee` files located in a `sakelib` directory relative to the `Sakefile` being run. This directory name can be modified with the `-l, --sakelib` option, and multiple directories can be specified. This allows you to re-use common tasks across multiple projects.\n\n\nFile Lists\n----------\n\nFileLists are lists of file paths.\n\n~~~js\nnew FileList(\"*.scss\");\n~~~\n\nWould contain all the file paths with a \".scss\" extension in the top-level directory of your project.\n\nYou can use FileLists pretty much like an `Array`. You can iterate them (with `forEach, filter, reduce`, etc...), `concat` them, `splice` them, and you get back a new FileList object.\n\nTo add files, or glob patterns to them, use the `#include` method:\n\n~~~js\nvar fl = new FileList(\"*.scss\");\nfl.include(\"core.css\", \"reset.css\", \"*.css\");\n~~~\n\nYou can also `exlucude` files by Glob pattern, `Regular Expression` pattern, or by use of a `function` that takes the file path as an argument and returns a `truthy` value to exclude a file.\n\n~~~js\n// Exclude by RegExp\nfl.exclude(/^dev-.*\\.css/);\n\n// Exclude by Glob pattern\nfl.exclude(\"dev-*.css\");\n\n// Exclude by function\nfl.exclude(function (path) {\n    return FS.statSync(path).mtime.getTime() < (Date.now() - 60 * 60 * 1000);\n});\n~~~\n\nTo get to the actual items of the FileList, use the `#items` property, or the `#toArray` method, to get a plain array back. You can also use the `#get` or `#set` methods to retrieve or set an item.\n\nFileLists are *lazy*, in that the actual file paths are not determined from the include and exclude patterns until the individual items are requested. This allows you to define a FileList and incrementally add patterns to it in the Sakefile file. The FileList paths will not be resolved until the task that uses it as a prerequisite actually asks for the final paths.\n\n\n### FileList Properties & Methods ###\n\n*   `existing` &mdash; will return a new `FileList` with all of the files that actually exist.\n*   `notExisting` &mdash; will return a new `FileList` of all the files that do not exist.\n*   `extension(ext)` &mdash; returns a new `FileList` with all paths that match the given extension.\n\n~~~js\nfl.extension(\".scss\").forEach(function (path) {\n    //...\n});\n~~~\n\n*   `grep(pattern)` &mdash; get a `FileList` of all the files that match the given `pattern`. `pattern` can be a plain `String`, a `Glob` pattern, a `RegExp`, or a `function` that receives each path and can return a truthy value to include it.\n*   `clearExcludes()` &mdash; clear all exclude patterns/functions.\n*   `clearIncludes()` &mdash; clear all include patterns.\n\nBy default, a `FileList` excludes directories. To allow directories call `FileList#clearExcludes()` before requesting any items.\n\n\nThe \"clean\" and \"clobber\" Tasks, and The CLEAN and CLOBBER FileLists\n--------------------------------------------------------------------\n\nWithin a `Sakefile`:\n\n~~~js\n// defines the CLEAN FileList and 'clean' task\nrequire(\"sake/clean\");\n\n// defines the above, and also the CLOBBER FileTask and 'clobber' task\nrequire(\"sake/clobber\");\n~~~\n\nWhen the \"clean\" task is run, it will remove any files that have been included in the `CLEAN FileList`. \"clobber\" will remove any file, or directory, included in the `CLOBBER FileList`.\n\n\nSaké Utility Functions\n----------------------\n\nSaké defines a few utility functions to make life a little easier in an asynchronous world. Most of these are just wrappers for `node`'s File System (`require(\"fs\")`) utility methods.\n\n### Synchronous Utilities ###\n\n*   `mkdir(dirpath, mode=\"777\")` &mdash; create the `dirpath` directory, if it doesn't already exist.\n*   `mkdir_p(dirpath, mode=\"777\"])` &mdash; as above, but create all intermediate directories as needed.\n*   `rm(path, [path1, ..., pathN])` &mdash; remove one or more paths from the file system.\n*   `rm_rf(path, [path1, ..., pathN])` &mdash; as above, and remove directories and their contents.\n*   `cp(from, to)` &mdash; copy a file from `from` path to `to` path.\n*   `cp_r(from, to)` &mdash; copy all files from `from` path to `to` path.\n*   `mv(from, to)` &mdash; move a file from `from` path to `to` path.\n*   `ln(from, to)` &mdash; create a hard link from `from` path to `to` path.\n*   `ln_s(from, to)` &mdash; create a symlink from `from` path to `to` path.\n*   `cat(path, [path1, ..., pathN]) {string}` &mdash; read all supplied paths and return their contents as a string. If an argument is an `Array` it will be expanded and those paths will be read.\n*   `readdir(path) {array[string]}` &mdash; returns the files of directory `path`.\n*   `read(path, [enc]) {string|Buffer}` &mdash; read the supplied file path. Returns a `buffer`, or a `string` if `enc` is given.\n*   `write(path, data, [enc], mode=\"w\")` &mdash; write the `data` to the supplied file `path`. `data` should be a `buffer` or a `string` if `enc` is given. `mode` is a `string` of either \"w\", for over write,  or \"a\" for append.\n*   `slurp(path, [env]) {sring|Buffer}` &mdash; alias for `read`\n*   `spit(path, data, [enc], mode=\"w\")` &mdash; alias for `write`\n\n\n### Asynchronous Utilities ###\n\n*   `sh(cmd, fn(error, result))` &mdash; execute shell `cmd`. In the callback function, `error` will be a truthy value if there was an error, and `result` will contain the STDERR returned from `cmd`. Otherwise, `result` will contain the STDOUT from the `cmd`. If `cmd` is an array of shell commands, each one will be run before the next, and only when they all complete, or an error is encountered, will the callback `fn` be called, and `result` be an array of the results of the individual commands.\n\n\nDeveloper Notes\n---------------\n\n*   Due to an issue with npm v1.1.13 and up (see issue [#2490](https://github.com/isaacs/npm/issues/2490)), I had to move my code into the `node_modules/sake` directory and add a `bundleDependencies` array to the `package.json` file.\n\nReport an Issue\n---------------\n\n* [Bugs](http://github.com/jhamlet/node-sake/issues)\n* Contact the author: <jhamlet@hamletink.com>\n\n\nLicense\n-------\n\n> Copyright (c) 2012 Jerry Hamlet <jerry@hamletink.com>\n> \n> Permission is hereby granted, free of charge, to any person\n> obtaining a copy of this software and associated documentation\n> files (the \"Software\"), to deal in the Software without\n> restriction, including without limitation the rights to use,\n> copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the\n> Software is furnished to do so, subject to the following\n> conditions:\n> \n> The above copyright notice and this permission notice shall be\n> included in all copies or substantial portions of the Software.\n> \n> The Software shall be used for Good, not Evil.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n> OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n> HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n> WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n> FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n> OTHER DEALINGS IN THE SOFTWARE.\n\n","maintainers":[{"name":"jhamlet","email":"jerry@hamletink.com"}],"directories":{}},"0.1.23":{"name":"sake","description":"[S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.","version":"0.1.23","keywords":["build","make","rake","jake"],"main":"./node_modules/sake/sake.js","bin":{"sake":"./bin/sake"},"dependencies":{"nomnom":">=1.5.x","async":">=0.1.x","resolve":">=0.2.x","proteus":">=0.0.x","wordwrap":">=0.0.2","glob":">=3.1.x","minimatch":">=0.2.x"},"devDependencies":{"mocha":">=0.3.x","should":">=0.5.x","underscore":">=1.3.x"},"bundleDependencies":["sake"],"scripts":{"test":"mocha test/test-*"},"licenses":[{"type":"MIT","url":"http://github.com/jhamlet/node-sake/raw/master/LICENSE"}],"repository":{"type":"git","url":"http://github.com/jhamlet/node-sake.git"},"bugs":{"url":"http://github.com/jhamlet/node-sake/issues"},"preferGlobal":true,"contributors":[{"name":"Jerry Hamlet","email":"jerry@hamletink.com"}],"readme":"\nSaké\n====\n\n> [S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.\n\n\nOverview\n--------\n\nThis package contains **saké**, a JavaScript build program that runs in node with capabilities similar to ruby's Rake.\n\nSaké has the following features:\n\n1.  `Sakefiles` (**saké’s** version of Rakefiles) are completely defined in standard JavaScript (or CoffeeScript, for those who want an even more Rake-like feel).\n2.  Flexible `FileLists` that act like arrays but know about manipulating file names and paths.\n3.  `clean` and `clobber` tasks are available for tidying up.\n4.  _Asynchronous_ task handling, with easy options for specifying _synchronous_ tasks.\n5.  Simple _namespacing_ of tasks to break projects into discreet parts.\n5.  Many utility methods for handling common build tasks (rm, rm_rf, mkdir, mkdir_p, sh, cat, etc...)\n\n\nInstallation\n------------\n\n### Install with npm\n\nDownload and install with the following:\n\n~~~\nnpm install -g sake\n~~~\n\nCommand-Line Usage\n------------------\n\n~~~\n% sake -h\n\nUsage: sake [TASKNAME] [ARGUMENTS ...] [ENV=VALUE ...] [options]\n\n[TASKNAME]     Name of the task to run. Defaults to 'default'.\n[ARGUMENTS ...]     Zero or more arguments to pass to the task invoked.\n[ENV=VALUE ...]     Zero or more arguments to translate into environment variables.\n\nOptions:\n   -f, --sakefile PATH       PATH to Sakefile to run instead of searching for one.\n   -T, --tasks [PATTERN]     List tasks with descriptions (optionally, just those\n                             matching PATTERN) and exit.\n   -P, --prereqs [PATTERN]   List tasks and their prerequisites (optionally, just\n                             those matching PATTERN) and exit.\n   -r, --require MODULE      Require MODULE before executing Sakefile and expose the\n                             MODULE under a sanitized namespace (i.e.: coffee-script\n                             => [sake.]coffeeScript). Can be specified multiple\n                             times.\n   -l, --sakelib PATH        Auto-include any .sake[.js|.coffeee] files in PATH.\n                             (default is 'sakelib'.) Can be specified multiple times\n   -n, --dry-run             Do a dry run without executing actions.\n   -C, --no-chdir            Do not change directory to the Sakefile location.\n   -N, --no-search           Do not search parent directories for a Sakefile.\n   -G, --no-system           Do not use SAKE_PATH environment variable to search for\n                             a Sakefile.\n   -S, --sync                Make all standard tasks 'synchronous' by default.\n   -d, --debug               Enable additional debugging output.\n   -q, --quiet               Suppress informational messages.\n   -V, --version             Print the version of sake and exit.\n   -h, --help                Print this help information and exit.\n\nIf a Sakefile is not specified, sake searches the current directory, and all parent\ndirectories, for one (unless -N, --no-search is set). Otherwise, if the SAKE_PATH\nenvironment variable is defined it searches those path(s) (unless -G, --no-system is\nset).\n\nIf specified, or found through normal searching (not in SAKE_PATH(s)), sake changes the\nprocess' current working directory to the directory of the found Sakefile (unless -C,\n--no-chdir is set), otherwise it stays where it was run from.\n\nSake then invokes the specified TASKNAME, or the \"default\" one.\n\nSakefile can be one of \"Sakefile\", or \"sakefile\", with an optional extension of \".js\",\nor \".coffee\".\n\n~~~\n\n### Dependencies ###\n\nThese are installed when **sake** is installed.\n\n~~~\nnomnom:    >=1.5.x\nasync:     >=0.1.x\nresolve:   >=0.2.x\nproteus:   >=0.0.x\nwordwrap:  >=0.0.2\nglob:      >=3.1.x\nminimatch: >=0.2.x\n~~~\n\n\n### Development Dependencies ###\n\nInstalled when you run `npm link` in the package directory.\n\n~~~\nmocha:      >=0.3.x\nshould:     >=0.5.x\nunderscore: >=1.3.x\n~~~\n\n\nSakefile Usage\n--------------\n\nWithin a `Sakefile`, Saké's methods are exported to the global scope, so you can invoke them directly:\n\n~~~js\ntask(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n~~~\n    \nWithin another node module you can `require(\"sake\")` and access the methods on the exported object, or even run a block of code in the **saké** context (virtual machine):\n\n~~~js\nvar sake = require(\"sake\");\n    \nsake.task(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n\n// The function passed to sake#run is compiled and run in the sake context.\n// The function **will not** have access to any variables in this scope,\n// nor, will variables leak from the function's scope into this one.\nsake.run(function () {\n    var jsFiles = new FileList(\"src/js/**/*.js\");\n    \n    require(\"sake/clean\");\n    \n    task(\"script-min.js\", jsFiles, function (t) {\n        var cmd = \"infuse \" + jsFiles.map(function (path) {\n                return \"-i \" + path;\n            }) + \" -E\";\n            \n        sh(cmd, function (err, result) {\n            write(t.name, result, \"utf8\");\n            t.done();\n        })\n    });\n    \n    CLEAN.include(\"script-min.js\");\n});\n~~~\n\nThe remainder of this documentation will assume that we are calling the methods from within a `Sakefile`.\n\n\nDefining Tasks\n--------------\n\nThe various task methods take the following arguments:\n\n1.   `taskname`: `string` &mdash; naming the task\n2.   `prerequisites`: _optional_ \n    *   an `array` of:\n        *   `string` task name, or\n        *   a `FileLists`, or \n        *   a `function` that returns one of the above.\n    *   or, you can also pass a `FileList` in directly for `prerequisites`.\n3.   `action`: an _optional_ `function` that will be called when the task is invoked. It will be passed the task instance as its first argument, followed by any arguments that it was invoked with (either from the command-line, or through code). Task arguments can also be accessed through the instance's `arguments` property. i.e: `t.arguments`.\n\nAll task methods return the task *instance*.\n\nIf a task is already defined, it will be augmented by the additional arguments. So, this:\n\n~~~js\ntask(\"one\", [\"othertask\"], function (t) {\n    // do action one...\n    t.done();\n});\n\ntask(\"one\", function (t) {\n    // do action two...\n    t.done();\n});\n\ntask(\"othertask\");\n~~~\n\nWould result in a task \"othertask\" with no prerequisites, and no action, and a task \"one\" with \"othertask\" as a prerequisite and the two functions as its actions.\n\n**Note** how the dependent task was defined *after* it was required as a prerequisite. Task prerequisites are not resolved until the task is invoked. This leads to flexibility in how to compose your tasks and prerequisite tasks.\n\n\n### Task Instance Properties and Methods ###\n\n*   `name {string}` &mdash; the name of the task.\n*   `namespace {string}` &mdash; the task's namespace.\n*   `type {string}` &mdash; one of \"task\", \"file-task\", or \"file-create-task\"\n*   `fqn {string}` &mdash; the fully qualified name of the task. i.e: \"namespace:name\".\n*   `prerequisites {array}` &mdash; the list of prerequisite names for the task.\n*   `isNeeded {boolean}` &mdash; whether or not this task needs to run.\n*   `timestamp {boolean}` &mdash; the last modification time for the task.\n*   `invoke([args ...]) {Task}` &mdash; invoke the task passing args to each action for the task. Will run any prerequisites first. Returns the task instance.\n*   `execute([args ...]) {Task}` &mdash; Like `invoke`, but run the task even if it has already been run, or is not needed.\n*   `done()` &mdash; signal that the current task's action is done running.\n*   `abort([msg], [exitCode])` &mdash; abort the currently running task's actions, if _exitCode_ is specified **saké** will exit with that exit code and no other tasks will be processed. Otherwise, task processing will continue as normal.\n\n\n### Task Static Properties and Methods ###\n\n*   `namespace {string}` &mdash; the current namespace.\n*   `invoke(name, [rest ...]) {Task}` &mdash; invoke the named task and pass it the rest of the arguments.\n*   `get(name, [namespace]) {Task}` &mdash; get the task _name_, optionally start looking in _namespace_. Will throw an error if it can not find a task.\n*   `lookup(name, [namespace]) {Task|null}` &mdash; lookup a task with _name_, optionally start looking in _namespace_.\n*   `getAll() {array[Task]}` &mdash; return all defined tasks.\n*   `has(name, [namespace]) {boolean}` &mdash; does the task _name_ exist?\n*   `find(args, sortFn) {array[Task]}` &mdash; search for a task. _args_ can be an object with keys specifying which properties to match on, and their values denoting the value to match. _args_ can also be a function that accepts a task and returns a boolean whether or not that task matches.\n\n\nFile Tasks\n----------\n\nFile tasks are created with the (appropriately named) `file` method. File tasks are only triggered if the file doesn't exist, or the modification time of any of its prerequisites is newer than itself.\n\n~~~js\nfile(\"path/to/some/file\", function (t) {\n    cp(\"other/path\", t.name);\n    t.done();\n});\n~~~\n\nThe above task would only be triggered if `path/to/some/file` did not exist.\n\nThe following:\n\n~~~js\nfile(\"combined/file/path\", [\"pathA\", \"pathB\", \"pathC\"], function (t) {\n    write(t.name, cat(t.prerequisites), \"utf8\");\n    t.done();\n});\n~~~\n\nwould be triggered if `path/to/some/file` did not exist, or its modification time was earlier than any of its prerequisites (`pathA`, `pathB`, or  `pathC`).\n\n\nDirectory Tasks\n---------------\n\nDirectory tasks, created with the `directory` method, are tasks that will only be called if they do not exist. A task will be created for the named directory (and for all directories along the way) with the action of creating the directory.\n\nDirectory tasks do not take any `prerequisites` or an `action` when first defined, however, they may be augmented with such after they are created:\n\n~~~js\ndirectory(\"dir/path/to/create\");\n\ntask(\"dir/path/to/create\", [\"othertask\"], action (t) {\n    //... do stuff\n    t.done();\n});\n~~~\n\n\nFile Create Tasks\n-----------------\n\nA file create task is a file task, that when used as a prerequisite, will be needed if, and only if, the file has not been created. Once created, it is not re-triggered if any of its prerequisites are newer, nor does it trigger any rebuilds of tasks that depend on it whenever the file is updated.\n\n~~~js\nfileCreate(\"file/path/to/create.ext\", [\"pathA\", \"pathB\"], function (t) {\n    // create file...\n    t.done();\n});\n~~~\n\n\n(A)Synchronicity and Tasks\n--------------------------\n\nIn **saké** all task actions are assumed to be *asynchronous* and an action must call its task's `done` method to tell **saké** that it is done processing stuff.\n\n~~~js\ntask(\"long task\", function (t) {\n    sh(\"some long running shell command\", function (err, result) {\n        // do stuff...\n        t.done();\n    });\n});\n~~~\n\nAlternatively, you can use the `Sync` version of a task to add a *synchronous* action, and `done` will be called for you after the function completes.\n\n~~~js\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n~~~\n\nThere are `Sync` versions of all the core tasks: `taskSync`, `fileSync`, and `fileCreateSync`. There are also `Async` versions of each task: `taskAsync`, `fileAsync`, and `fileCreateAsync`. The actions created for a `directory` task are *synchronous*. You can add *asynchronous* task actions after the initial definition.\n\nThirdly, you can specify that all of the core task creation functions generate *synchronous* actions by setting **saké's** \"sync\" option to `true`, or by use of the command-line option `-S, --sync`.\n\n~~~js\nsake.options.sync = true;\n\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n\n//... define more synchronous tasks\n\n//... and then revert to async\nsake.options.sync = false;\n~~~\n\nUltimately, it is up to the **saké** script author to correctly designate a task action as *synchronous* or *asynchronous*. Nothing prevents the running of an *asynchronous* function within a task's *synchronous* action. If nothing is dependent on the result of that action, then no problem would occur. It's when other tasks rely on the completion of certain *asynchronous* actions, that problems may arise.\n\nIn the case of *asynchronous* actions, **Saké** will issue a `WARNING` when it can not detect a `done()` call within that action.\n\n\nNamespaces\n----------\n\n**Saké** supports simple name spacing of tasks. Simply prepend the namespace before the task name with a colon \":\". This can be done when defining a task, or in the list of prerequisites for a task.\n\n~~~js\n// Defines a task 'fuz' in the namespace 'foo' that depends on the task 'buz'\n// in the namespace 'baz'\ntask(\"foo:fuz\", [\"baz:buz\"], function (t) {\n    //...\n    t.done();\n});\n~~~\n\nThen invoke the task as so:\n\n~~~\n% sake foo:fuz\n~~~\n\nYou can also use the convenience function `namespace` to wrap your task definitions for a particular namespace. Any _namespace naked_ definitions will first be tried in the local namespace, otherwise they will fall-back to the default namespace:\n\n~~~js\n\ntask(\"default\", function (t) {\n    //...\n    t.done():\n});\n\ntask(\"bazil\", function (t) {\n    //...\n    t.done():\n});\n\n// define within the 'foo' namespace\nnamespace(\"foo\", function () {\n    \n    // defines 'foo:foom' task\n    task(\"foom\", function (t) {\n        //...\n        t.done():\n    });\n    \n});\n\nnamespace(\"baz\", function () {\n    \n    // this task is defined in the 'baz' namespace, and depends on the\n    // 'foom' task from the 'foo' namespace\n    task(\"bazil\", [\"foo:foom\"], function (t) {\n        //...\n        t.done():\n    });\n    // This task is also defined in the 'baz' namespace. It depends on \n    // the 'bazil' task, which is also defined in 'baz' namespace. It\n    // also depends on the 'default' task in the 'default' (top-level)\n    // namespace.\n    task(\"buzil\", [\"bazil\", \"default\"], function (t), {\n        //...\n        t.done():\n    });\n    // If 'bazil' wasn't defined in the 'baz' namespace, it would resolve\n    // to the 'default' namespace task.\n});\n~~~\n\n**Note:** prerequisite names are tied to the defined task's namespace. i.e: If a task \"foo:fuz\" depends on \"foom\" **saké** will look in the \"foo\" namespace for \"foom\", and then the \"default\" namespace.\n\n**Note:** although the `namespace` functions can be nested, **saké** does not track the hierarchy of `namespace` calls -- if a dependent task is not found in the current task's namespace, it will look for it in the default namespace.\n\n\nPassing Arguments to A Task\n---------------------------\n\nThere are two ways to pass arguments to a task.\n\nFirst, **saké** translates any arguments in the form of `ENV=VALUE` on the command-line into `process.env` values:\n\n~~~\n% sake build BUILD_TYPE=debug ENVIRONMENT=prod\n~~~\n\nWill set `process.env.BUILD_TYPE` to \"debug\" and `process.env.ENVIRONMENT` to \"prod\". The values are JSON parsed; so the values are translated into real JavaScript values (numbers, true, false, etc...).\n\nSecondly, **saké** passes all non-option, and non-ENV=VALUE, looking arguments from the command-line to the invoked task:\n\n~~~\n% sake foo 3.14 pie true\n~~~\n\nWill invoke the \"foo\" task and pass to each of foo's actions (after the task instance itself) `3.14`, \"pie\" and `true`. The arguments are also JSON parsed to get real JavaScript values.\n\n~~~js\ntask(\"foo\", function (t, amt, word, flag) {\n    log(amt);   // => 3.14\n    log(word);  // => \"pie\"\n    log(flag);  // => true\n});\n~~~\n\n**Note:** This differs from how **rake**, and **jake** do things. In **saké** you can only invoke one task on the command-line. All other arguments on the command-line are considered task arguments.\n\n\nIncluding Other Saké Files\n-------------------------------------\n\nYou can include other **saké** files with the `include` and `load` methods. The included files will be run in the **saké** context, so any variables declared will be set on the global **saké** context. This allows you to break your project build files up into discreet files. Just be aware of naming collisions.\n\nAll `require` and `include`, or `load` statements, are resolved relative to the current file, so you can create your own hierarchy of build dependencies.\n\nYou can also add your own paths to the list of ones that **saké** uses to resolve `requires`: `[sake.]includePaths` is an array of directory paths to search. They are tried in reverse order, so if you push a path on to the array that path will be tried first, followed by any others.\n\n~~~js\n// in a Sakefile\nincludePaths.push(\"some/path\");\n\nrequire(\"some-module\"); // will be tried in some/path/some-module.js\n~~~\n\nAlso, the `__dirname` and `__filename` properties are available in `included` files to help resolve local includes.\n\n~~~js\nvar Path = require(\"path\");\n\ninclude(Path.join(__dirname, \"include-dir/include-file\"));\n~~~\n\nSake Library\n------------\n\n**Saké** will load any `.sake`, `.sake.js`, or `.sake.coffee` files located in a `sakelib` directory relative to the `Sakefile` being run. This directory name can be modified with the `-l, --sakelib` option, and multiple directories can be specified. This allows you to re-use common tasks across multiple projects.\n\n\nFile Lists\n----------\n\nFileLists are lists of file paths.\n\n~~~js\nnew FileList(\"*.scss\");\n~~~\n\nWould contain all the file paths with a \".scss\" extension in the top-level directory of your project.\n\nYou can use FileLists pretty much like an `Array`. You can iterate them (with `forEach, filter, reduce`, etc...), `concat` them, `splice` them, and you get back a new FileList object.\n\nTo add files, or glob patterns to them, use the `#include` method:\n\n~~~js\nvar fl = new FileList(\"*.scss\");\nfl.include(\"core.css\", \"reset.css\", \"*.css\");\n~~~\n\nYou can also `exlucude` files by Glob pattern, `Regular Expression` pattern, or by use of a `function` that takes the file path as an argument and returns a `truthy` value to exclude a file.\n\n~~~js\n// Exclude by RegExp\nfl.exclude(/^dev-.*\\.css/);\n\n// Exclude by Glob pattern\nfl.exclude(\"dev-*.css\");\n\n// Exclude by function\nfl.exclude(function (path) {\n    return FS.statSync(path).mtime.getTime() < (Date.now() - 60 * 60 * 1000);\n});\n~~~\n\nTo get to the actual items of the FileList, use the `#items` property, or the `#toArray` method, to get a plain array back. You can also use the `#get` or `#set` methods to retrieve or set an item.\n\nFileLists are *lazy*, in that the actual file paths are not determined from the include and exclude patterns until the individual items are requested. This allows you to define a FileList and incrementally add patterns to it in the Sakefile file. The FileList paths will not be resolved until the task that uses it as a prerequisite actually asks for the final paths.\n\n\n### FileList Properties & Methods ###\n\n*   `existing` &mdash; will return a new `FileList` with all of the files that actually exist.\n*   `notExisting` &mdash; will return a new `FileList` of all the files that do not exist.\n*   `extension(ext)` &mdash; returns a new `FileList` with all paths that match the given extension.\n\n~~~js\nfl.extension(\".scss\").forEach(function (path) {\n    //...\n});\n~~~\n\n*   `grep(pattern)` &mdash; get a `FileList` of all the files that match the given `pattern`. `pattern` can be a plain `String`, a `Glob` pattern, a `RegExp`, or a `function` that receives each path and can return a truthy value to include it.\n*   `clearExcludes()` &mdash; clear all exclude patterns/functions.\n*   `clearIncludes()` &mdash; clear all include patterns.\n\nBy default, a `FileList` excludes directories. To allow directories call `FileList#clearExcludes()` before requesting any items.\n\n\nThe \"clean\" and \"clobber\" Tasks, and The CLEAN and CLOBBER FileLists\n--------------------------------------------------------------------\n\nWithin a `Sakefile`:\n\n~~~js\n// defines the CLEAN FileList and 'clean' task\nrequire(\"sake/clean\");\nCLEAN.include(\"**/*.js\");\n\n// defines the above, and also the CLOBBER FileTask and 'clobber' task\nrequire(\"sake/clobber\");\nCLOBBER.include(\"**/*.js\");\n~~~\n\nWhen the \"clean\" task is run, it will remove any files that have been included in the `CLEAN FileList`. \"clobber\" will remove any file, or directory, included in the `CLOBBER FileList`.\n\n\nSaké Utility Functions\n----------------------\n\nSaké defines a few utility functions to make life a little easier in an asynchronous world. Most of these are just wrappers for `node`'s File System (`require(\"fs\")`) utility methods.\n\n### Synchronous Utilities ###\n\n*   `mkdir(dirpath, mode=\"777\")` &mdash; create the `dirpath` directory, if it doesn't already exist.\n*   `mkdir_p(dirpath, mode=\"777\"])` &mdash; as above, but create all intermediate directories as needed.\n*   `rm(path, [path1, ..., pathN])` &mdash; remove one or more paths from the file system.\n*   `rm_rf(path, [path1, ..., pathN])` &mdash; as above, and remove directories and their contents.\n*   `cp(from, to)` &mdash; copy a file from `from` path to `to` path.\n*   `cp_r(from, to)` &mdash; copy all files from `from` path to `to` path.\n*   `mv(from, to)` &mdash; move a file from `from` path to `to` path.\n*   `ln(from, to)` &mdash; create a hard link from `from` path to `to` path.\n*   `ln_s(from, to)` &mdash; create a symlink from `from` path to `to` path.\n*   `cat(path, [path1, ..., pathN]) {string}` &mdash; read all supplied paths and return their contents as a string. If an argument is an `Array` it will be expanded and those paths will be read.\n*   `readdir(path) {array[string]}` &mdash; returns the files of directory `path`.\n*   `read(path, [enc]) {string|Buffer}` &mdash; read the supplied file path. Returns a `buffer`, or a `string` if `enc` is given.\n*   `write(path, data, [enc], mode=\"w\")` &mdash; write the `data` to the supplied file `path`. `data` should be a `buffer` or a `string` if `enc` is given. `mode` is a `string` of either \"w\", for over write,  or \"a\" for append.\n*   `slurp(path, [env]) {sring|Buffer}` &mdash; alias for `read`\n*   `spit(path, data, [enc], mode=\"w\")` &mdash; alias for `write`\n\n\n### Asynchronous Utilities ###\n\n*   `sh(cmd, fn(error, result))` &mdash; execute shell `cmd`. In the callback function, `error` will be a truthy value if there was an error, and `result` will contain the STDERR returned from `cmd`. Otherwise, `result` will contain the STDOUT from the `cmd`. If `cmd` is an array of shell commands, each one will be run before the next, and only when they all complete, or an error is encountered, will the callback `fn` be called, and `result` be an array of the results of the individual commands.\n\n\nDeveloper Notes\n---------------\n\n*   Due to an issue with npm v1.1.13 and up (see issue [#2490](https://github.com/isaacs/npm/issues/2490)), I had to move my code into the `node_modules/sake` directory and add a `bundleDependencies` array to the `package.json` file.\n\nReport an Issue\n---------------\n\n* [Bugs](http://github.com/jhamlet/node-sake/issues)\n* Contact the author: <jhamlet@hamletink.com>\n\n\nLicense\n-------\n\n> Copyright (c) 2012 Jerry Hamlet <jerry@hamletink.com>\n> \n> Permission is hereby granted, free of charge, to any person\n> obtaining a copy of this software and associated documentation\n> files (the \"Software\"), to deal in the Software without\n> restriction, including without limitation the rights to use,\n> copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the\n> Software is furnished to do so, subject to the following\n> conditions:\n> \n> The above copyright notice and this permission notice shall be\n> included in all copies or substantial portions of the Software.\n> \n> The Software shall be used for Good, not Evil.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n> OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n> HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n> WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n> FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n> OTHER DEALINGS IN THE SOFTWARE.\n\n","_id":"sake@0.1.23","dist":{"shasum":"7a613de2fe76eb8c643306b0f86354920adcda6b","tarball":"https://registry.npmjs.org/sake/-/sake-0.1.23.tgz","integrity":"sha512-lB3/L0TYibmKKZza8sZb10aTA8rNspinAdKm5Hs2/G3jPngz+bkRbvzaeVGaS6leJYaeHWAJg4AuifiIZnD/Jw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAQSMFgS3sJQ6+sFrgbScUTciGnnIw5L/5l+N1rMKh7CAiEAw8WJGe0mq7p0jWAAb6w8t11j/VYnqrLzQtbZk8xVAHU="}]},"maintainers":[{"name":"jhamlet","email":"jerry@hamletink.com"}],"directories":{}},"0.1.24":{"name":"sake","description":"[S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.","version":"0.1.24","keywords":["build","make","rake","jake"],"main":"./node_modules/sake/sake.js","bin":{"sake":"./bin/sake"},"dependencies":{"nomnom":">=1.5.x","async":">=0.1.x","resolve":">=0.2.x","proteus":"=0.0.10","wordwrap":">=0.0.2","glob":">=3.1.x","minimatch":">=0.2.x"},"devDependencies":{"mocha":">=0.3.x","should":">=0.5.x","underscore":">=1.3.x"},"bundleDependencies":["sake"],"scripts":{"test":"mocha test/test-*"},"licenses":[{"type":"MIT","url":"http://github.com/jhamlet/node-sake/raw/master/LICENSE"}],"repository":{"type":"git","url":"http://github.com/jhamlet/node-sake.git"},"bugs":{"url":"http://github.com/jhamlet/node-sake/issues"},"preferGlobal":true,"contributors":[{"name":"Jerry Hamlet","email":"jerry@hamletink.com"}],"readme":"\nSaké\n====\n\n> [S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.\n\n\nOverview\n--------\n\nThis package contains **saké**, a JavaScript build program that runs in node with capabilities similar to ruby's Rake.\n\nSaké has the following features:\n\n1.  `Sakefiles` (**saké’s** version of Rakefiles) are completely defined in standard JavaScript (or CoffeeScript, for those who want an even more Rake-like feel).\n2.  Flexible `FileLists` that act like arrays but know about manipulating file names and paths.\n3.  `clean` and `clobber` tasks are available for tidying up.\n4.  _Asynchronous_ task handling, with easy options for specifying _synchronous_ tasks.\n5.  Simple _namespacing_ of tasks to break projects into discreet parts.\n5.  Many utility methods for handling common build tasks (rm, rm_rf, mkdir, mkdir_p, sh, cat, etc...)\n\n\nInstallation\n------------\n\n### Install with npm\n\nDownload and install with the following:\n\n~~~\nnpm install -g sake\n~~~\n\nCommand-Line Usage\n------------------\n\n~~~\n% sake -h\n\nUsage: sake [TASKNAME] [ARGUMENTS ...] [ENV=VALUE ...] [options]\n\n[TASKNAME]     Name of the task to run. Defaults to 'default'.\n[ARGUMENTS ...]     Zero or more arguments to pass to the task invoked.\n[ENV=VALUE ...]     Zero or more arguments to translate into environment variables.\n\nOptions:\n   -f, --sakefile PATH       PATH to Sakefile to run instead of searching for one.\n   -T, --tasks [PATTERN]     List tasks with descriptions (optionally, just those\n                             matching PATTERN) and exit.\n   -P, --prereqs [PATTERN]   List tasks and their prerequisites (optionally, just\n                             those matching PATTERN) and exit.\n   -r, --require MODULE      Require MODULE before executing Sakefile and expose the\n                             MODULE under a sanitized namespace (i.e.: coffee-script\n                             => [sake.]coffeeScript). Can be specified multiple\n                             times.\n   -l, --sakelib PATH        Auto-include any .sake[.js|.coffeee] files in PATH.\n                             (default is 'sakelib'.) Can be specified multiple times\n   -n, --dry-run             Do a dry run without executing actions.\n   -C, --no-chdir            Do not change directory to the Sakefile location.\n   -N, --no-search           Do not search parent directories for a Sakefile.\n   -G, --no-system           Do not use SAKE_PATH environment variable to search for\n                             a Sakefile.\n   -S, --sync                Make all standard tasks 'synchronous' by default.\n   -d, --debug               Enable additional debugging output.\n   -q, --quiet               Suppress informational messages.\n   -V, --version             Print the version of sake and exit.\n   -h, --help                Print this help information and exit.\n\nIf a Sakefile is not specified, sake searches the current directory, and all parent\ndirectories, for one (unless -N, --no-search is set). Otherwise, if the SAKE_PATH\nenvironment variable is defined it searches those path(s) (unless -G, --no-system is\nset).\n\nIf specified, or found through normal searching (not in SAKE_PATH(s)), sake changes the\nprocess' current working directory to the directory of the found Sakefile (unless -C,\n--no-chdir is set), otherwise it stays where it was run from.\n\nSake then invokes the specified TASKNAME, or the \"default\" one.\n\nSakefile can be one of \"Sakefile\", or \"sakefile\", with an optional extension of \".js\",\nor \".coffee\".\n\n~~~\n\n### Dependencies ###\n\nThese are installed when **sake** is installed.\n\n~~~\nnomnom:    >=1.5.x\nasync:     >=0.1.x\nresolve:   >=0.2.x\nproteus:   >=0.0.x\nwordwrap:  >=0.0.2\nglob:      >=3.1.x\nminimatch: >=0.2.x\n~~~\n\n\n### Development Dependencies ###\n\nInstalled when you run `npm link` in the package directory.\n\n~~~\nmocha:      >=0.3.x\nshould:     >=0.5.x\nunderscore: >=1.3.x\n~~~\n\n\nSakefile Usage\n--------------\n\nWithin a `Sakefile`, Saké's methods are exported to the global scope, so you can invoke them directly:\n\n~~~js\ntask(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n~~~\n    \nWithin another node module you can `require(\"sake\")` and access the methods on the exported object, or even run a block of code in the **saké** context (virtual machine):\n\n~~~js\nvar sake = require(\"sake\");\n    \nsake.task(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n\n// The function passed to sake#run is compiled and run in the sake context.\n// The function **will not** have access to any variables in this scope,\n// nor, will variables leak from the function's scope into this one.\nsake.run(function () {\n    var jsFiles = new FileList(\"src/js/**/*.js\");\n    \n    require(\"sake/clean\");\n    \n    task(\"script-min.js\", jsFiles, function (t) {\n        var cmd = \"infuse \" + jsFiles.map(function (path) {\n                return \"-i \" + path;\n            }) + \" -E\";\n            \n        sh(cmd, function (err, result) {\n            write(t.name, result, \"utf8\");\n            t.done();\n        })\n    });\n    \n    CLEAN.include(\"script-min.js\");\n});\n~~~\n\nThe remainder of this documentation will assume that we are calling the methods from within a `Sakefile`.\n\n\nDefining Tasks\n--------------\n\nThe various task methods take the following arguments:\n\n1.   `taskname`: `string` &mdash; naming the task\n2.   `prerequisites`: _optional_ \n    *   an `array` of:\n        *   `string` task name, or\n        *   a `FileLists`, or \n        *   a `function` that returns one of the above.\n    *   or, you can also pass a `FileList` in directly for `prerequisites`.\n3.   `action`: an _optional_ `function` that will be called when the task is invoked. It will be passed the task instance as its first argument, followed by any arguments that it was invoked with (either from the command-line, or through code). Task arguments can also be accessed through the instance's `arguments` property. i.e: `t.arguments`.\n\nAll task methods return the task *instance*.\n\nIf a task is already defined, it will be augmented by the additional arguments. So, this:\n\n~~~js\ntask(\"one\", [\"othertask\"], function (t) {\n    // do action one...\n    t.done();\n});\n\ntask(\"one\", function (t) {\n    // do action two...\n    t.done();\n});\n\ntask(\"othertask\");\n~~~\n\nWould result in a task \"othertask\" with no prerequisites, and no action, and a task \"one\" with \"othertask\" as a prerequisite and the two functions as its actions.\n\n**Note** how the dependent task was defined *after* it was required as a prerequisite. Task prerequisites are not resolved until the task is invoked. This leads to flexibility in how to compose your tasks and prerequisite tasks.\n\n\n### Task Instance Properties and Methods ###\n\n*   `name {string}` &mdash; the name of the task.\n*   `namespace {string}` &mdash; the task's namespace.\n*   `type {string}` &mdash; one of \"task\", \"file-task\", or \"file-create-task\"\n*   `fqn {string}` &mdash; the fully qualified name of the task. i.e: \"namespace:name\".\n*   `prerequisites {array}` &mdash; the list of prerequisite names for the task.\n*   `isNeeded {boolean}` &mdash; whether or not this task needs to run.\n*   `timestamp {boolean}` &mdash; the last modification time for the task.\n*   `invoke([args ...]) {Task}` &mdash; invoke the task passing args to each action for the task. Will run any prerequisites first. Returns the task instance.\n*   `execute([args ...]) {Task}` &mdash; Like `invoke`, but run the task even if it has already been run, or is not needed.\n*   `done()` &mdash; signal that the current task's action is done running.\n*   `abort([msg], [exitCode])` &mdash; abort the currently running task's actions, if _exitCode_ is specified **saké** will exit with that exit code and no other tasks will be processed. Otherwise, task processing will continue as normal.\n\n\n### Task Static Properties and Methods ###\n\n*   `namespace {string}` &mdash; the current namespace.\n*   `invoke(name, [rest ...]) {Task}` &mdash; invoke the named task and pass it the rest of the arguments.\n*   `get(name, [namespace]) {Task}` &mdash; get the task _name_, optionally start looking in _namespace_. Will throw an error if it can not find a task.\n*   `lookup(name, [namespace]) {Task|null}` &mdash; lookup a task with _name_, optionally start looking in _namespace_.\n*   `getAll() {array[Task]}` &mdash; return all defined tasks.\n*   `has(name, [namespace]) {boolean}` &mdash; does the task _name_ exist?\n*   `find(args, sortFn) {array[Task]}` &mdash; search for a task. _args_ can be an object with keys specifying which properties to match on, and their values denoting the value to match. _args_ can also be a function that accepts a task and returns a boolean whether or not that task matches.\n\n\nFile Tasks\n----------\n\nFile tasks are created with the (appropriately named) `file` method. File tasks are only triggered if the file doesn't exist, or the modification time of any of its prerequisites is newer than itself.\n\n~~~js\nfile(\"path/to/some/file\", function (t) {\n    cp(\"other/path\", t.name);\n    t.done();\n});\n~~~\n\nThe above task would only be triggered if `path/to/some/file` did not exist.\n\nThe following:\n\n~~~js\nfile(\"combined/file/path\", [\"pathA\", \"pathB\", \"pathC\"], function (t) {\n    write(t.name, cat(t.prerequisites), \"utf8\");\n    t.done();\n});\n~~~\n\nwould be triggered if `path/to/some/file` did not exist, or its modification time was earlier than any of its prerequisites (`pathA`, `pathB`, or  `pathC`).\n\n\nDirectory Tasks\n---------------\n\nDirectory tasks, created with the `directory` method, are tasks that will only be called if they do not exist. A task will be created for the named directory (and for all directories along the way) with the action of creating the directory.\n\nDirectory tasks do not take any `prerequisites` or an `action` when first defined, however, they may be augmented with such after they are created:\n\n~~~js\ndirectory(\"dir/path/to/create\");\n\ntask(\"dir/path/to/create\", [\"othertask\"], action (t) {\n    //... do stuff\n    t.done();\n});\n~~~\n\n\nFile Create Tasks\n-----------------\n\nA file create task is a file task, that when used as a prerequisite, will be needed if, and only if, the file has not been created. Once created, it is not re-triggered if any of its prerequisites are newer, nor does it trigger any rebuilds of tasks that depend on it whenever the file is updated.\n\n~~~js\nfileCreate(\"file/path/to/create.ext\", [\"pathA\", \"pathB\"], function (t) {\n    // create file...\n    t.done();\n});\n~~~\n\n\n(A)Synchronicity and Tasks\n--------------------------\n\nIn **saké** all task actions are assumed to be *asynchronous* and an action must call its task's `done` method to tell **saké** that it is done processing stuff.\n\n~~~js\ntask(\"long task\", function (t) {\n    sh(\"some long running shell command\", function (err, result) {\n        // do stuff...\n        t.done();\n    });\n});\n~~~\n\nAlternatively, you can use the `Sync` version of a task to add a *synchronous* action, and `done` will be called for you after the function completes.\n\n~~~js\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n~~~\n\nThere are `Sync` versions of all the core tasks: `taskSync`, `fileSync`, and `fileCreateSync`. There are also `Async` versions of each task: `taskAsync`, `fileAsync`, and `fileCreateAsync`. The actions created for a `directory` task are *synchronous*. You can add *asynchronous* task actions after the initial definition.\n\nThirdly, you can specify that all of the core task creation functions generate *synchronous* actions by setting **saké's** \"sync\" option to `true`, or by use of the command-line option `-S, --sync`.\n\n~~~js\nsake.options.sync = true;\n\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n\n//... define more synchronous tasks\n\n//... and then revert to async\nsake.options.sync = false;\n~~~\n\nUltimately, it is up to the **saké** script author to correctly designate a task action as *synchronous* or *asynchronous*. Nothing prevents the running of an *asynchronous* function within a task's *synchronous* action. If nothing is dependent on the result of that action, then no problem would occur. It's when other tasks rely on the completion of certain *asynchronous* actions, that problems may arise.\n\nIn the case of *asynchronous* actions, **Saké** will issue a `WARNING` when it can not detect a `done()` call within that action.\n\n\nNamespaces\n----------\n\n**Saké** supports simple name spacing of tasks. Simply prepend the namespace before the task name with a colon \":\". This can be done when defining a task, or in the list of prerequisites for a task.\n\n~~~js\n// Defines a task 'fuz' in the namespace 'foo' that depends on the task 'buz'\n// in the namespace 'baz'\ntask(\"foo:fuz\", [\"baz:buz\"], function (t) {\n    //...\n    t.done();\n});\n~~~\n\nThen invoke the task as so:\n\n~~~\n% sake foo:fuz\n~~~\n\nYou can also use the convenience function `namespace` to wrap your task definitions for a particular namespace. Any _namespace naked_ definitions will first be tried in the local namespace, otherwise they will fall-back to the default namespace:\n\n~~~js\n\ntask(\"default\", function (t) {\n    //...\n    t.done():\n});\n\ntask(\"bazil\", function (t) {\n    //...\n    t.done():\n});\n\n// define within the 'foo' namespace\nnamespace(\"foo\", function () {\n    \n    // defines 'foo:foom' task\n    task(\"foom\", function (t) {\n        //...\n        t.done():\n    });\n    \n});\n\nnamespace(\"baz\", function () {\n    \n    // this task is defined in the 'baz' namespace, and depends on the\n    // 'foom' task from the 'foo' namespace\n    task(\"bazil\", [\"foo:foom\"], function (t) {\n        //...\n        t.done():\n    });\n    // This task is also defined in the 'baz' namespace. It depends on \n    // the 'bazil' task, which is also defined in 'baz' namespace. It\n    // also depends on the 'default' task in the 'default' (top-level)\n    // namespace.\n    task(\"buzil\", [\"bazil\", \"default\"], function (t), {\n        //...\n        t.done():\n    });\n    // If 'bazil' wasn't defined in the 'baz' namespace, it would resolve\n    // to the 'default' namespace task.\n});\n~~~\n\n**Note:** prerequisite names are tied to the defined task's namespace. i.e: If a task \"foo:fuz\" depends on \"foom\" **saké** will look in the \"foo\" namespace for \"foom\", and then the \"default\" namespace.\n\n**Note:** although the `namespace` functions can be nested, **saké** does not track the hierarchy of `namespace` calls -- if a dependent task is not found in the current task's namespace, it will look for it in the default namespace.\n\n\nPassing Arguments to A Task\n---------------------------\n\nThere are two ways to pass arguments to a task.\n\nFirst, **saké** translates any arguments in the form of `ENV=VALUE` on the command-line into `process.env` values:\n\n~~~\n% sake build BUILD_TYPE=debug ENVIRONMENT=prod\n~~~\n\nWill set `process.env.BUILD_TYPE` to \"debug\" and `process.env.ENVIRONMENT` to \"prod\". The values are JSON parsed; so the values are translated into real JavaScript values (numbers, true, false, etc...).\n\nSecondly, **saké** passes all non-option, and non-ENV=VALUE, looking arguments from the command-line to the invoked task:\n\n~~~\n% sake foo 3.14 pie true\n~~~\n\nWill invoke the \"foo\" task and pass to each of foo's actions (after the task instance itself) `3.14`, \"pie\" and `true`. The arguments are also JSON parsed to get real JavaScript values.\n\n~~~js\ntask(\"foo\", function (t, amt, word, flag) {\n    log(amt);   // => 3.14\n    log(word);  // => \"pie\"\n    log(flag);  // => true\n});\n~~~\n\n**Note:** This differs from how **rake**, and **jake** do things. In **saké** you can only invoke one task on the command-line. All other arguments on the command-line are considered task arguments.\n\n\nIncluding Other Saké Files\n-------------------------------------\n\nYou can include other **saké** files with the `include` and `load` methods. The included files will be run in the **saké** context, so any variables declared will be set on the global **saké** context. This allows you to break your project build files up into discreet files. Just be aware of naming collisions.\n\nAll `require` and `include`, or `load` statements, are resolved relative to the current file, so you can create your own hierarchy of build dependencies.\n\nYou can also add your own paths to the list of ones that **saké** uses to resolve `requires`: `[sake.]includePaths` is an array of directory paths to search. They are tried in reverse order, so if you push a path on to the array that path will be tried first, followed by any others.\n\n~~~js\n// in a Sakefile\nincludePaths.push(\"some/path\");\n\nrequire(\"some-module\"); // will be tried in some/path/some-module.js\n~~~\n\nAlso, the `__dirname` and `__filename` properties are available in `included` files to help resolve local includes.\n\n~~~js\nvar Path = require(\"path\");\n\ninclude(Path.join(__dirname, \"include-dir/include-file\"));\n~~~\n\nSake Library\n------------\n\n**Saké** will load any `.sake`, `.sake.js`, or `.sake.coffee` files located in a `sakelib` directory relative to the `Sakefile` being run. This directory name can be modified with the `-l, --sakelib` option, and multiple directories can be specified. This allows you to re-use common tasks across multiple projects.\n\n\nFile Lists\n----------\n\nFileLists are lists of file paths.\n\n~~~js\nnew FileList(\"*.scss\");\n~~~\n\nWould contain all the file paths with a \".scss\" extension in the top-level directory of your project.\n\nYou can use FileLists pretty much like an `Array`. You can iterate them (with `forEach, filter, reduce`, etc...), `concat` them, `splice` them, and you get back a new FileList object.\n\nTo add files, or glob patterns to them, use the `#include` method:\n\n~~~js\nvar fl = new FileList(\"*.scss\");\nfl.include(\"core.css\", \"reset.css\", \"*.css\");\n~~~\n\nYou can also `exlucude` files by Glob pattern, `Regular Expression` pattern, or by use of a `function` that takes the file path as an argument and returns a `truthy` value to exclude a file.\n\n~~~js\n// Exclude by RegExp\nfl.exclude(/^dev-.*\\.css/);\n\n// Exclude by Glob pattern\nfl.exclude(\"dev-*.css\");\n\n// Exclude by function\nfl.exclude(function (path) {\n    return FS.statSync(path).mtime.getTime() < (Date.now() - 60 * 60 * 1000);\n});\n~~~\n\nTo get to the actual items of the FileList, use the `#items` property, or the `#toArray` method, to get a plain array back. You can also use the `#get` or `#set` methods to retrieve or set an item.\n\nFileLists are *lazy*, in that the actual file paths are not determined from the include and exclude patterns until the individual items are requested. This allows you to define a FileList and incrementally add patterns to it in the Sakefile file. The FileList paths will not be resolved until the task that uses it as a prerequisite actually asks for the final paths.\n\n\n### FileList Properties & Methods ###\n\n*   `existing` &mdash; will return a new `FileList` with all of the files that actually exist.\n*   `notExisting` &mdash; will return a new `FileList` of all the files that do not exist.\n*   `extension(ext)` &mdash; returns a new `FileList` with all paths that match the given extension.\n\n~~~js\nfl.extension(\".scss\").forEach(function (path) {\n    //...\n});\n~~~\n\n*   `grep(pattern)` &mdash; get a `FileList` of all the files that match the given `pattern`. `pattern` can be a plain `String`, a `Glob` pattern, a `RegExp`, or a `function` that receives each path and can return a truthy value to include it.\n*   `clearExcludes()` &mdash; clear all exclude patterns/functions.\n*   `clearIncludes()` &mdash; clear all include patterns.\n\nBy default, a `FileList` excludes directories. To allow directories call `FileList#clearExcludes()` before requesting any items.\n\n\nThe \"clean\" and \"clobber\" Tasks, and The CLEAN and CLOBBER FileLists\n--------------------------------------------------------------------\n\nWithin a `Sakefile`:\n\n~~~js\n// defines the CLEAN FileList and 'clean' task\nrequire(\"sake/clean\");\nCLEAN.include(\"**/*.js\");\n\n// defines the above, and also the CLOBBER FileTask and 'clobber' task\nrequire(\"sake/clobber\");\nCLOBBER.include(\"**/*.js\");\n~~~\n\nWhen the \"clean\" task is run, it will remove any files that have been included in the `CLEAN FileList`. \"clobber\" will remove any file, or directory, included in the `CLOBBER FileList`.\n\n\nSaké Utility Functions\n----------------------\n\nSaké defines a few utility functions to make life a little easier in an asynchronous world. Most of these are just wrappers for `node`'s File System (`require(\"fs\")`) utility methods.\n\n### Synchronous Utilities ###\n\n*   `mkdir(dirpath, mode=\"777\")` &mdash; create the `dirpath` directory, if it doesn't already exist.\n*   `mkdir_p(dirpath, mode=\"777\"])` &mdash; as above, but create all intermediate directories as needed.\n*   `rm(path, [path1, ..., pathN])` &mdash; remove one or more paths from the file system.\n*   `rm_rf(path, [path1, ..., pathN])` &mdash; as above, and remove directories and their contents.\n*   `cp(from, to)` &mdash; copy a file from `from` path to `to` path.\n*   `cp_r(from, to)` &mdash; copy all files from `from` path to `to` path.\n*   `mv(from, to)` &mdash; move a file from `from` path to `to` path.\n*   `ln(from, to)` &mdash; create a hard link from `from` path to `to` path.\n*   `ln_s(from, to)` &mdash; create a symlink from `from` path to `to` path.\n*   `cat(path, [path1, ..., pathN]) {string}` &mdash; read all supplied paths and return their contents as a string. If an argument is an `Array` it will be expanded and those paths will be read.\n*   `readdir(path) {array[string]}` &mdash; returns the files of directory `path`.\n*   `read(path, [enc]) {string|Buffer}` &mdash; read the supplied file path. Returns a `buffer`, or a `string` if `enc` is given.\n*   `write(path, data, [enc], mode=\"w\")` &mdash; write the `data` to the supplied file `path`. `data` should be a `buffer` or a `string` if `enc` is given. `mode` is a `string` of either \"w\", for over write,  or \"a\" for append.\n*   `slurp(path, [env]) {sring|Buffer}` &mdash; alias for `read`\n*   `spit(path, data, [enc], mode=\"w\")` &mdash; alias for `write`\n\n\n### Asynchronous Utilities ###\n\n*   `sh(cmd, fn(error, result))` &mdash; execute shell `cmd`. In the callback function, `error` will be a truthy value if there was an error, and `result` will contain the STDERR returned from `cmd`. Otherwise, `result` will contain the STDOUT from the `cmd`. If `cmd` is an array of shell commands, each one will be run before the next, and only when they all complete, or an error is encountered, will the callback `fn` be called, and `result` be an array of the results of the individual commands.\n\n\nDeveloper Notes\n---------------\n\n*   Due to an issue with npm v1.1.13 and up (see issue [#2490](https://github.com/isaacs/npm/issues/2490)), I had to move my code into the `node_modules/sake` directory and add a `bundleDependencies` array to the `package.json` file.\n\nReport an Issue\n---------------\n\n* [Bugs](http://github.com/jhamlet/node-sake/issues)\n* Contact the author: <jhamlet@hamletink.com>\n\n\nLicense\n-------\n\n> Copyright (c) 2012 Jerry Hamlet <jerry@hamletink.com>\n> \n> Permission is hereby granted, free of charge, to any person\n> obtaining a copy of this software and associated documentation\n> files (the \"Software\"), to deal in the Software without\n> restriction, including without limitation the rights to use,\n> copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the\n> Software is furnished to do so, subject to the following\n> conditions:\n> \n> The above copyright notice and this permission notice shall be\n> included in all copies or substantial portions of the Software.\n> \n> The Software shall be used for Good, not Evil.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n> OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n> HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n> WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n> FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n> OTHER DEALINGS IN THE SOFTWARE.\n\n","_id":"sake@0.1.24","dist":{"shasum":"c5ff79cf4ce09056cd5afaffca7b643e02912bc2","tarball":"https://registry.npmjs.org/sake/-/sake-0.1.24.tgz","integrity":"sha512-Jtat43zn4BsYzmVBzHmEyenIRgqXSWIpPI1HOdCO5cOhXdhZTiP/LFJaUIf/dmWcDIkoZPrmShjkyspDgVQdfg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCznDPZsOA97Xan2xxTgO2k/7+UoP3FVO0/WYe+2ce1UAIgNWLz3c+Q0X83sK/pJUvo8tg2o8ZrWixCwJA/mPwWXsA="}]},"maintainers":[{"name":"jhamlet","email":"jerry@hamletink.com"}]},"0.1.25":{"name":"sake","description":"[S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.","version":"0.1.25","keywords":["build","make","rake","jake"],"main":"./node_modules/sake/sake.js","bin":{"sake":"./bin/sake"},"dependencies":{"nomnom":">=1.5.x","async":">=0.1.x","resolve":">=0.2.x","proteus":"=0.1.x","wordwrap":">=0.0.2","glob":">=3.1.x","minimatch":">=0.2.x"},"devDependencies":{"mocha":">=0.3.x","should":">=0.5.x","underscore":">=1.3.x"},"bundleDependencies":["sake"],"scripts":{"test":"mocha test/test-*"},"licenses":[{"type":"MIT","url":"http://github.com/jhamlet/node-sake/raw/master/LICENSE"}],"repository":{"type":"git","url":"http://github.com/jhamlet/node-sake.git"},"bugs":{"url":"http://github.com/jhamlet/node-sake/issues"},"preferGlobal":true,"contributors":[{"name":"Jerry Hamlet","email":"jerry@hamletink.com"}],"readme":"\nSaké\n====\n\n> [S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.\n\n\nOverview\n--------\n\nThis package contains **saké**, a JavaScript build program that runs in node with capabilities similar to ruby's Rake.\n\nSaké has the following features:\n\n1.  `Sakefiles` (**saké’s** version of Rakefiles) are completely defined in standard JavaScript (or CoffeeScript, for those who want an even more Rake-like feel).\n2.  Flexible `FileLists` that act like arrays but know about manipulating file names and paths.\n3.  `clean` and `clobber` tasks are available for tidying up.\n4.  _Asynchronous_ task handling, with easy options for specifying _synchronous_ tasks.\n5.  Simple _namespacing_ of tasks to break projects into discreet parts.\n5.  Many utility methods for handling common build tasks (rm, rm_rf, mkdir, mkdir_p, sh, cat, etc...)\n\n\nInstallation\n------------\n\n### Install with npm\n\nDownload and install with the following:\n\n~~~\nnpm install -g sake\n~~~\n\nCommand-Line Usage\n------------------\n\n~~~\n% sake -h\n\nUsage: sake [TASKNAME] [ARGUMENTS ...] [ENV=VALUE ...] [options]\n\n[TASKNAME]     Name of the task to run. Defaults to 'default'.\n[ARGUMENTS ...]     Zero or more arguments to pass to the task invoked.\n[ENV=VALUE ...]     Zero or more arguments to translate into environment variables.\n\nOptions:\n   -f, --sakefile PATH       PATH to Sakefile to run instead of searching for one.\n   -T, --tasks [PATTERN]     List tasks with descriptions (optionally, just those\n                             matching PATTERN) and exit.\n   -P, --prereqs [PATTERN]   List tasks and their prerequisites (optionally, just\n                             those matching PATTERN) and exit.\n   -r, --require MODULE      Require MODULE before executing Sakefile and expose the\n                             MODULE under a sanitized namespace (i.e.: coffee-script\n                             => [sake.]coffeeScript). Can be specified multiple\n                             times.\n   -l, --sakelib PATH        Auto-include any .sake[.js|.coffeee] files in PATH.\n                             (default is 'sakelib'.) Can be specified multiple times\n   -n, --dry-run             Do a dry run without executing actions.\n   -C, --no-chdir            Do not change directory to the Sakefile location.\n   -N, --no-search           Do not search parent directories for a Sakefile.\n   -G, --no-system           Do not use SAKE_PATH environment variable to search for\n                             a Sakefile.\n   -S, --sync                Make all standard tasks 'synchronous' by default.\n   -d, --debug               Enable additional debugging output.\n   -q, --quiet               Suppress informational messages.\n   -V, --version             Print the version of sake and exit.\n   -h, --help                Print this help information and exit.\n\nIf a Sakefile is not specified, sake searches the current directory, and all parent\ndirectories, for one (unless -N, --no-search is set). Otherwise, if the SAKE_PATH\nenvironment variable is defined it searches those path(s) (unless -G, --no-system is\nset).\n\nIf specified, or found through normal searching (not in SAKE_PATH(s)), sake changes the\nprocess' current working directory to the directory of the found Sakefile (unless -C,\n--no-chdir is set), otherwise it stays where it was run from.\n\nSake then invokes the specified TASKNAME, or the \"default\" one.\n\nSakefile can be one of \"Sakefile\", or \"sakefile\", with an optional extension of \".js\",\nor \".coffee\".\n\n~~~\n\n### Dependencies ###\n\nThese are installed when **sake** is installed.\n\n~~~\nnomnom:    >=1.5.x\nasync:     >=0.1.x\nresolve:   >=0.2.x\nproteus:   =0.1.x\nwordwrap:  >=0.0.2\nglob:      >=3.1.x\nminimatch: >=0.2.x\n~~~\n\n\n### Development Dependencies ###\n\nInstalled when you run `npm link` in the package directory.\n\n~~~\nmocha:      >=0.3.x\nshould:     >=0.5.x\nunderscore: >=1.3.x\n~~~\n\n\nSakefile Usage\n--------------\n\nWithin a `Sakefile`, Saké's methods are exported to the global scope, so you can invoke them directly:\n\n~~~js\ntask(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n~~~\n    \nWithin another node module you can `require(\"sake\")` and access the methods on the exported object, or even run a block of code in the **saké** context (virtual machine):\n\n~~~js\nvar sake = require(\"sake\");\n    \nsake.task(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n\n// The function passed to sake#run is compiled and run in the sake context.\n// The function **will not** have access to any variables in this scope,\n// nor, will variables leak from the function's scope into this one.\nsake.run(function () {\n    var jsFiles = new FileList(\"src/js/**/*.js\");\n    \n    require(\"sake/clean\");\n    \n    task(\"script-min.js\", jsFiles, function (t) {\n        var cmd = \"infuse \" + jsFiles.map(function (path) {\n                return \"-i \" + path;\n            }) + \" -E\";\n            \n        sh(cmd, function (err, result) {\n            write(t.name, result, \"utf8\");\n            t.done();\n        })\n    });\n    \n    CLEAN.include(\"script-min.js\");\n});\n~~~\n\nThe remainder of this documentation will assume that we are calling the methods from within a `Sakefile`.\n\n\nDefining Tasks\n--------------\n\nThe various task methods take the following arguments:\n\n1.   `taskname`: `string` &mdash; naming the task\n2.   `prerequisites`: _optional_ \n    *   an `array` of:\n        *   `string` task name, or\n        *   a `FileLists`, or \n        *   a `function` that returns one of the above.\n    *   or, you can also pass a `FileList` in directly for `prerequisites`.\n3.   `action`: an _optional_ `function` that will be called when the task is invoked. It will be passed the task instance as its first argument, followed by any arguments that it was invoked with (either from the command-line, or through code). Task arguments can also be accessed through the instance's `arguments` property. i.e: `t.arguments`.\n\nAll task methods return the task *instance*.\n\nIf a task is already defined, it will be augmented by the additional arguments. So, this:\n\n~~~js\ntask(\"one\", [\"othertask\"], function (t) {\n    // do action one...\n    t.done();\n});\n\ntask(\"one\", function (t) {\n    // do action two...\n    t.done();\n});\n\ntask(\"othertask\");\n~~~\n\nWould result in a task \"othertask\" with no prerequisites, and no action, and a task \"one\" with \"othertask\" as a prerequisite and the two functions as its actions.\n\n**Note** how the dependent task was defined *after* it was required as a prerequisite. Task prerequisites are not resolved until the task is invoked. This leads to flexibility in how to compose your tasks and prerequisite tasks.\n\n\n### Task Instance Properties and Methods ###\n\n*   `name {string}` &mdash; the name of the task.\n*   `namespace {string}` &mdash; the task's namespace.\n*   `type {string}` &mdash; one of \"task\", \"file-task\", or \"file-create-task\"\n*   `fqn {string}` &mdash; the fully qualified name of the task. i.e: \"namespace:name\".\n*   `prerequisites {array}` &mdash; the list of prerequisite names for the task.\n*   `isNeeded {boolean}` &mdash; whether or not this task needs to run.\n*   `timestamp {boolean}` &mdash; the last modification time for the task.\n*   `invoke([args ...]) {Task}` &mdash; invoke the task passing args to each action for the task. Will run any prerequisites first. Returns the task instance.\n*   `execute([args ...]) {Task}` &mdash; Like `invoke`, but run the task even if it has already been run, or is not needed.\n*   `done()` &mdash; signal that the current task's action is done running.\n*   `abort([msg], [exitCode])` &mdash; abort the currently running task's actions, if _exitCode_ is specified **saké** will exit with that exit code and no other tasks will be processed. Otherwise, task processing will continue as normal.\n\n\n### Task Static Properties and Methods ###\n\n*   `namespace {string}` &mdash; the current namespace.\n*   `invoke(name, [rest ...]) {Task}` &mdash; invoke the named task and pass it the rest of the arguments.\n*   `get(name, [namespace]) {Task}` &mdash; get the task _name_, optionally start looking in _namespace_. Will throw an error if it can not find a task.\n*   `lookup(name, [namespace]) {Task|null}` &mdash; lookup a task with _name_, optionally start looking in _namespace_.\n*   `getAll() {array[Task]}` &mdash; return all defined tasks.\n*   `has(name, [namespace]) {boolean}` &mdash; does the task _name_ exist?\n*   `find(args, sortFn) {array[Task]}` &mdash; search for a task. _args_ can be an object with keys specifying which properties to match on, and their values denoting the value to match. _args_ can also be a function that accepts a task and returns a boolean whether or not that task matches.\n\n\nFile Tasks\n----------\n\nFile tasks are created with the (appropriately named) `file` method. File tasks are only triggered if the file doesn't exist, or the modification time of any of its prerequisites is newer than itself.\n\n~~~js\nfile(\"path/to/some/file\", function (t) {\n    cp(\"other/path\", t.name);\n    t.done();\n});\n~~~\n\nThe above task would only be triggered if `path/to/some/file` did not exist.\n\nThe following:\n\n~~~js\nfile(\"combined/file/path\", [\"pathA\", \"pathB\", \"pathC\"], function (t) {\n    write(t.name, cat(t.prerequisites), \"utf8\");\n    t.done();\n});\n~~~\n\nwould be triggered if `path/to/some/file` did not exist, or its modification time was earlier than any of its prerequisites (`pathA`, `pathB`, or  `pathC`).\n\n\nDirectory Tasks\n---------------\n\nDirectory tasks, created with the `directory` method, are tasks that will only be called if they do not exist. A task will be created for the named directory (and for all directories along the way) with the action of creating the directory.\n\nDirectory tasks do not take any `prerequisites` or an `action` when first defined, however, they may be augmented with such after they are created:\n\n~~~js\ndirectory(\"dir/path/to/create\");\n\ntask(\"dir/path/to/create\", [\"othertask\"], action (t) {\n    //... do stuff\n    t.done();\n});\n~~~\n\n\nFile Create Tasks\n-----------------\n\nA file create task is a file task, that when used as a prerequisite, will be needed if, and only if, the file has not been created. Once created, it is not re-triggered if any of its prerequisites are newer, nor does it trigger any rebuilds of tasks that depend on it whenever the file is updated.\n\n~~~js\nfileCreate(\"file/path/to/create.ext\", [\"pathA\", \"pathB\"], function (t) {\n    // create file...\n    t.done();\n});\n~~~\n\n\n(A)Synchronicity and Tasks\n--------------------------\n\nIn **saké** all task actions are assumed to be *asynchronous* and an action must call its task's `done` method to tell **saké** that it is done processing stuff.\n\n~~~js\ntask(\"long task\", function (t) {\n    sh(\"some long running shell command\", function (err, result) {\n        // do stuff...\n        t.done();\n    });\n});\n~~~\n\nAlternatively, you can use the `Sync` version of a task to add a *synchronous* action, and `done` will be called for you after the function completes.\n\n~~~js\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n~~~\n\nThere are `Sync` versions of all the core tasks: `taskSync`, `fileSync`, and `fileCreateSync`. There are also `Async` versions of each task: `taskAsync`, `fileAsync`, and `fileCreateAsync`. The actions created for a `directory` task are *synchronous*. You can add *asynchronous* task actions after the initial definition.\n\nThirdly, you can specify that all of the core task creation functions generate *synchronous* actions by setting **saké's** \"sync\" option to `true`, or by use of the command-line option `-S, --sync`.\n\n~~~js\nsake.options.sync = true;\n\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n\n//... define more synchronous tasks\n\n//... and then revert to async\nsake.options.sync = false;\n~~~\n\nUltimately, it is up to the **saké** script author to correctly designate a task action as *synchronous* or *asynchronous*. Nothing prevents the running of an *asynchronous* function within a task's *synchronous* action. If nothing is dependent on the result of that action, then no problem would occur. It's when other tasks rely on the completion of certain *asynchronous* actions, that problems may arise.\n\nIn the case of *asynchronous* actions, **Saké** will issue a `WARNING` when it can not detect a `done()` call within that action.\n\n\nNamespaces\n----------\n\n**Saké** supports simple name spacing of tasks. Simply prepend the namespace before the task name with a colon \":\". This can be done when defining a task, or in the list of prerequisites for a task.\n\n~~~js\n// Defines a task 'fuz' in the namespace 'foo' that depends on the task 'buz'\n// in the namespace 'baz'\ntask(\"foo:fuz\", [\"baz:buz\"], function (t) {\n    //...\n    t.done();\n});\n~~~\n\nThen invoke the task as so:\n\n~~~\n% sake foo:fuz\n~~~\n\nYou can also use the convenience function `namespace` to wrap your task definitions for a particular namespace. Any _namespace naked_ definitions will first be tried in the local namespace, otherwise they will fall-back to the default namespace:\n\n~~~js\n\ntask(\"default\", function (t) {\n    //...\n    t.done():\n});\n\ntask(\"bazil\", function (t) {\n    //...\n    t.done():\n});\n\n// define within the 'foo' namespace\nnamespace(\"foo\", function () {\n    \n    // defines 'foo:foom' task\n    task(\"foom\", function (t) {\n        //...\n        t.done():\n    });\n    \n});\n\nnamespace(\"baz\", function () {\n    \n    // this task is defined in the 'baz' namespace, and depends on the\n    // 'foom' task from the 'foo' namespace\n    task(\"bazil\", [\"foo:foom\"], function (t) {\n        //...\n        t.done():\n    });\n    // This task is also defined in the 'baz' namespace. It depends on \n    // the 'bazil' task, which is also defined in 'baz' namespace. It\n    // also depends on the 'default' task in the 'default' (top-level)\n    // namespace.\n    task(\"buzil\", [\"bazil\", \"default\"], function (t), {\n        //...\n        t.done():\n    });\n    // If 'bazil' wasn't defined in the 'baz' namespace, it would resolve\n    // to the 'default' namespace task.\n});\n~~~\n\n**Note:** prerequisite names are tied to the defined task's namespace. i.e: If a task \"foo:fuz\" depends on \"foom\" **saké** will look in the \"foo\" namespace for \"foom\", and then the \"default\" namespace.\n\n**Note:** although the `namespace` functions can be nested, **saké** does not track the hierarchy of `namespace` calls -- if a dependent task is not found in the current task's namespace, it will look for it in the default namespace.\n\n\nPassing Arguments to A Task\n---------------------------\n\nThere are two ways to pass arguments to a task.\n\nFirst, **saké** translates any arguments in the form of `ENV=VALUE` on the command-line into `process.env` values:\n\n~~~\n% sake build BUILD_TYPE=debug ENVIRONMENT=prod\n~~~\n\nWill set `process.env.BUILD_TYPE` to \"debug\" and `process.env.ENVIRONMENT` to \"prod\". The values are JSON parsed; so the values are translated into real JavaScript values (numbers, true, false, etc...).\n\nSecondly, **saké** passes all non-option, and non-ENV=VALUE, looking arguments from the command-line to the invoked task:\n\n~~~\n% sake foo 3.14 pie true\n~~~\n\nWill invoke the \"foo\" task and pass to each of foo's actions (after the task instance itself) `3.14`, \"pie\" and `true`. The arguments are also JSON parsed to get real JavaScript values.\n\n~~~js\ntask(\"foo\", function (t, amt, word, flag) {\n    log(amt);   // => 3.14\n    log(word);  // => \"pie\"\n    log(flag);  // => true\n});\n~~~\n\n**Note:** This differs from how **rake**, and **jake** do things. In **saké** you can only invoke one task on the command-line. All other arguments on the command-line are considered task arguments.\n\n\nIncluding Other Saké Files\n-------------------------------------\n\nYou can include other **saké** files with the `include` and `load` methods. The included files will be run in the **saké** context, so any variables declared will be set on the global **saké** context. This allows you to break your project build files up into discreet files. Just be aware of naming collisions.\n\nAll `require` and `include`, or `load` statements, are resolved relative to the current file, so you can create your own hierarchy of build dependencies.\n\nYou can also add your own paths to the list of ones that **saké** uses to resolve `requires`: `[sake.]includePaths` is an array of directory paths to search. They are tried in reverse order, so if you push a path on to the array that path will be tried first, followed by any others.\n\n~~~js\n// in a Sakefile\nincludePaths.push(\"some/path\");\n\nrequire(\"some-module\"); // will be tried in some/path/some-module.js\n~~~\n\nAlso, the `__dirname` and `__filename` properties are available in `included` files to help resolve local includes.\n\n~~~js\nvar Path = require(\"path\");\n\ninclude(Path.join(__dirname, \"include-dir/include-file\"));\n~~~\n\nSake Library\n------------\n\n**Saké** will load any `.sake`, `.sake.js`, or `.sake.coffee` files located in a `sakelib` directory relative to the `Sakefile` being run. This directory name can be modified with the `-l, --sakelib` option, and multiple directories can be specified. This allows you to re-use common tasks across multiple projects.\n\n\nFile Lists\n----------\n\nFileLists are lists of file paths.\n\n~~~js\nnew FileList(\"*.scss\");\n~~~\n\nWould contain all the file paths with a \".scss\" extension in the top-level directory of your project.\n\nYou can use FileLists pretty much like an `Array`. You can iterate them (with `forEach, filter, reduce`, etc...), `concat` them, `splice` them, and you get back a new FileList object.\n\nTo add files, or glob patterns to them, use the `#include` method:\n\n~~~js\nvar fl = new FileList(\"*.scss\");\nfl.include(\"core.css\", \"reset.css\", \"*.css\");\n~~~\n\nYou can also `exlucude` files by Glob pattern, `Regular Expression` pattern, or by use of a `function` that takes the file path as an argument and returns a `truthy` value to exclude a file.\n\n~~~js\n// Exclude by RegExp\nfl.exclude(/^dev-.*\\.css/);\n\n// Exclude by Glob pattern\nfl.exclude(\"dev-*.css\");\n\n// Exclude by function\nfl.exclude(function (path) {\n    return FS.statSync(path).mtime.getTime() < (Date.now() - 60 * 60 * 1000);\n});\n~~~\n\nTo get to the actual items of the FileList, use the `#items` property, or the `#toArray` method, to get a plain array back. You can also use the `#get` or `#set` methods to retrieve or set an item.\n\nFileLists are *lazy*, in that the actual file paths are not determined from the include and exclude patterns until the individual items are requested. This allows you to define a FileList and incrementally add patterns to it in the Sakefile file. The FileList paths will not be resolved until the task that uses it as a prerequisite actually asks for the final paths.\n\n\n### FileList Properties & Methods ###\n\n*   `existing` &mdash; will return a new `FileList` with all of the files that actually exist.\n*   `notExisting` &mdash; will return a new `FileList` of all the files that do not exist.\n*   `extension(ext)` &mdash; returns a new `FileList` with all paths that match the given extension.\n\n~~~js\nfl.extension(\".scss\").forEach(function (path) {\n    //...\n});\n~~~\n\n*   `grep(pattern)` &mdash; get a `FileList` of all the files that match the given `pattern`. `pattern` can be a plain `String`, a `Glob` pattern, a `RegExp`, or a `function` that receives each path and can return a truthy value to include it.\n*   `clearExcludes()` &mdash; clear all exclude patterns/functions.\n*   `clearIncludes()` &mdash; clear all include patterns.\n\nBy default, a `FileList` excludes directories. To allow directories call `FileList#clearExcludes()` before requesting any items.\n\n\nThe \"clean\" and \"clobber\" Tasks, and The CLEAN and CLOBBER FileLists\n--------------------------------------------------------------------\n\nWithin a `Sakefile`:\n\n~~~js\n// defines the CLEAN FileList and 'clean' task\nrequire(\"sake/clean\");\nCLEAN.include(\"**/*.js\");\n\n// defines the above, and also the CLOBBER FileTask and 'clobber' task\nrequire(\"sake/clobber\");\nCLOBBER.include(\"**/*.js\");\n~~~\n\nWhen the \"clean\" task is run, it will remove any files that have been included in the `CLEAN FileList`. \"clobber\" will remove any file, or directory, included in the `CLOBBER FileList`.\n\n\nSaké Utility Functions\n----------------------\n\nSaké defines a few utility functions to make life a little easier in an asynchronous world. Most of these are just wrappers for `node`'s File System (`require(\"fs\")`) utility methods.\n\n### Synchronous Utilities ###\n\n*   `mkdir(dirpath, mode=\"777\")` &mdash; create the `dirpath` directory, if it doesn't already exist.\n*   `mkdir_p(dirpath, mode=\"777\"])` &mdash; as above, but create all intermediate directories as needed.\n*   `rm(path, [path1, ..., pathN])` &mdash; remove one or more paths from the file system.\n*   `rm_rf(path, [path1, ..., pathN])` &mdash; as above, and remove directories and their contents.\n*   `cp(from, to)` &mdash; copy a file from `from` path to `to` path.\n*   `cp_r(from, to)` &mdash; copy all files from `from` path to `to` path.\n*   `mv(from, to)` &mdash; move a file from `from` path to `to` path.\n*   `ln(from, to)` &mdash; create a hard link from `from` path to `to` path.\n*   `ln_s(from, to)` &mdash; create a symlink from `from` path to `to` path.\n*   `cat(path, [path1, ..., pathN]) {string}` &mdash; read all supplied paths and return their contents as a string. If an argument is an `Array` it will be expanded and those paths will be read.\n*   `readdir(path) {array[string]}` &mdash; returns the files of directory `path`.\n*   `read(path, [enc]) {string|Buffer}` &mdash; read the supplied file path. Returns a `buffer`, or a `string` if `enc` is given.\n*   `write(path, data, [enc], mode=\"w\")` &mdash; write the `data` to the supplied file `path`. `data` should be a `buffer` or a `string` if `enc` is given. `mode` is a `string` of either \"w\", for over write,  or \"a\" for append.\n*   `slurp(path, [env]) {sring|Buffer}` &mdash; alias for `read`\n*   `spit(path, data, [enc], mode=\"w\")` &mdash; alias for `write`\n\n\n### Asynchronous Utilities ###\n\n*   `sh(cmd, fn(error, result))` &mdash; execute shell `cmd`. In the callback function, `error` will be a truthy value if there was an error, and `result` will contain the STDERR returned from `cmd`. Otherwise, `result` will contain the STDOUT from the `cmd`. If `cmd` is an array of shell commands, each one will be run before the next, and only when they all complete, or an error is encountered, will the callback `fn` be called, and `result` be an array of the results of the individual commands.\n\n\nDeveloper Notes\n---------------\n\n*   Due to an issue with npm v1.1.13 and up (see issue [#2490](https://github.com/isaacs/npm/issues/2490)), I had to move my code into the `node_modules/sake` directory and add a `bundleDependencies` array to the `package.json` file.\n\nReport an Issue\n---------------\n\n* [Bugs](http://github.com/jhamlet/node-sake/issues)\n* Contact the author: <jhamlet@hamletink.com>\n\n\nLicense\n-------\n\n> Copyright (c) 2012 Jerry Hamlet <jerry@hamletink.com>\n> \n> Permission is hereby granted, free of charge, to any person\n> obtaining a copy of this software and associated documentation\n> files (the \"Software\"), to deal in the Software without\n> restriction, including without limitation the rights to use,\n> copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the\n> Software is furnished to do so, subject to the following\n> conditions:\n> \n> The above copyright notice and this permission notice shall be\n> included in all copies or substantial portions of the Software.\n> \n> The Software shall be used for Good, not Evil.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n> OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n> HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n> WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n> FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n> OTHER DEALINGS IN THE SOFTWARE.\n\n","_id":"sake@0.1.25","dist":{"shasum":"936f44db64b3001dec45d94f98203ec6b89394f8","tarball":"https://registry.npmjs.org/sake/-/sake-0.1.25.tgz","integrity":"sha512-Il0CLMAyqgxirC/D52yfC0fnVy6cSA7qhNIsbSeIFSyUwyp4SEa8w4fBcFHeb4HUCtdJ1oUQKqvmBMUpJMLfrg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICPvXhGrIcB6FRXXmqDHZsltLOr1iE/uoyAYHHvkQ2RJAiEA70Ljxkb8f0RXC/ZqODmPERUkghbFcus/kWaX944uUo0="}]},"maintainers":[{"name":"jhamlet","email":"jerry@hamletink.com"}]},"0.1.26":{"name":"sake","description":"[S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.","version":"0.1.26","keywords":["build","make","rake","jake"],"main":"./node_modules/sake/sake.js","bin":{"sake":"./bin/sake"},"dependencies":{"nomnom":">=1.5.x","async":">=0.1.x","resolve":">=0.2.x","proteus":"=0.1.x","wordwrap":">=0.0.2","glob":">=3.1.x","minimatch":">=0.2.x"},"devDependencies":{"mocha":">=0.3.x","should":">=0.5.x","underscore":">=1.3.x"},"bundleDependencies":["sake"],"scripts":{"test":"mocha test/test-*"},"licenses":[{"type":"MIT","url":"http://github.com/jhamlet/node-sake/raw/master/LICENSE"}],"repository":{"type":"git","url":"http://github.com/jhamlet/node-sake.git"},"bugs":{"url":"http://github.com/jhamlet/node-sake/issues"},"preferGlobal":true,"contributors":[{"name":"Jerry Hamlet","email":"jerry@hamletink.com"}],"readme":"\nSaké\n====\n\n> [S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.\n\n\nOverview\n--------\n\nThis package contains **saké**, a JavaScript build program that runs in node with capabilities similar to ruby's Rake.\n\nSaké has the following features:\n\n1.  `Sakefiles` (**saké’s** version of Rakefiles) are completely defined in standard JavaScript (or CoffeeScript, for those who want an even more Rake-like feel).\n2.  Flexible `FileLists` that act like arrays but know about manipulating file names and paths.\n3.  `clean` and `clobber` tasks are available for tidying up.\n4.  _Asynchronous_ task handling, with easy options for specifying _synchronous_ tasks.\n5.  Simple _namespacing_ of tasks to break projects into discreet parts.\n5.  Many utility methods for handling common build tasks (rm, rm_rf, mkdir, mkdir_p, sh, cat, etc...)\n\n\nInstallation\n------------\n\n### Install with npm\n\nDownload and install with the following:\n\n~~~\nnpm install -g sake\n~~~\n\nCommand-Line Usage\n------------------\n\n~~~\n% sake -h\n\nUsage: sake [TASKNAME] [ARGUMENTS ...] [ENV=VALUE ...] [options]\n\n[TASKNAME]     Name of the task to run. Defaults to 'default'.\n[ARGUMENTS ...]     Zero or more arguments to pass to the task invoked.\n[ENV=VALUE ...]     Zero or more arguments to translate into environment variables.\n\nOptions:\n   -f, --sakefile PATH       PATH to Sakefile to run instead of searching for one.\n   -T, --tasks [PATTERN]     List tasks with descriptions (optionally, just those\n                             matching PATTERN) and exit.\n   -P, --prereqs [PATTERN]   List tasks and their prerequisites (optionally, just\n                             those matching PATTERN) and exit.\n   -r, --require MODULE      Require MODULE before executing Sakefile and expose the\n                             MODULE under a sanitized namespace (i.e.: coffee-script\n                             => [sake.]coffeeScript). Can be specified multiple\n                             times.\n   -l, --sakelib PATH        Auto-include any .sake[.js|.coffeee] files in PATH.\n                             (default is 'sakelib'.) Can be specified multiple times\n   -n, --dry-run             Do a dry run without executing actions.\n   -C, --no-chdir            Do not change directory to the Sakefile location.\n   -N, --no-search           Do not search parent directories for a Sakefile.\n   -G, --no-system           Do not use SAKE_PATH environment variable to search for\n                             a Sakefile.\n   -S, --sync                Make all standard tasks 'synchronous' by default.\n   -d, --debug               Enable additional debugging output.\n   -q, --quiet               Suppress informational messages.\n   -V, --version             Print the version of sake and exit.\n   -h, --help                Print this help information and exit.\n\nIf a Sakefile is not specified, sake searches the current directory, and all parent\ndirectories, for one (unless -N, --no-search is set). Otherwise, if the SAKE_PATH\nenvironment variable is defined it searches those path(s) (unless -G, --no-system is\nset).\n\nIf specified, or found through normal searching (not in SAKE_PATH(s)), sake changes the\nprocess' current working directory to the directory of the found Sakefile (unless -C,\n--no-chdir is set), otherwise it stays where it was run from.\n\nSake then invokes the specified TASKNAME, or the \"default\" one.\n\nSakefile can be one of \"Sakefile\", or \"sakefile\", with an optional extension of \".js\",\nor \".coffee\".\n\n~~~\n\n### Dependencies ###\n\nThese are installed when **sake** is installed.\n\n~~~\nnomnom:    >=1.5.x\nasync:     >=0.1.x\nresolve:   >=0.2.x\nproteus:   =0.1.x\nwordwrap:  >=0.0.2\nglob:      >=3.1.x\nminimatch: >=0.2.x\n~~~\n\n\n### Development Dependencies ###\n\nInstalled when you run `npm link` in the package directory.\n\n~~~\nmocha:      >=0.3.x\nshould:     >=0.5.x\nunderscore: >=1.3.x\n~~~\n\n\nSakefile Usage\n--------------\n\nWithin a `Sakefile`, Saké's methods are exported to the global scope, so you can invoke them directly:\n\n~~~js\ntask(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n~~~\n    \nWithin another node module you can `require(\"sake\")` and access the methods on the exported object, or even run a block of code in the **saké** context (virtual machine):\n\n~~~js\nvar sake = require(\"sake\");\n    \nsake.task(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n\n// The function passed to sake#run is compiled and run in the sake context.\n// The function **will not** have access to any variables in this scope,\n// nor, will variables leak from the function's scope into this one.\nsake.run(function () {\n    var jsFiles = new FileList(\"src/js/**/*.js\");\n    \n    require(\"sake/clean\");\n    \n    task(\"script-min.js\", jsFiles, function (t) {\n        var cmd = \"infuse \" + jsFiles.map(function (path) {\n                return \"-i \" + path;\n            }) + \" -E\";\n            \n        sh(cmd, function (err, result) {\n            write(t.name, result, \"utf8\");\n            t.done();\n        })\n    });\n    \n    CLEAN.include(\"script-min.js\");\n});\n~~~\n\nThe remainder of this documentation will assume that we are calling the methods from within a `Sakefile`.\n\n\nDefining Tasks\n--------------\n\nThe various task methods take the following arguments:\n\n1.   `taskname`: `string` &mdash; naming the task\n2.   `prerequisites`: _optional_ \n    *   an `array` of:\n        *   `string` task name, or\n        *   a `FileLists`, or \n        *   a `function` that returns one of the above.\n    *   or, you can also pass a `FileList` in directly for `prerequisites`.\n3.   `action`: an _optional_ `function` that will be called when the task is invoked. It will be passed the task instance as its first argument, followed by any arguments that it was invoked with (either from the command-line, or through code). Task arguments can also be accessed through the instance's `arguments` property. i.e: `t.arguments`.\n\nAll task methods return the task *instance*.\n\nIf a task is already defined, it will be augmented by the additional arguments. So, this:\n\n~~~js\ntask(\"one\", [\"othertask\"], function (t) {\n    // do action one...\n    t.done();\n});\n\ntask(\"one\", function (t) {\n    // do action two...\n    t.done();\n});\n\ntask(\"othertask\");\n~~~\n\nWould result in a task \"othertask\" with no prerequisites, and no action, and a task \"one\" with \"othertask\" as a prerequisite and the two functions as its actions.\n\n**Note** how the dependent task was defined *after* it was required as a prerequisite. Task prerequisites are not resolved until the task is invoked. This leads to flexibility in how to compose your tasks and prerequisite tasks.\n\n\n### Task Instance Properties and Methods ###\n\n*   `name {string}` &mdash; the name of the task.\n*   `namespace {string}` &mdash; the task's namespace.\n*   `type {string}` &mdash; one of \"task\", \"file-task\", or \"file-create-task\"\n*   `fqn {string}` &mdash; the fully qualified name of the task. i.e: \"namespace:name\".\n*   `prerequisites {array}` &mdash; the list of prerequisite names for the task.\n*   `isNeeded {boolean}` &mdash; whether or not this task needs to run.\n*   `timestamp {boolean}` &mdash; the last modification time for the task.\n*   `invoke([args ...]) {Task}` &mdash; invoke the task passing args to each action for the task. Will run any prerequisites first. Returns the task instance.\n*   `execute([args ...]) {Task}` &mdash; Like `invoke`, but run the task even if it has already been run, or is not needed.\n*   `done()` &mdash; signal that the current task's action is done running.\n*   `abort([msg], [exitCode])` &mdash; abort the currently running task's actions, if _exitCode_ is specified **saké** will exit with that exit code and no other tasks will be processed. Otherwise, task processing will continue as normal.\n\n\n### Task Static Properties and Methods ###\n\n*   `namespace {string}` &mdash; the current namespace.\n*   `invoke(name, [rest ...]) {Task}` &mdash; invoke the named task and pass it the rest of the arguments.\n*   `get(name, [namespace]) {Task}` &mdash; get the task _name_, optionally start looking in _namespace_. Will throw an error if it can not find a task.\n*   `lookup(name, [namespace]) {Task|null}` &mdash; lookup a task with _name_, optionally start looking in _namespace_.\n*   `getAll() {array[Task]}` &mdash; return all defined tasks.\n*   `has(name, [namespace]) {boolean}` &mdash; does the task _name_ exist?\n*   `find(args, sortFn) {array[Task]}` &mdash; search for a task. _args_ can be an object with keys specifying which properties to match on, and their values denoting the value to match. _args_ can also be a function that accepts a task and returns a boolean whether or not that task matches.\n\n\nFile Tasks\n----------\n\nFile tasks are created with the (appropriately named) `file` method. File tasks are only triggered if the file doesn't exist, or the modification time of any of its prerequisites is newer than itself.\n\n~~~js\nfile(\"path/to/some/file\", function (t) {\n    cp(\"other/path\", t.name);\n    t.done();\n});\n~~~\n\nThe above task would only be triggered if `path/to/some/file` did not exist.\n\nThe following:\n\n~~~js\nfile(\"combined/file/path\", [\"pathA\", \"pathB\", \"pathC\"], function (t) {\n    write(t.name, cat(t.prerequisites), \"utf8\");\n    t.done();\n});\n~~~\n\nwould be triggered if `path/to/some/file` did not exist, or its modification time was earlier than any of its prerequisites (`pathA`, `pathB`, or  `pathC`).\n\n\nDirectory Tasks\n---------------\n\nDirectory tasks, created with the `directory` method, are tasks that will only be called if they do not exist. A task will be created for the named directory (and for all directories along the way) with the action of creating the directory.\n\nDirectory tasks do not take any `prerequisites` or an `action` when first defined, however, they may be augmented with such after they are created:\n\n~~~js\ndirectory(\"dir/path/to/create\");\n\ntask(\"dir/path/to/create\", [\"othertask\"], action (t) {\n    //... do stuff\n    t.done();\n});\n~~~\n\n\nFile Create Tasks\n-----------------\n\nA file create task is a file task, that when used as a prerequisite, will be needed if, and only if, the file has not been created. Once created, it is not re-triggered if any of its prerequisites are newer, nor does it trigger any rebuilds of tasks that depend on it whenever the file is updated.\n\n~~~js\nfileCreate(\"file/path/to/create.ext\", [\"pathA\", \"pathB\"], function (t) {\n    // create file...\n    t.done();\n});\n~~~\n\n\n(A)Synchronicity and Tasks\n--------------------------\n\nIn **saké** all task actions are assumed to be *asynchronous* and an action must call its task's `done` method to tell **saké** that it is done processing stuff.\n\n~~~js\ntask(\"long task\", function (t) {\n    sh(\"some long running shell command\", function (err, result) {\n        // do stuff...\n        t.done();\n    });\n});\n~~~\n\nAlternatively, you can use the `Sync` version of a task to add a *synchronous* action, and `done` will be called for you after the function completes.\n\n~~~js\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n~~~\n\nThere are `Sync` versions of all the core tasks: `taskSync`, `fileSync`, and `fileCreateSync`. There are also `Async` versions of each task: `taskAsync`, `fileAsync`, and `fileCreateAsync`. The actions created for a `directory` task are *synchronous*. You can add *asynchronous* task actions after the initial definition.\n\nThirdly, you can specify that all of the core task creation functions generate *synchronous* actions by setting **saké's** \"sync\" option to `true`, or by use of the command-line option `-S, --sync`.\n\n~~~js\nsake.options.sync = true;\n\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n\n//... define more synchronous tasks\n\n//... and then revert to async\nsake.options.sync = false;\n~~~\n\nUltimately, it is up to the **saké** script author to correctly designate a task action as *synchronous* or *asynchronous*. Nothing prevents the running of an *asynchronous* function within a task's *synchronous* action. If nothing is dependent on the result of that action, then no problem would occur. It's when other tasks rely on the completion of certain *asynchronous* actions, that problems may arise.\n\nIn the case of *asynchronous* actions, **Saké** will issue a `WARNING` when it can not detect a `done()` call within that action.\n\n\nNamespaces\n----------\n\n**Saké** supports simple name spacing of tasks. Simply prepend the namespace before the task name with a colon \":\". This can be done when defining a task, or in the list of prerequisites for a task.\n\n~~~js\n// Defines a task 'fuz' in the namespace 'foo' that depends on the task 'buz'\n// in the namespace 'baz'\ntask(\"foo:fuz\", [\"baz:buz\"], function (t) {\n    //...\n    t.done();\n});\n~~~\n\nThen invoke the task as so:\n\n~~~\n% sake foo:fuz\n~~~\n\nYou can also use the convenience function `namespace` to wrap your task definitions for a particular namespace. Any _namespace naked_ definitions will first be tried in the local namespace, otherwise they will fall-back to the default namespace:\n\n~~~js\n\ntask(\"default\", function (t) {\n    //...\n    t.done():\n});\n\ntask(\"bazil\", function (t) {\n    //...\n    t.done():\n});\n\n// define within the 'foo' namespace\nnamespace(\"foo\", function () {\n    \n    // defines 'foo:foom' task\n    task(\"foom\", function (t) {\n        //...\n        t.done():\n    });\n    \n});\n\nnamespace(\"baz\", function () {\n    \n    // this task is defined in the 'baz' namespace, and depends on the\n    // 'foom' task from the 'foo' namespace\n    task(\"bazil\", [\"foo:foom\"], function (t) {\n        //...\n        t.done():\n    });\n    // This task is also defined in the 'baz' namespace. It depends on \n    // the 'bazil' task, which is also defined in 'baz' namespace. It\n    // also depends on the 'default' task in the 'default' (top-level)\n    // namespace.\n    task(\"buzil\", [\"bazil\", \"default\"], function (t), {\n        //...\n        t.done():\n    });\n    // If 'bazil' wasn't defined in the 'baz' namespace, it would resolve\n    // to the 'default' namespace task.\n});\n~~~\n\n**Note:** prerequisite names are tied to the defined task's namespace. i.e: If a task \"foo:fuz\" depends on \"foom\" **saké** will look in the \"foo\" namespace for \"foom\", and then the \"default\" namespace.\n\n**Note:** although the `namespace` functions can be nested, **saké** does not track the hierarchy of `namespace` calls -- if a dependent task is not found in the current task's namespace, it will look for it in the default namespace.\n\n\nPassing Arguments to A Task\n---------------------------\n\nThere are two ways to pass arguments to a task.\n\nFirst, **saké** translates any arguments in the form of `ENV=VALUE` on the command-line into `process.env` values:\n\n~~~\n% sake build BUILD_TYPE=debug ENVIRONMENT=prod\n~~~\n\nWill set `process.env.BUILD_TYPE` to \"debug\" and `process.env.ENVIRONMENT` to \"prod\". The values are JSON parsed; so the values are translated into real JavaScript values (numbers, true, false, etc...).\n\nSecondly, **saké** passes all non-option, and non-ENV=VALUE, looking arguments from the command-line to the invoked task:\n\n~~~\n% sake foo 3.14 pie true\n~~~\n\nWill invoke the \"foo\" task and pass to each of foo's actions (after the task instance itself) `3.14`, \"pie\" and `true`. The arguments are also JSON parsed to get real JavaScript values.\n\n~~~js\ntask(\"foo\", function (t, amt, word, flag) {\n    log(amt);   // => 3.14\n    log(word);  // => \"pie\"\n    log(flag);  // => true\n});\n~~~\n\n**Note:** This differs from how **rake**, and **jake** do things. In **saké** you can only invoke one task on the command-line. All other arguments on the command-line are considered task arguments.\n\n\nIncluding Other Saké Files\n-------------------------------------\n\nYou can include other **saké** files with the `include` and `load` methods. The included files will be run in the **saké** context, so any variables declared will be set on the global **saké** context. This allows you to break your project build files up into discreet files. Just be aware of naming collisions.\n\nAll `require` and `include`, or `load` statements, are resolved relative to the current file, so you can create your own hierarchy of build dependencies.\n\nYou can also add your own paths to the list of ones that **saké** uses to resolve `requires`: `[sake.]includePaths` is an array of directory paths to search. They are tried in reverse order, so if you push a path on to the array that path will be tried first, followed by any others.\n\n~~~js\n// in a Sakefile\nincludePaths.push(\"some/path\");\n\nrequire(\"some-module\"); // will be tried in some/path/some-module.js\n~~~\n\nAlso, the `__dirname` and `__filename` properties are available in `included` files to help resolve local includes.\n\n~~~js\nvar Path = require(\"path\");\n\ninclude(Path.join(__dirname, \"include-dir/include-file\"));\n~~~\n\nSake Library\n------------\n\n**Saké** will load any `.sake`, `.sake.js`, or `.sake.coffee` files located in a `sakelib` directory relative to the `Sakefile` being run. This directory name can be modified with the `-l, --sakelib` option, and multiple directories can be specified. This allows you to re-use common tasks across multiple projects.\n\n\nFile Lists\n----------\n\nFileLists are lists of file paths.\n\n~~~js\nnew FileList(\"*.scss\");\n~~~\n\nWould contain all the file paths with a \".scss\" extension in the top-level directory of your project.\n\nYou can use FileLists pretty much like an `Array`. You can iterate them (with `forEach, filter, reduce`, etc...), `concat` them, `splice` them, and you get back a new FileList object.\n\nTo add files, or glob patterns to them, use the `#include` method:\n\n~~~js\nvar fl = new FileList(\"*.scss\");\nfl.include(\"core.css\", \"reset.css\", \"*.css\");\n~~~\n\nYou can also `exlucude` files by Glob pattern, `Regular Expression` pattern, or by use of a `function` that takes the file path as an argument and returns a `truthy` value to exclude a file.\n\n~~~js\n// Exclude by RegExp\nfl.exclude(/^dev-.*\\.css/);\n\n// Exclude by Glob pattern\nfl.exclude(\"dev-*.css\");\n\n// Exclude by function\nfl.exclude(function (path) {\n    return FS.statSync(path).mtime.getTime() < (Date.now() - 60 * 60 * 1000);\n});\n~~~\n\nTo get to the actual items of the FileList, use the `#items` property, or the `#toArray` method, to get a plain array back. You can also use the `#get` or `#set` methods to retrieve or set an item.\n\nFileLists are *lazy*, in that the actual file paths are not determined from the include and exclude patterns until the individual items are requested. This allows you to define a FileList and incrementally add patterns to it in the Sakefile file. The FileList paths will not be resolved until the task that uses it as a prerequisite actually asks for the final paths.\n\n\n### FileList Properties & Methods ###\n\n*   `existing` &mdash; will return a new `FileList` with all of the files that actually exist.\n*   `notExisting` &mdash; will return a new `FileList` of all the files that do not exist.\n*   `extension(ext)` &mdash; returns a new `FileList` with all paths that match the given extension.\n\n~~~js\nfl.extension(\".scss\").forEach(function (path) {\n    //...\n});\n~~~\n\n*   `grep(pattern)` &mdash; get a `FileList` of all the files that match the given `pattern`. `pattern` can be a plain `String`, a `Glob` pattern, a `RegExp`, or a `function` that receives each path and can return a truthy value to include it.\n*   `clearExcludes()` &mdash; clear all exclude patterns/functions.\n*   `clearIncludes()` &mdash; clear all include patterns.\n\nBy default, a `FileList` excludes directories. To allow directories call `FileList#clearExcludes()` before requesting any items.\n\n\nThe \"clean\" and \"clobber\" Tasks, and The CLEAN and CLOBBER FileLists\n--------------------------------------------------------------------\n\nWithin a `Sakefile`:\n\n~~~js\n// defines the CLEAN FileList and 'clean' task\nrequire(\"sake/clean\");\nCLEAN.include(\"**/*.js\");\n\n// defines the above, and also the CLOBBER FileTask and 'clobber' task\nrequire(\"sake/clobber\");\nCLOBBER.include(\"**/*.js\");\n~~~\n\nWhen the \"clean\" task is run, it will remove any files that have been included in the `CLEAN FileList`. \"clobber\" will remove any file, or directory, included in the `CLOBBER FileList`.\n\n\nSaké Utility Functions\n----------------------\n\nSaké defines a few utility functions to make life a little easier in an asynchronous world. Most of these are just wrappers for `node`'s File System (`require(\"fs\")`) utility methods.\n\n### Synchronous Utilities ###\n\n*   `mkdir(dirpath, mode=\"777\")` &mdash; create the `dirpath` directory, if it doesn't already exist.\n*   `mkdir_p(dirpath, mode=\"777\"])` &mdash; as above, but create all intermediate directories as needed.\n*   `rm(path, [path1, ..., pathN])` &mdash; remove one or more paths from the file system.\n*   `rm_rf(path, [path1, ..., pathN])` &mdash; as above, and remove directories and their contents.\n*   `cp(from, to)` &mdash; copy a file from `from` path to `to` path.\n*   `cp_r(from, to)` &mdash; copy all files from `from` path to `to` path.\n*   `mv(from, to)` &mdash; move a file from `from` path to `to` path.\n*   `ln(from, to)` &mdash; create a hard link from `from` path to `to` path.\n*   `ln_s(from, to)` &mdash; create a symlink from `from` path to `to` path.\n*   `cat(path, [path1, ..., pathN]) {string}` &mdash; read all supplied paths and return their contents as a string. If an argument is an `Array` it will be expanded and those paths will be read.\n*   `readdir(path) {array[string]}` &mdash; returns the files of directory `path`.\n*   `read(path, [enc]) {string|Buffer}` &mdash; read the supplied file path. Returns a `buffer`, or a `string` if `enc` is given.\n*   `write(path, data, [enc], mode=\"w\")` &mdash; write the `data` to the supplied file `path`. `data` should be a `buffer` or a `string` if `enc` is given. `mode` is a `string` of either \"w\", for over write,  or \"a\" for append.\n*   `slurp(path, [env]) {sring|Buffer}` &mdash; alias for `read`\n*   `spit(path, data, [enc], mode=\"w\")` &mdash; alias for `write`\n\n\n### Asynchronous Utilities ###\n\n*   `sh(cmd, fn(error, result))` &mdash; execute shell `cmd`. In the callback function, `error` will be a truthy value if there was an error, and `result` will contain the STDERR returned from `cmd`. Otherwise, `result` will contain the STDOUT from the `cmd`. If `cmd` is an array of shell commands, each one will be run before the next, and only when they all complete, or an error is encountered, will the callback `fn` be called, and `result` be an array of the results of the individual commands.\n\n\nDeveloper Notes\n---------------\n\n*   Due to an issue with npm v1.1.13 and up (see issue [#2490](https://github.com/isaacs/npm/issues/2490)), I had to move my code into the `node_modules/sake` directory and add a `bundleDependencies` array to the `package.json` file.\n\nReport an Issue\n---------------\n\n* [Bugs](http://github.com/jhamlet/node-sake/issues)\n* Contact the author: <jhamlet@hamletink.com>\n\n\nLicense\n-------\n\n> Copyright (c) 2012 Jerry Hamlet <jerry@hamletink.com>\n> \n> Permission is hereby granted, free of charge, to any person\n> obtaining a copy of this software and associated documentation\n> files (the \"Software\"), to deal in the Software without\n> restriction, including without limitation the rights to use,\n> copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the\n> Software is furnished to do so, subject to the following\n> conditions:\n> \n> The above copyright notice and this permission notice shall be\n> included in all copies or substantial portions of the Software.\n> \n> The Software shall be used for Good, not Evil.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n> OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n> HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n> WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n> FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n> OTHER DEALINGS IN THE SOFTWARE.\n\n","_id":"sake@0.1.26","dist":{"shasum":"0138d974aafc69f85e6ac0ce28243e487e6903bd","tarball":"https://registry.npmjs.org/sake/-/sake-0.1.26.tgz","integrity":"sha512-Hp35rYfZLpurtOY1vNhwf+0gzUPAI/V9eaVUjeG6yGi4xlF98QLxghIm+TWY/4YMFaQZpys4Ksv+mPoJ4bPI6A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDX0XS3xJUDjH5R3MtrHcNGNhd3raw2jdVk8jKsaGVhNgIgJ2ASblHMJXc1hAKQL4mB3sZ2IzXHAYEth/bC4vOnt/I="}]},"maintainers":[{"name":"jhamlet","email":"jerry@hamletink.com"}]},"0.1.27":{"name":"sake","description":"[S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.","version":"0.1.27","keywords":["build","make","rake","jake"],"main":"./node_modules/sake/sake.js","bin":{"sake":"./bin/sake"},"dependencies":{"nomnom":">=1.5.x","async":">=0.1.x","resolve":">=0.2.x","proteus":">=0.1.x","wordwrap":">=0.0.2","glob":">=3.1.x","minimatch":">=0.2.x"},"devDependencies":{"mocha":">=0.3.x","should":">=0.5.x","underscore":">=1.3.x"},"bundleDependencies":["sake"],"scripts":{"test":"mocha test/test-*"},"licenses":[{"type":"MIT","url":"http://github.com/jhamlet/node-sake/raw/master/LICENSE"}],"repository":{"type":"git","url":"http://github.com/jhamlet/node-sake.git"},"bugs":{"url":"http://github.com/jhamlet/node-sake/issues"},"preferGlobal":true,"contributors":[{"name":"Jerry Hamlet","email":"jerry@hamletink.com"}],"readme":"\nSaké\n====\n\n> [S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.\n\n\nOverview\n--------\n\nThis package contains **saké**, a JavaScript build program that runs in node with capabilities similar to ruby's Rake.\n\nSaké has the following features:\n\n1.  `Sakefiles` (**saké’s** version of Rakefiles) are completely defined in standard JavaScript (or CoffeeScript, for those who want an even more Rake-like feel).\n2.  Flexible `FileLists` that act like arrays but know about manipulating file names and paths.\n3.  `clean` and `clobber` tasks are available for tidying up.\n4.  _Asynchronous_ task handling, with easy options for specifying _synchronous_ tasks.\n5.  Simple _namespacing_ of tasks to break projects into discreet parts.\n5.  Many utility methods for handling common build tasks (rm, rm_rf, mkdir, mkdir_p, sh, cat, etc...)\n\n\nInstallation\n------------\n\n### Install with npm\n\nDownload and install with the following:\n\n~~~\nnpm install -g sake\n~~~\n\nCommand-Line Usage\n------------------\n\n~~~\n% sake -h\n\nUsage: sake [TASKNAME] [ARGUMENTS ...] [ENV=VALUE ...] [options]\n\n[TASKNAME]     Name of the task to run. Defaults to 'default'.\n[ARGUMENTS ...]     Zero or more arguments to pass to the task invoked.\n[ENV=VALUE ...]     Zero or more arguments to translate into environment variables.\n\nOptions:\n   -f, --sakefile PATH       PATH to Sakefile to run instead of searching for one.\n   -T, --tasks [PATTERN]     List tasks with descriptions (optionally, just those\n                             matching PATTERN) and exit.\n   -P, --prereqs [PATTERN]   List tasks and their prerequisites (optionally, just\n                             those matching PATTERN) and exit.\n   -r, --require MODULE      Require MODULE before executing Sakefile and expose the\n                             MODULE under a sanitized namespace (i.e.: coffee-script\n                             => [sake.]coffeeScript). Can be specified multiple\n                             times.\n   -l, --sakelib PATH        Auto-include any .sake[.js|.coffeee] files in PATH.\n                             (default is 'sakelib'.) Can be specified multiple times\n   -n, --dry-run             Do a dry run without executing actions.\n   -C, --no-chdir            Do not change directory to the Sakefile location.\n   -N, --no-search           Do not search parent directories for a Sakefile.\n   -G, --no-system           Do not use SAKE_PATH environment variable to search for\n                             a Sakefile.\n   -S, --sync                Make all standard tasks 'synchronous' by default.\n   -d, --debug               Enable additional debugging output.\n   -q, --quiet               Suppress informational messages.\n   -V, --version             Print the version of sake and exit.\n   -h, --help                Print this help information and exit.\n\nIf a Sakefile is not specified, sake searches the current directory, and all parent\ndirectories, for one (unless -N, --no-search is set). Otherwise, if the SAKE_PATH\nenvironment variable is defined it searches those path(s) (unless -G, --no-system is\nset).\n\nIf specified, or found through normal searching (not in SAKE_PATH(s)), sake changes the\nprocess' current working directory to the directory of the found Sakefile (unless -C,\n--no-chdir is set), otherwise it stays where it was run from.\n\nSake then invokes the specified TASKNAME, or the \"default\" one.\n\nSakefile can be one of \"Sakefile\", or \"sakefile\", with an optional extension of \".js\",\nor \".coffee\".\n\n~~~\n\n### Dependencies ###\n\nThese are installed when **sake** is installed.\n\n~~~\nnomnom:    >=1.5.x\nasync:     >=0.1.x\nresolve:   >=0.2.x\nproteus:   =0.1.x\nwordwrap:  >=0.0.2\nglob:      >=3.1.x\nminimatch: >=0.2.x\n~~~\n\n\n### Development Dependencies ###\n\nInstalled when you run `npm link` in the package directory.\n\n~~~\nmocha:      >=0.3.x\nshould:     >=0.5.x\nunderscore: >=1.3.x\n~~~\n\n\nSakefile Usage\n--------------\n\nWithin a `Sakefile`, Saké's methods are exported to the global scope, so you can invoke them directly:\n\n~~~js\ntask(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n~~~\n    \nWithin another node module you can `require(\"sake\")` and access the methods on the exported object, or even run a block of code in the **saké** context (virtual machine):\n\n~~~js\nvar sake = require(\"sake\");\n    \nsake.task(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n\n// The function passed to sake#run is compiled and run in the sake context.\n// The function **will not** have access to any variables in this scope,\n// nor, will variables leak from the function's scope into this one.\nsake.run(function () {\n    var jsFiles = new FileList(\"src/js/**/*.js\");\n    \n    require(\"sake/clean\");\n    \n    task(\"script-min.js\", jsFiles, function (t) {\n        var cmd = \"infuse \" + jsFiles.map(function (path) {\n                return \"-i \" + path;\n            }) + \" -E\";\n            \n        sh(cmd, function (err, result) {\n            write(t.name, result, \"utf8\");\n            t.done();\n        })\n    });\n    \n    CLEAN.include(\"script-min.js\");\n});\n~~~\n\nThe remainder of this documentation will assume that we are calling the methods from within a `Sakefile`.\n\n\nDefining Tasks\n--------------\n\nThe various task methods take the following arguments:\n\n1.   `taskname`: `string` &mdash; naming the task\n2.   `prerequisites`: _optional_ \n    *   an `array` of:\n        *   `string` task name, or\n        *   a `FileLists`, or \n        *   a `function` that returns one of the above.\n    *   or, you can also pass a `FileList` in directly for `prerequisites`.\n3.   `action`: an _optional_ `function` that will be called when the task is invoked. It will be passed the task instance as its first argument, followed by any arguments that it was invoked with (either from the command-line, or through code). Task arguments can also be accessed through the instance's `arguments` property. i.e: `t.arguments`.\n\nAll task methods return the task *instance*.\n\nIf a task is already defined, it will be augmented by the additional arguments. So, this:\n\n~~~js\ntask(\"one\", [\"othertask\"], function (t) {\n    // do action one...\n    t.done();\n});\n\ntask(\"one\", function (t) {\n    // do action two...\n    t.done();\n});\n\ntask(\"othertask\");\n~~~\n\nWould result in a task \"othertask\" with no prerequisites, and no action, and a task \"one\" with \"othertask\" as a prerequisite and the two functions as its actions.\n\n**Note** how the dependent task was defined *after* it was required as a prerequisite. Task prerequisites are not resolved until the task is invoked. This leads to flexibility in how to compose your tasks and prerequisite tasks.\n\n\n### Task Instance Properties and Methods ###\n\n*   `name {string}` &mdash; the name of the task.\n*   `namespace {string}` &mdash; the task's namespace.\n*   `type {string}` &mdash; one of \"task\", \"file-task\", or \"file-create-task\"\n*   `fqn {string}` &mdash; the fully qualified name of the task. i.e: \"namespace:name\".\n*   `prerequisites {array}` &mdash; the list of prerequisite names for the task.\n*   `isNeeded {boolean}` &mdash; whether or not this task needs to run.\n*   `timestamp {boolean}` &mdash; the last modification time for the task.\n*   `invoke([args ...]) {Task}` &mdash; invoke the task passing args to each action for the task. Will run any prerequisites first. Returns the task instance.\n*   `execute([args ...]) {Task}` &mdash; Like `invoke`, but run the task even if it has already been run, or is not needed.\n*   `done()` &mdash; signal that the current task's action is done running.\n*   `abort([msg], [exitCode])` &mdash; abort the currently running task's actions, if _exitCode_ is specified **saké** will exit with that exit code and no other tasks will be processed. Otherwise, task processing will continue as normal.\n\n\n### Task Static Properties and Methods ###\n\n*   `namespace {string}` &mdash; the current namespace.\n*   `invoke(name, [rest ...]) {Task}` &mdash; invoke the named task and pass it the rest of the arguments.\n*   `get(name, [namespace]) {Task}` &mdash; get the task _name_, optionally start looking in _namespace_. Will throw an error if it can not find a task.\n*   `lookup(name, [namespace]) {Task|null}` &mdash; lookup a task with _name_, optionally start looking in _namespace_.\n*   `getAll() {array[Task]}` &mdash; return all defined tasks.\n*   `has(name, [namespace]) {boolean}` &mdash; does the task _name_ exist?\n*   `find(args, sortFn) {array[Task]}` &mdash; search for a task. _args_ can be an object with keys specifying which properties to match on, and their values denoting the value to match. _args_ can also be a function that accepts a task and returns a boolean whether or not that task matches.\n\n\nFile Tasks\n----------\n\nFile tasks are created with the (appropriately named) `file` method. File tasks are only triggered if the file doesn't exist, or the modification time of any of its prerequisites is newer than itself.\n\n~~~js\nfile(\"path/to/some/file\", function (t) {\n    cp(\"other/path\", t.name);\n    t.done();\n});\n~~~\n\nThe above task would only be triggered if `path/to/some/file` did not exist.\n\nThe following:\n\n~~~js\nfile(\"combined/file/path\", [\"pathA\", \"pathB\", \"pathC\"], function (t) {\n    write(t.name, cat(t.prerequisites), \"utf8\");\n    t.done();\n});\n~~~\n\nwould be triggered if `path/to/some/file` did not exist, or its modification time was earlier than any of its prerequisites (`pathA`, `pathB`, or  `pathC`).\n\n\nDirectory Tasks\n---------------\n\nDirectory tasks, created with the `directory` method, are tasks that will only be called if they do not exist. A task will be created for the named directory (and for all directories along the way) with the action of creating the directory.\n\nDirectory tasks do not take any `prerequisites` or an `action` when first defined, however, they may be augmented with such after they are created:\n\n~~~js\ndirectory(\"dir/path/to/create\");\n\ntask(\"dir/path/to/create\", [\"othertask\"], action (t) {\n    //... do stuff\n    t.done();\n});\n~~~\n\n\nFile Create Tasks\n-----------------\n\nA file create task is a file task, that when used as a prerequisite, will be needed if, and only if, the file has not been created. Once created, it is not re-triggered if any of its prerequisites are newer, nor does it trigger any rebuilds of tasks that depend on it whenever the file is updated.\n\n~~~js\nfileCreate(\"file/path/to/create.ext\", [\"pathA\", \"pathB\"], function (t) {\n    // create file...\n    t.done();\n});\n~~~\n\n\n(A)Synchronicity and Tasks\n--------------------------\n\nIn **saké** all task actions are assumed to be *asynchronous* and an action must call its task's `done` method to tell **saké** that it is done processing stuff.\n\n~~~js\ntask(\"long task\", function (t) {\n    sh(\"some long running shell command\", function (err, result) {\n        // do stuff...\n        t.done();\n    });\n});\n~~~\n\nAlternatively, you can use the `Sync` version of a task to add a *synchronous* action, and `done` will be called for you after the function completes.\n\n~~~js\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n~~~\n\nThere are `Sync` versions of all the core tasks: `taskSync`, `fileSync`, and `fileCreateSync`. There are also `Async` versions of each task: `taskAsync`, `fileAsync`, and `fileCreateAsync`. The actions created for a `directory` task are *synchronous*. You can add *asynchronous* task actions after the initial definition.\n\nThirdly, you can specify that all of the core task creation functions generate *synchronous* actions by setting **saké's** \"sync\" option to `true`, or by use of the command-line option `-S, --sync`.\n\n~~~js\nsake.options.sync = true;\n\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n\n//... define more synchronous tasks\n\n//... and then revert to async\nsake.options.sync = false;\n~~~\n\nUltimately, it is up to the **saké** script author to correctly designate a task action as *synchronous* or *asynchronous*. Nothing prevents the running of an *asynchronous* function within a task's *synchronous* action. If nothing is dependent on the result of that action, then no problem would occur. It's when other tasks rely on the completion of certain *asynchronous* actions, that problems may arise.\n\nIn the case of *asynchronous* actions, **Saké** will issue a `WARNING` when it can not detect a `done()` call within that action.\n\n\nNamespaces\n----------\n\n**Saké** supports simple name spacing of tasks. Simply prepend the namespace before the task name with a colon \":\". This can be done when defining a task, or in the list of prerequisites for a task.\n\n~~~js\n// Defines a task 'fuz' in the namespace 'foo' that depends on the task 'buz'\n// in the namespace 'baz'\ntask(\"foo:fuz\", [\"baz:buz\"], function (t) {\n    //...\n    t.done();\n});\n~~~\n\nThen invoke the task as so:\n\n~~~\n% sake foo:fuz\n~~~\n\nYou can also use the convenience function `namespace` to wrap your task definitions for a particular namespace. Any _namespace naked_ definitions will first be tried in the local namespace, otherwise they will fall-back to the default namespace:\n\n~~~js\n\ntask(\"default\", function (t) {\n    //...\n    t.done():\n});\n\ntask(\"bazil\", function (t) {\n    //...\n    t.done():\n});\n\n// define within the 'foo' namespace\nnamespace(\"foo\", function () {\n    \n    // defines 'foo:foom' task\n    task(\"foom\", function (t) {\n        //...\n        t.done():\n    });\n    \n});\n\nnamespace(\"baz\", function () {\n    \n    // this task is defined in the 'baz' namespace, and depends on the\n    // 'foom' task from the 'foo' namespace\n    task(\"bazil\", [\"foo:foom\"], function (t) {\n        //...\n        t.done():\n    });\n    // This task is also defined in the 'baz' namespace. It depends on \n    // the 'bazil' task, which is also defined in 'baz' namespace. It\n    // also depends on the 'default' task in the 'default' (top-level)\n    // namespace.\n    task(\"buzil\", [\"bazil\", \"default\"], function (t), {\n        //...\n        t.done():\n    });\n    // If 'bazil' wasn't defined in the 'baz' namespace, it would resolve\n    // to the 'default' namespace task.\n});\n~~~\n\n**Note:** prerequisite names are tied to the defined task's namespace. i.e: If a task \"foo:fuz\" depends on \"foom\" **saké** will look in the \"foo\" namespace for \"foom\", and then the \"default\" namespace.\n\n**Note:** although the `namespace` functions can be nested, **saké** does not track the hierarchy of `namespace` calls -- if a dependent task is not found in the current task's namespace, it will look for it in the default namespace.\n\n\nPassing Arguments to A Task\n---------------------------\n\nThere are two ways to pass arguments to a task.\n\nFirst, **saké** translates any arguments in the form of `ENV=VALUE` on the command-line into `process.env` values:\n\n~~~\n% sake build BUILD_TYPE=debug ENVIRONMENT=prod\n~~~\n\nWill set `process.env.BUILD_TYPE` to \"debug\" and `process.env.ENVIRONMENT` to \"prod\". The values are JSON parsed; so the values are translated into real JavaScript values (numbers, true, false, etc...).\n\nSecondly, **saké** passes all non-option, and non-ENV=VALUE, looking arguments from the command-line to the invoked task:\n\n~~~\n% sake foo 3.14 pie true\n~~~\n\nWill invoke the \"foo\" task and pass to each of foo's actions (after the task instance itself) `3.14`, \"pie\" and `true`. The arguments are also JSON parsed to get real JavaScript values.\n\n~~~js\ntask(\"foo\", function (t, amt, word, flag) {\n    log(amt);   // => 3.14\n    log(word);  // => \"pie\"\n    log(flag);  // => true\n});\n~~~\n\n**Note:** This differs from how **rake**, and **jake** do things. In **saké** you can only invoke one task on the command-line. All other arguments on the command-line are considered task arguments.\n\n\nIncluding Other Saké Files\n-------------------------------------\n\nYou can include other **saké** files with the `include` and `load` methods. The included files will be run in the **saké** context, so any variables declared will be set on the global **saké** context. This allows you to break your project build files up into discreet files. Just be aware of naming collisions.\n\nAll `require` and `include`, or `load` statements, are resolved relative to the current file, so you can create your own hierarchy of build dependencies.\n\nYou can also add your own paths to the list of ones that **saké** uses to resolve `requires`: `[sake.]includePaths` is an array of directory paths to search. They are tried in reverse order, so if you push a path on to the array that path will be tried first, followed by any others.\n\n~~~js\n// in a Sakefile\nincludePaths.push(\"some/path\");\n\nrequire(\"some-module\"); // will be tried in some/path/some-module.js\n~~~\n\nAlso, the `__dirname` and `__filename` properties are available in `included` files to help resolve local includes.\n\n~~~js\nvar Path = require(\"path\");\n\ninclude(Path.join(__dirname, \"include-dir/include-file\"));\n~~~\n\nSake Library\n------------\n\n**Saké** will load any `.sake`, `.sake.js`, or `.sake.coffee` files located in a `sakelib` directory relative to the `Sakefile` being run. This directory name can be modified with the `-l, --sakelib` option, and multiple directories can be specified. This allows you to re-use common tasks across multiple projects.\n\n\nFile Lists\n----------\n\nFileLists are lists of file paths.\n\n~~~js\nnew FileList(\"*.scss\");\n~~~\n\nWould contain all the file paths with a \".scss\" extension in the top-level directory of your project.\n\nYou can use FileLists pretty much like an `Array`. You can iterate them (with `forEach, filter, reduce`, etc...), `concat` them, `splice` them, and you get back a new FileList object.\n\nTo add files, or glob patterns to them, use the `#include` method:\n\n~~~js\nvar fl = new FileList(\"*.scss\");\nfl.include(\"core.css\", \"reset.css\", \"*.css\");\n~~~\n\nYou can also `exlucude` files by Glob pattern, `Regular Expression` pattern, or by use of a `function` that takes the file path as an argument and returns a `truthy` value to exclude a file.\n\n~~~js\n// Exclude by RegExp\nfl.exclude(/^dev-.*\\.css/);\n\n// Exclude by Glob pattern\nfl.exclude(\"dev-*.css\");\n\n// Exclude by function\nfl.exclude(function (path) {\n    return FS.statSync(path).mtime.getTime() < (Date.now() - 60 * 60 * 1000);\n});\n~~~\n\nTo get to the actual items of the FileList, use the `#items` property, or the `#toArray` method, to get a plain array back. You can also use the `#get` or `#set` methods to retrieve or set an item.\n\nFileLists are *lazy*, in that the actual file paths are not determined from the include and exclude patterns until the individual items are requested. This allows you to define a FileList and incrementally add patterns to it in the Sakefile file. The FileList paths will not be resolved until the task that uses it as a prerequisite actually asks for the final paths.\n\n\n### FileList Properties & Methods ###\n\n*   `existing` &mdash; will return a new `FileList` with all of the files that actually exist.\n*   `notExisting` &mdash; will return a new `FileList` of all the files that do not exist.\n*   `extension(ext)` &mdash; returns a new `FileList` with all paths that match the given extension.\n\n~~~js\nfl.extension(\".scss\").forEach(function (path) {\n    //...\n});\n~~~\n\n*   `grep(pattern)` &mdash; get a `FileList` of all the files that match the given `pattern`. `pattern` can be a plain `String`, a `Glob` pattern, a `RegExp`, or a `function` that receives each path and can return a truthy value to include it.\n*   `clearExcludes()` &mdash; clear all exclude patterns/functions.\n*   `clearIncludes()` &mdash; clear all include patterns.\n\nBy default, a `FileList` excludes directories. To allow directories call `FileList#clearExcludes()` before requesting any items.\n\n\nThe \"clean\" and \"clobber\" Tasks, and The CLEAN and CLOBBER FileLists\n--------------------------------------------------------------------\n\nWithin a `Sakefile`:\n\n~~~js\n// defines the CLEAN FileList and 'clean' task\nrequire(\"sake/clean\");\nCLEAN.include(\"**/*.js\");\n\n// defines the above, and also the CLOBBER FileTask and 'clobber' task\nrequire(\"sake/clobber\");\nCLOBBER.include(\"**/*.js\");\n~~~\n\nWhen the \"clean\" task is run, it will remove any files that have been included in the `CLEAN FileList`. \"clobber\" will remove any file, or directory, included in the `CLOBBER FileList`.\n\n\nSaké Utility Functions\n----------------------\n\nSaké defines a few utility functions to make life a little easier in an asynchronous world. Most of these are just wrappers for `node`'s File System (`require(\"fs\")`) utility methods.\n\n### Synchronous Utilities ###\n\n*   `mkdir(dirpath, mode=\"777\")` &mdash; create the `dirpath` directory, if it doesn't already exist.\n*   `mkdir_p(dirpath, mode=\"777\"])` &mdash; as above, but create all intermediate directories as needed.\n*   `rm(path, [path1, ..., pathN])` &mdash; remove one or more paths from the file system.\n*   `rm_rf(path, [path1, ..., pathN])` &mdash; as above, and remove directories and their contents.\n*   `cp(from, to)` &mdash; copy a file from `from` path to `to` path.\n*   `cp_r(from, to)` &mdash; copy all files from `from` path to `to` path.\n*   `mv(from, to)` &mdash; move a file from `from` path to `to` path.\n*   `ln(from, to)` &mdash; create a hard link from `from` path to `to` path.\n*   `ln_s(from, to)` &mdash; create a symlink from `from` path to `to` path.\n*   `cat(path, [path1, ..., pathN]) {string}` &mdash; read all supplied paths and return their contents as a string. If an argument is an `Array` it will be expanded and those paths will be read.\n*   `readdir(path) {array[string]}` &mdash; returns the files of directory `path`.\n*   `read(path, [enc]) {string|Buffer}` &mdash; read the supplied file path. Returns a `buffer`, or a `string` if `enc` is given.\n*   `write(path, data, [enc], mode=\"w\")` &mdash; write the `data` to the supplied file `path`. `data` should be a `buffer` or a `string` if `enc` is given. `mode` is a `string` of either \"w\", for over write,  or \"a\" for append.\n*   `slurp(path, [env]) {sring|Buffer}` &mdash; alias for `read`\n*   `spit(path, data, [enc], mode=\"w\")` &mdash; alias for `write`\n\n\n### Asynchronous Utilities ###\n\n*   `sh(cmd, fn(error, result))` &mdash; execute shell `cmd`. In the callback function, `error` will be a truthy value if there was an error, and `result` will contain the STDERR returned from `cmd`. Otherwise, `result` will contain the STDOUT from the `cmd`. If `cmd` is an array of shell commands, each one will be run before the next, and only when they all complete, or an error is encountered, will the callback `fn` be called, and `result` be an array of the results of the individual commands.\n\n\nDeveloper Notes\n---------------\n\n*   Due to an issue with npm v1.1.13 and up (see issue [#2490](https://github.com/isaacs/npm/issues/2490)), I had to move my code into the `node_modules/sake` directory and add a `bundleDependencies` array to the `package.json` file.\n\nReport an Issue\n---------------\n\n* [Bugs](http://github.com/jhamlet/node-sake/issues)\n* Contact the author: <jhamlet@hamletink.com>\n\n\nLicense\n-------\n\n> Copyright (c) 2012 Jerry Hamlet <jerry@hamletink.com>\n> \n> Permission is hereby granted, free of charge, to any person\n> obtaining a copy of this software and associated documentation\n> files (the \"Software\"), to deal in the Software without\n> restriction, including without limitation the rights to use,\n> copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the\n> Software is furnished to do so, subject to the following\n> conditions:\n> \n> The above copyright notice and this permission notice shall be\n> included in all copies or substantial portions of the Software.\n> \n> The Software shall be used for Good, not Evil.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n> OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n> HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n> WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n> FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n> OTHER DEALINGS IN THE SOFTWARE.\n\n","_id":"sake@0.1.27","dist":{"shasum":"fb6a73bbcb529a4d7438ced528759d0687344b05","tarball":"https://registry.npmjs.org/sake/-/sake-0.1.27.tgz","integrity":"sha512-n7L8NQrfvDdB8Y1sQXBlsEgAKDipmbRwBCGyhUi98PZNND1Q0Cyv+JNJF/2tGZ0WcbQ/HDUlWIa/bLHLYPNQUA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDKh57A4QzcnYh3xImtB3Ax9hquGyKk/A35N/Mb1JznOAIgYNN3Rkyq9SkJSZ/t9y5/Wu38kefZeHFVDqb5/GWTFiA="}]},"maintainers":[{"name":"jhamlet","email":"jerry@hamletink.com"}]},"0.1.28":{"name":"sake","description":"[S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.","version":"0.1.28","keywords":["build","make","rake","jake"],"main":"./node_modules/sake/sake.js","bin":{"sake":"./bin/sake"},"dependencies":{"nomnom":">=1.5.x","async":">=0.1.x","resolve":">=0.2.x","proteus":">=0.1.x","wordwrap":">=0.0.2","glob":">=3.1.x","minimatch":">=0.2.x"},"devDependencies":{"mocha":">=0.3.x","should":">=0.5.x","underscore":">=1.3.x"},"bundleDependencies":["sake"],"scripts":{"test":"mocha test/test-*"},"licenses":[{"type":"MIT","url":"http://github.com/jhamlet/node-sake/raw/master/LICENSE"}],"repository":{"type":"git","url":"http://github.com/jhamlet/node-sake.git"},"bugs":{"url":"http://github.com/jhamlet/node-sake/issues"},"preferGlobal":true,"contributors":[{"name":"Jerry Hamlet","email":"jerry@hamletink.com"}],"readme":"\nSaké\n====\n\n> [S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.\n\n\nOverview\n--------\n\nThis package contains **saké**, a JavaScript build program that runs in node with capabilities similar to ruby's Rake.\n\nSaké has the following features:\n\n1.  `Sakefiles` (**saké’s** version of Rakefiles) are completely defined in standard JavaScript (or CoffeeScript, for those who want an even more Rake-like feel).\n2.  Flexible `FileLists` that act like arrays but know about manipulating file names and paths.\n3.  `clean` and `clobber` tasks are available for tidying up.\n4.  _Asynchronous_ task handling, with easy options for specifying _synchronous_ tasks.\n5.  Simple _namespacing_ of tasks to break projects into discreet parts.\n5.  Many utility methods for handling common build tasks (rm, rm_rf, mkdir, mkdir_p, sh, cat, etc...)\n\n\nInstallation\n------------\n\n### Install with npm\n\nDownload and install with the following:\n\n~~~\nnpm install -g sake\n~~~\n\nCommand-Line Usage\n------------------\n\n~~~\n% sake -h\n\nUsage: sake [TASKNAME] [ARGUMENTS ...] [ENV=VALUE ...] [options]\n\n[TASKNAME]     Name of the task to run. Defaults to 'default'.\n[ARGUMENTS ...]     Zero or more arguments to pass to the task invoked.\n[ENV=VALUE ...]     Zero or more arguments to translate into environment variables.\n\nOptions:\n   -f, --sakefile PATH       PATH to Sakefile to run instead of searching for one.\n   -T, --tasks [PATTERN]     List tasks with descriptions (optionally, just those\n                             matching PATTERN) and exit.\n   -P, --prereqs [PATTERN]   List tasks and their prerequisites (optionally, just\n                             those matching PATTERN) and exit.\n   -r, --require MODULE      Require MODULE before executing Sakefile and expose the\n                             MODULE under a sanitized namespace (i.e.: coffee-script\n                             => [sake.]coffeeScript). Can be specified multiple\n                             times.\n   -l, --sakelib PATH        Auto-include any .sake[.js|.coffeee] files in PATH.\n                             (default is 'sakelib'.) Can be specified multiple times\n   -n, --dry-run             Do a dry run without executing actions.\n   -C, --no-chdir            Do not change directory to the Sakefile location.\n   -N, --no-search           Do not search parent directories for a Sakefile.\n   -G, --no-system           Do not use SAKE_PATH environment variable to search for\n                             a Sakefile.\n   -S, --sync                Make all standard tasks 'synchronous' by default.\n   -d, --debug               Enable additional debugging output.\n   -q, --quiet               Suppress informational messages.\n   -V, --version             Print the version of sake and exit.\n   -h, --help                Print this help information and exit.\n\nIf a Sakefile is not specified, sake searches the current directory, and all parent\ndirectories, for one (unless -N, --no-search is set). Otherwise, if the SAKE_PATH\nenvironment variable is defined it searches those path(s) (unless -G, --no-system is\nset).\n\nIf specified, or found through normal searching (not in SAKE_PATH(s)), sake changes the\nprocess' current working directory to the directory of the found Sakefile (unless -C,\n--no-chdir is set), otherwise it stays where it was run from.\n\nSake then invokes the specified TASKNAME, or the \"default\" one.\n\nSakefile can be one of \"Sakefile\", or \"sakefile\", with an optional extension of \".js\",\nor \".coffee\".\n\n~~~\n\n### Dependencies ###\n\nThese are installed when **sake** is installed.\n\n~~~\nnomnom:    >=1.5.x\nasync:     >=0.1.x\nresolve:   >=0.2.x\nproteus:   >=0.1.x\nwordwrap:  >=0.0.2\nglob:      >=3.1.x\nminimatch: >=0.2.x\n~~~\n\n\n### Development Dependencies ###\n\nInstalled when you run `npm link` in the package directory.\n\n~~~\nmocha:      >=0.3.x\nshould:     >=0.5.x\nunderscore: >=1.3.x\n~~~\n\n\nSakefile Usage\n--------------\n\nWithin a `Sakefile`, Saké's methods are exported to the global scope, so you can invoke them directly:\n\n~~~js\ntask(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n~~~\n    \nWithin another node module you can `require(\"sake\")` and access the methods on the exported object, or even run a block of code in the **saké** context (virtual machine):\n\n~~~js\nvar sake = require(\"sake\");\n    \nsake.task(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n\n// The function passed to sake#run is compiled and run in the sake context.\n// The function **will not** have access to any variables in this scope,\n// nor, will variables leak from the function's scope into this one.\nsake.run(function () {\n    var jsFiles = new FileList(\"src/js/**/*.js\");\n    \n    require(\"sake/clean\");\n    \n    task(\"script-min.js\", jsFiles, function (t) {\n        var cmd = \"infuse \" + jsFiles.map(function (path) {\n                return \"-i \" + path;\n            }) + \" -E\";\n            \n        sh(cmd, function (err, result) {\n            write(t.name, result, \"utf8\");\n            t.done();\n        })\n    });\n    \n    CLEAN.include(\"script-min.js\");\n});\n~~~\n\nThe remainder of this documentation will assume that we are calling the methods from within a `Sakefile`.\n\n\nDefining Tasks\n--------------\n\nThe various task methods take the following arguments:\n\n1.   `taskname`: `string` &mdash; naming the task\n2.   `prerequisites`: _optional_ \n    *   an `array` of:\n        *   `string` task name, or\n        *   a `FileLists`, or \n        *   a `function` that returns one of the above.\n    *   or, you can also pass a `FileList` in directly for `prerequisites`.\n3.   `action`: an _optional_ `function` that will be called when the task is invoked. It will be passed the task instance as its first argument, followed by any arguments that it was invoked with (either from the command-line, or through code). Task arguments can also be accessed through the instance's `arguments` property. i.e: `t.arguments`.\n\nAll task methods return the task *instance*.\n\nIf a task is already defined, it will be augmented by the additional arguments. So, this:\n\n~~~js\ntask(\"one\", [\"othertask\"], function (t) {\n    // do action one...\n    t.done();\n});\n\ntask(\"one\", function (t) {\n    // do action two...\n    t.done();\n});\n\ntask(\"othertask\");\n~~~\n\nWould result in a task \"othertask\" with no prerequisites, and no action, and a task \"one\" with \"othertask\" as a prerequisite and the two functions as its actions.\n\n**Note** how the dependent task was defined *after* it was required as a prerequisite. Task prerequisites are not resolved until the task is invoked. This leads to flexibility in how to compose your tasks and prerequisite tasks.\n\n\n### Task Instance Properties and Methods ###\n\n*   `name {string}` &mdash; the name of the task.\n*   `namespace {string}` &mdash; the task's namespace.\n*   `type {string}` &mdash; one of \"task\", \"file-task\", or \"file-create-task\"\n*   `fqn {string}` &mdash; the fully qualified name of the task. i.e: \"namespace:name\".\n*   `prerequisites {array}` &mdash; the list of prerequisite names for the task.\n*   `isNeeded {boolean}` &mdash; whether or not this task needs to run.\n*   `timestamp {boolean}` &mdash; the last modification time for the task.\n*   `invoke([args ...]) {Task}` &mdash; invoke the task passing args to each action for the task. Will run any prerequisites first. Returns the task instance.\n*   `execute([args ...]) {Task}` &mdash; Like `invoke`, but run the task even if it has already been run, or is not needed.\n*   `done()` &mdash; signal that the current task's action is done running.\n*   `abort([msg], [exitCode])` &mdash; abort the currently running task's actions, if _exitCode_ is specified **saké** will exit with that exit code and no other tasks will be processed. Otherwise, task processing will continue as normal.\n\n\n### Task Static Properties and Methods ###\n\n*   `namespace {string}` &mdash; the current namespace.\n*   `invoke(name, [rest ...]) {Task}` &mdash; invoke the named task and pass it the rest of the arguments.\n*   `get(name, [namespace]) {Task}` &mdash; get the task _name_, optionally start looking in _namespace_. Will throw an error if it can not find a task.\n*   `lookup(name, [namespace]) {Task|null}` &mdash; lookup a task with _name_, optionally start looking in _namespace_.\n*   `getAll() {array[Task]}` &mdash; return all defined tasks.\n*   `has(name, [namespace]) {boolean}` &mdash; does the task _name_ exist?\n*   `find(args, sortFn) {array[Task]}` &mdash; search for a task. _args_ can be an object with keys specifying which properties to match on, and their values denoting the value to match. _args_ can also be a function that accepts a task and returns a boolean whether or not that task matches.\n\n\nFile Tasks\n----------\n\nFile tasks are created with the (appropriately named) `file` method. File tasks are only triggered if the file doesn't exist, or the modification time of any of its prerequisites is newer than itself.\n\n~~~js\nfile(\"path/to/some/file\", function (t) {\n    cp(\"other/path\", t.name);\n    t.done();\n});\n~~~\n\nThe above task would only be triggered if `path/to/some/file` did not exist.\n\nThe following:\n\n~~~js\nfile(\"combined/file/path\", [\"pathA\", \"pathB\", \"pathC\"], function (t) {\n    write(t.name, cat(t.prerequisites), \"utf8\");\n    t.done();\n});\n~~~\n\nwould be triggered if `path/to/some/file` did not exist, or its modification time was earlier than any of its prerequisites (`pathA`, `pathB`, or  `pathC`).\n\n\nDirectory Tasks\n---------------\n\nDirectory tasks, created with the `directory` method, are tasks that will only be called if they do not exist. A task will be created for the named directory (and for all directories along the way) with the action of creating the directory.\n\nDirectory tasks do not take any `prerequisites` or an `action` when first defined, however, they may be augmented with such after they are created:\n\n~~~js\ndirectory(\"dir/path/to/create\");\n\ntask(\"dir/path/to/create\", [\"othertask\"], action (t) {\n    //... do stuff\n    t.done();\n});\n~~~\n\n\nFile Create Tasks\n-----------------\n\nA file create task is a file task, that when used as a prerequisite, will be needed if, and only if, the file has not been created. Once created, it is not re-triggered if any of its prerequisites are newer, nor does it trigger any rebuilds of tasks that depend on it whenever the file is updated.\n\n~~~js\nfileCreate(\"file/path/to/create.ext\", [\"pathA\", \"pathB\"], function (t) {\n    // create file...\n    t.done();\n});\n~~~\n\n\n(A)Synchronicity and Tasks\n--------------------------\n\nIn **saké** all task actions are assumed to be *asynchronous* and an action must call its task's `done` method to tell **saké** that it is done processing stuff.\n\n~~~js\ntask(\"long task\", function (t) {\n    sh(\"some long running shell command\", function (err, result) {\n        // do stuff...\n        t.done();\n    });\n});\n~~~\n\nAlternatively, you can use the `Sync` version of a task to add a *synchronous* action, and `done` will be called for you after the function completes.\n\n~~~js\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n~~~\n\nThere are `Sync` versions of all the core tasks: `taskSync`, `fileSync`, and `fileCreateSync`. There are also `Async` versions of each task: `taskAsync`, `fileAsync`, and `fileCreateAsync`. The actions created for a `directory` task are *synchronous*. You can add *asynchronous* task actions after the initial definition.\n\nThirdly, you can specify that all of the core task creation functions generate *synchronous* actions by setting **saké's** \"sync\" option to `true`, or by use of the command-line option `-S, --sync`.\n\n~~~js\nsake.options.sync = true;\n\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n\n//... define more synchronous tasks\n\n//... and then revert to async\nsake.options.sync = false;\n~~~\n\nUltimately, it is up to the **saké** script author to correctly designate a task action as *synchronous* or *asynchronous*. Nothing prevents the running of an *asynchronous* function within a task's *synchronous* action. If nothing is dependent on the result of that action, then no problem would occur. It's when other tasks rely on the completion of certain *asynchronous* actions, that problems may arise.\n\nIn the case of *asynchronous* actions, **Saké** will issue a `WARNING` when it can not detect a `done()` call within that action.\n\n\nNamespaces\n----------\n\n**Saké** supports simple name spacing of tasks. Simply prepend the namespace before the task name with a colon \":\". This can be done when defining a task, or in the list of prerequisites for a task.\n\n~~~js\n// Defines a task 'fuz' in the namespace 'foo' that depends on the task 'buz'\n// in the namespace 'baz'\ntask(\"foo:fuz\", [\"baz:buz\"], function (t) {\n    //...\n    t.done();\n});\n~~~\n\nThen invoke the task as so:\n\n~~~\n% sake foo:fuz\n~~~\n\nYou can also use the convenience function `namespace` to wrap your task definitions for a particular namespace. Any _namespace naked_ definitions will first be tried in the local namespace, otherwise they will fall-back to the default namespace:\n\n~~~js\n\ntask(\"default\", function (t) {\n    //...\n    t.done():\n});\n\ntask(\"bazil\", function (t) {\n    //...\n    t.done():\n});\n\n// define within the 'foo' namespace\nnamespace(\"foo\", function () {\n    \n    // defines 'foo:foom' task\n    task(\"foom\", function (t) {\n        //...\n        t.done():\n    });\n    \n});\n\nnamespace(\"baz\", function () {\n    \n    // this task is defined in the 'baz' namespace, and depends on the\n    // 'foom' task from the 'foo' namespace\n    task(\"bazil\", [\"foo:foom\"], function (t) {\n        //...\n        t.done():\n    });\n    // This task is also defined in the 'baz' namespace. It depends on \n    // the 'bazil' task, which is also defined in 'baz' namespace. It\n    // also depends on the 'default' task in the 'default' (top-level)\n    // namespace.\n    task(\"buzil\", [\"bazil\", \"default\"], function (t), {\n        //...\n        t.done():\n    });\n    // If 'bazil' wasn't defined in the 'baz' namespace, it would resolve\n    // to the 'default' namespace task.\n});\n~~~\n\n**Note:** prerequisite names are tied to the defined task's namespace. i.e: If a task \"foo:fuz\" depends on \"foom\" **saké** will look in the \"foo\" namespace for \"foom\", and then the \"default\" namespace.\n\n**Note:** although the `namespace` functions can be nested, **saké** does not track the hierarchy of `namespace` calls -- if a dependent task is not found in the current task's namespace, it will look for it in the default namespace.\n\n\nPassing Arguments to A Task\n---------------------------\n\nThere are two ways to pass arguments to a task.\n\nFirst, **saké** translates any arguments in the form of `ENV=VALUE` on the command-line into `process.env` values:\n\n~~~\n% sake build BUILD_TYPE=debug ENVIRONMENT=prod\n~~~\n\nWill set `process.env.BUILD_TYPE` to \"debug\" and `process.env.ENVIRONMENT` to \"prod\". The values are JSON parsed; so the values are translated into real JavaScript values (numbers, true, false, etc...).\n\nSecondly, **saké** passes all non-option, and non-ENV=VALUE, looking arguments from the command-line to the invoked task:\n\n~~~\n% sake foo 3.14 pie true\n~~~\n\nWill invoke the \"foo\" task and pass to each of foo's actions (after the task instance itself) `3.14`, \"pie\" and `true`. The arguments are also JSON parsed to get real JavaScript values.\n\n~~~js\ntask(\"foo\", function (t, amt, word, flag) {\n    log(amt);   // => 3.14\n    log(word);  // => \"pie\"\n    log(flag);  // => true\n});\n~~~\n\n**Note:** This differs from how **rake**, and **jake** do things. In **saké** you can only invoke one task on the command-line. All other arguments on the command-line are considered task arguments.\n\n\nIncluding Other Saké Files\n-------------------------------------\n\nYou can include other **saké** files with the `include` and `load` methods. The included files will be run in the **saké** context, so any variables declared will be set on the global **saké** context. This allows you to break your project build files up into discreet files. Just be aware of naming collisions.\n\nAll `require` and `include`, or `load` statements, are resolved relative to the current file, so you can create your own hierarchy of build dependencies.\n\nYou can also add your own paths to the list of ones that **saké** uses to resolve `requires`: `[sake.]includePaths` is an array of directory paths to search. They are tried in reverse order, so if you push a path on to the array that path will be tried first, followed by any others.\n\n~~~js\n// in a Sakefile\nincludePaths.push(\"some/path\");\n\nrequire(\"some-module\"); // will be tried in some/path/some-module.js\n~~~\n\nAlso, the `__dirname` and `__filename` properties are available in `included` files to help resolve local includes.\n\n~~~js\nvar Path = require(\"path\");\n\ninclude(Path.join(__dirname, \"include-dir/include-file\"));\n~~~\n\nSake Library\n------------\n\n**Saké** will load any `.sake`, `.sake.js`, or `.sake.coffee` files located in a `sakelib` directory relative to the `Sakefile` being run. This directory name can be modified with the `-l, --sakelib` option, and multiple directories can be specified. This allows you to re-use common tasks across multiple projects.\n\n\nFile Lists\n----------\n\nFileLists are lists of file paths.\n\n~~~js\nnew FileList(\"*.scss\");\n~~~\n\nWould contain all the file paths with a \".scss\" extension in the top-level directory of your project.\n\nYou can use FileLists pretty much like an `Array`. You can iterate them (with `forEach, filter, reduce`, etc...), `concat` them, `splice` them, and you get back a new FileList object.\n\nTo add files, or glob patterns to them, use the `#include` method:\n\n~~~js\nvar fl = new FileList(\"*.scss\");\nfl.include(\"core.css\", \"reset.css\", \"*.css\");\n~~~\n\nYou can also `exlucude` files by Glob pattern, `Regular Expression` pattern, or by use of a `function` that takes the file path as an argument and returns a `truthy` value to exclude a file.\n\n~~~js\n// Exclude by RegExp\nfl.exclude(/^dev-.*\\.css/);\n\n// Exclude by Glob pattern\nfl.exclude(\"dev-*.css\");\n\n// Exclude by function\nfl.exclude(function (path) {\n    return FS.statSync(path).mtime.getTime() < (Date.now() - 60 * 60 * 1000);\n});\n~~~\n\nTo get to the actual items of the FileList, use the `#items` property, or the `#toArray` method, to get a plain array back. You can also use the `#get` or `#set` methods to retrieve or set an item.\n\nFileLists are *lazy*, in that the actual file paths are not determined from the include and exclude patterns until the individual items are requested. This allows you to define a FileList and incrementally add patterns to it in the Sakefile file. The FileList paths will not be resolved until the task that uses it as a prerequisite actually asks for the final paths.\n\n\n### FileList Properties & Methods ###\n\n*   `existing` &mdash; will return a new `FileList` with all of the files that actually exist.\n*   `notExisting` &mdash; will return a new `FileList` of all the files that do not exist.\n*   `extension(ext)` &mdash; returns a new `FileList` with all paths that match the given extension.\n\n~~~js\nfl.extension(\".scss\").forEach(function (path) {\n    //...\n});\n~~~\n\n*   `grep(pattern)` &mdash; get a `FileList` of all the files that match the given `pattern`. `pattern` can be a plain `String`, a `Glob` pattern, a `RegExp`, or a `function` that receives each path and can return a truthy value to include it.\n*   `clearExcludes()` &mdash; clear all exclude patterns/functions.\n*   `clearIncludes()` &mdash; clear all include patterns.\n\nBy default, a `FileList` excludes directories. To allow directories call `FileList#clearExcludes()` before requesting any items.\n\n\nThe \"clean\" and \"clobber\" Tasks, and The CLEAN and CLOBBER FileLists\n--------------------------------------------------------------------\n\nWithin a `Sakefile`:\n\n~~~js\n// defines the CLEAN FileList and 'clean' task\nrequire(\"sake/clean\");\nCLEAN.include(\"**/*.js\");\n\n// defines the above, and also the CLOBBER FileTask and 'clobber' task\nrequire(\"sake/clobber\");\nCLOBBER.include(\"**/*.js\");\n~~~\n\nWhen the \"clean\" task is run, it will remove any files that have been included in the `CLEAN FileList`. \"clobber\" will remove any file, or directory, included in the `CLOBBER FileList`.\n\n\nSaké Utility Functions\n----------------------\n\nSaké defines a few utility functions to make life a little easier in an asynchronous world. Most of these are just wrappers for `node`'s File System (`require(\"fs\")`) utility methods.\n\n### Synchronous Utilities ###\n\n*   `mkdir(dirpath, mode=\"777\")` &mdash; create the `dirpath` directory, if it doesn't already exist.\n*   `mkdir_p(dirpath, mode=\"777\"])` &mdash; as above, but create all intermediate directories as needed.\n*   `rm(path, [path1, ..., pathN])` &mdash; remove one or more paths from the file system.\n*   `rm_rf(path, [path1, ..., pathN])` &mdash; as above, and remove directories and their contents.\n*   `cp(from, to)` &mdash; copy a file from `from` path to `to` path.\n*   `cp_r(from, to)` &mdash; copy all files from `from` path to `to` path.\n*   `mv(from, to)` &mdash; move a file from `from` path to `to` path.\n*   `ln(from, to)` &mdash; create a hard link from `from` path to `to` path.\n*   `ln_s(from, to)` &mdash; create a symlink from `from` path to `to` path.\n*   `cat(path, [path1, ..., pathN]) {string}` &mdash; read all supplied paths and return their contents as a string. If an argument is an `Array` it will be expanded and those paths will be read.\n*   `readdir(path) {array[string]}` &mdash; returns the files of directory `path`.\n*   `read(path, [enc]) {string|Buffer}` &mdash; read the supplied file path. Returns a `buffer`, or a `string` if `enc` is given.\n*   `write(path, data, [enc], mode=\"w\")` &mdash; write the `data` to the supplied file `path`. `data` should be a `buffer` or a `string` if `enc` is given. `mode` is a `string` of either \"w\", for over write,  or \"a\" for append.\n*   `slurp(path, [env]) {sring|Buffer}` &mdash; alias for `read`\n*   `spit(path, data, [enc], mode=\"w\")` &mdash; alias for `write`\n\n\n### Asynchronous Utilities ###\n\n*   `sh(cmd, fn(error, result))` &mdash; execute shell `cmd`. In the callback function, `error` will be a truthy value if there was an error, and `result` will contain the STDERR returned from `cmd`. Otherwise, `result` will contain the STDOUT from the `cmd`. If `cmd` is an array of shell commands, each one will be run before the next, and only when they all complete, or an error is encountered, will the callback `fn` be called, and `result` be an array of the results of the individual commands.\n\n\nDeveloper Notes\n---------------\n\n*   Due to an issue with npm v1.1.13 and up (see issue [#2490](https://github.com/isaacs/npm/issues/2490)), I had to move my code into the `node_modules/sake` directory and add a `bundleDependencies` array to the `package.json` file.\n\nReport an Issue\n---------------\n\n* [Bugs](http://github.com/jhamlet/node-sake/issues)\n* Contact the author: <jhamlet@hamletink.com>\n\n\nLicense\n-------\n\n> Copyright (c) 2012 Jerry Hamlet <jerry@hamletink.com>\n> \n> Permission is hereby granted, free of charge, to any person\n> obtaining a copy of this software and associated documentation\n> files (the \"Software\"), to deal in the Software without\n> restriction, including without limitation the rights to use,\n> copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the\n> Software is furnished to do so, subject to the following\n> conditions:\n> \n> The above copyright notice and this permission notice shall be\n> included in all copies or substantial portions of the Software.\n> \n> The Software shall be used for Good, not Evil.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n> OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n> HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n> WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n> FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n> OTHER DEALINGS IN THE SOFTWARE.\n\n","_id":"sake@0.1.28","dist":{"shasum":"7d4b93d23353de3514117060c088bd42e7372a7b","tarball":"https://registry.npmjs.org/sake/-/sake-0.1.28.tgz","integrity":"sha512-G80ec7cOYaRMHD7XSwkjRPbr8/2ZZotT+6e+E7qq2vBYA4U5rDrEX0A/MzxQi9OdMzykg6A9NKzOYg40harj7Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIH6Yn2rAHS/qdedgDJyk+mDZrsynWJluIviMoqxFTz/9AiEAy1P4kw7iXysM+sOvWkkZHDTQcSSZKuSym2/UDaAj0Pk="}]},"maintainers":[{"name":"jhamlet","email":"jerry@hamletink.com"}]},"0.1.29":{"name":"sake","description":"[S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.","version":"0.1.29","keywords":["build","make","rake","jake"],"main":"./node_modules/sake/sake.js","bin":{"sake":"./bin/sake"},"dependencies":{"nomnom":"=1.5.x","async":"=0.1.x","resolve":"=0.2.x","proteus":"=0.1.x","wordwrap":"=0.0.2","glob":"=3.1.x","minimatch":"=0.2.x"},"devDependencies":{"mocha":"=0.3.x","should":"=0.5.x","underscore":"=1.3.x"},"bundleDependencies":["sake"],"scripts":{"test":"mocha test/test-*"},"licenses":[{"type":"MIT","url":"http://github.com/jhamlet/node-sake/raw/master/LICENSE"}],"repository":{"type":"git","url":"http://github.com/jhamlet/node-sake.git"},"bugs":{"url":"http://github.com/jhamlet/node-sake/issues"},"preferGlobal":true,"contributors":[{"name":"Jerry Hamlet","email":"jerry@hamletink.com"}],"readme":"\nSaké\n====\n\n> [S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.\n\n\nOverview\n--------\n\nThis package contains **saké**, a JavaScript build program that runs in node with capabilities similar to ruby's Rake.\n\nSaké has the following features:\n\n1.  `Sakefiles` (**saké’s** version of Rakefiles) are completely defined in standard JavaScript (or CoffeeScript, for those who want an even more Rake-like feel).\n2.  Flexible `FileLists` that act like arrays but know about manipulating file names and paths.\n3.  `clean` and `clobber` tasks are available for tidying up.\n4.  _Asynchronous_ task handling, with easy options for specifying _synchronous_ tasks.\n5.  Simple _namespacing_ of tasks to break projects into discreet parts.\n5.  Many utility methods for handling common build tasks (rm, rm_rf, mkdir, mkdir_p, sh, cat, etc...)\n\n\nInstallation\n------------\n\n### Install with npm\n\nDownload and install with the following:\n\n~~~\nnpm install -g sake\n~~~\n\nCommand-Line Usage\n------------------\n\n~~~\n% sake -h\n\nUsage: sake [TASKNAME] [ARGUMENTS ...] [ENV=VALUE ...] [options]\n\n[TASKNAME]     Name of the task to run. Defaults to 'default'.\n[ARGUMENTS ...]     Zero or more arguments to pass to the task invoked.\n[ENV=VALUE ...]     Zero or more arguments to translate into environment variables.\n\nOptions:\n   -f, --sakefile PATH       PATH to Sakefile to run instead of searching for one.\n   -T, --tasks [PATTERN]     List tasks with descriptions (optionally, just those\n                             matching PATTERN) and exit.\n   -P, --prereqs [PATTERN]   List tasks and their prerequisites (optionally, just\n                             those matching PATTERN) and exit.\n   -r, --require MODULE      Require MODULE before executing Sakefile and expose the\n                             MODULE under a sanitized namespace (i.e.: coffee-script\n                             => [sake.]coffeeScript). Can be specified multiple\n                             times.\n   -l, --sakelib PATH        Auto-include any .sake[.js|.coffeee] files in PATH.\n                             (default is 'sakelib'.) Can be specified multiple times\n   -n, --dry-run             Do a dry run without executing actions.\n   -C, --no-chdir            Do not change directory to the Sakefile location.\n   -N, --no-search           Do not search parent directories for a Sakefile.\n   -G, --no-system           Do not use SAKE_PATH environment variable to search for\n                             a Sakefile.\n   -S, --sync                Make all standard tasks 'synchronous' by default.\n   -d, --debug               Enable additional debugging output.\n   -q, --quiet               Suppress informational messages.\n   -V, --version             Print the version of sake and exit.\n   -h, --help                Print this help information and exit.\n\nIf a Sakefile is not specified, sake searches the current directory, and all parent\ndirectories, for one (unless -N, --no-search is set). Otherwise, if the SAKE_PATH\nenvironment variable is defined it searches those path(s) (unless -G, --no-system is\nset).\n\nIf specified, or found through normal searching (not in SAKE_PATH(s)), sake changes the\nprocess' current working directory to the directory of the found Sakefile (unless -C,\n--no-chdir is set), otherwise it stays where it was run from.\n\nSake then invokes the specified TASKNAME, or the \"default\" one.\n\nSakefile can be one of \"Sakefile\", or \"sakefile\", with an optional extension of \".js\",\nor \".coffee\".\n\n~~~\n\n### Dependencies ###\n\nThese are installed when **sake** is installed.\n\n~~~\nnomnom:    >=1.5.x\nasync:     >=0.1.x\nresolve:   >=0.2.x\nproteus:   >=0.1.x\nwordwrap:  >=0.0.2\nglob:      >=3.1.x\nminimatch: >=0.2.x\n~~~\n\n\n### Development Dependencies ###\n\nInstalled when you run `npm link` in the package directory.\n\n~~~\nmocha:      >=0.3.x\nshould:     >=0.5.x\nunderscore: >=1.3.x\n~~~\n\n\nSakefile Usage\n--------------\n\nWithin a `Sakefile`, Saké's methods are exported to the global scope, so you can invoke them directly:\n\n~~~js\ntask(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n~~~\n    \nWithin another node module you can `require(\"sake\")` and access the methods on the exported object, or even run a block of code in the **saké** context (virtual machine):\n\n~~~js\nvar sake = require(\"sake\");\n    \nsake.task(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n\n// The function passed to sake#run is compiled and run in the sake context.\n// The function **will not** have access to any variables in this scope,\n// nor, will variables leak from the function's scope into this one.\nsake.run(function () {\n    var jsFiles = new FileList(\"src/js/**/*.js\");\n    \n    require(\"sake/clean\");\n    \n    task(\"script-min.js\", jsFiles, function (t) {\n        var cmd = \"infuse \" + jsFiles.map(function (path) {\n                return \"-i \" + path;\n            }) + \" -E\";\n            \n        sh(cmd, function (err, result) {\n            write(t.name, result, \"utf8\");\n            t.done();\n        })\n    });\n    \n    CLEAN.include(\"script-min.js\");\n});\n~~~\n\nThe remainder of this documentation will assume that we are calling the methods from within a `Sakefile`.\n\n\nDefining Tasks\n--------------\n\nThe various task methods take the following arguments:\n\n1.   `taskname`: `string` &mdash; naming the task\n2.   `prerequisites`: _optional_ \n    *   an `array` of:\n        *   `string` task name, or\n        *   a `FileLists`, or \n        *   a `function` that returns one of the above.\n    *   or, you can also pass a `FileList` in directly for `prerequisites`.\n3.   `action`: an _optional_ `function` that will be called when the task is invoked. It will be passed the task instance as its first argument, followed by any arguments that it was invoked with (either from the command-line, or through code). Task arguments can also be accessed through the instance's `arguments` property. i.e: `t.arguments`.\n\nAll task methods return the task *instance*.\n\nIf a task is already defined, it will be augmented by the additional arguments. So, this:\n\n~~~js\ntask(\"one\", [\"othertask\"], function (t) {\n    // do action one...\n    t.done();\n});\n\ntask(\"one\", function (t) {\n    // do action two...\n    t.done();\n});\n\ntask(\"othertask\");\n~~~\n\nWould result in a task \"othertask\" with no prerequisites, and no action, and a task \"one\" with \"othertask\" as a prerequisite and the two functions as its actions.\n\n**Note** how the dependent task was defined *after* it was required as a prerequisite. Task prerequisites are not resolved until the task is invoked. This leads to flexibility in how to compose your tasks and prerequisite tasks.\n\n\n### Task Instance Properties and Methods ###\n\n*   `name {string}` &mdash; the name of the task.\n*   `namespace {string}` &mdash; the task's namespace.\n*   `type {string}` &mdash; one of \"task\", \"file-task\", or \"file-create-task\"\n*   `fqn {string}` &mdash; the fully qualified name of the task. i.e: \"namespace:name\".\n*   `prerequisites {array}` &mdash; the list of prerequisite names for the task.\n*   `isNeeded {boolean}` &mdash; whether or not this task needs to run.\n*   `timestamp {boolean}` &mdash; the last modification time for the task.\n*   `invoke([args ...]) {Task}` &mdash; invoke the task passing args to each action for the task. Will run any prerequisites first. Returns the task instance.\n*   `execute([args ...]) {Task}` &mdash; Like `invoke`, but run the task even if it has already been run, or is not needed.\n*   `done()` &mdash; signal that the current task's action is done running.\n*   `abort([msg], [exitCode])` &mdash; abort the currently running task's actions, if _exitCode_ is specified **saké** will exit with that exit code and no other tasks will be processed. Otherwise, task processing will continue as normal.\n\n\n### Task Static Properties and Methods ###\n\n*   `namespace {string}` &mdash; the current namespace.\n*   `invoke(name, [rest ...]) {Task}` &mdash; invoke the named task and pass it the rest of the arguments.\n*   `get(name, [namespace]) {Task}` &mdash; get the task _name_, optionally start looking in _namespace_. Will throw an error if it can not find a task.\n*   `lookup(name, [namespace]) {Task|null}` &mdash; lookup a task with _name_, optionally start looking in _namespace_.\n*   `getAll() {array[Task]}` &mdash; return all defined tasks.\n*   `has(name, [namespace]) {boolean}` &mdash; does the task _name_ exist?\n*   `find(args, sortFn) {array[Task]}` &mdash; search for a task. _args_ can be an object with keys specifying which properties to match on, and their values denoting the value to match. _args_ can also be a function that accepts a task and returns a boolean whether or not that task matches.\n\n\nFile Tasks\n----------\n\nFile tasks are created with the (appropriately named) `file` method. File tasks are only triggered if the file doesn't exist, or the modification time of any of its prerequisites is newer than itself.\n\n~~~js\nfile(\"path/to/some/file\", function (t) {\n    cp(\"other/path\", t.name);\n    t.done();\n});\n~~~\n\nThe above task would only be triggered if `path/to/some/file` did not exist.\n\nThe following:\n\n~~~js\nfile(\"combined/file/path\", [\"pathA\", \"pathB\", \"pathC\"], function (t) {\n    write(t.name, cat(t.prerequisites), \"utf8\");\n    t.done();\n});\n~~~\n\nwould be triggered if `path/to/some/file` did not exist, or its modification time was earlier than any of its prerequisites (`pathA`, `pathB`, or  `pathC`).\n\n\nDirectory Tasks\n---------------\n\nDirectory tasks, created with the `directory` method, are tasks that will only be called if they do not exist. A task will be created for the named directory (and for all directories along the way) with the action of creating the directory.\n\nDirectory tasks do not take any `prerequisites` or an `action` when first defined, however, they may be augmented with such after they are created:\n\n~~~js\ndirectory(\"dir/path/to/create\");\n\ntask(\"dir/path/to/create\", [\"othertask\"], action (t) {\n    //... do stuff\n    t.done();\n});\n~~~\n\n\nFile Create Tasks\n-----------------\n\nA file create task is a file task, that when used as a prerequisite, will be needed if, and only if, the file has not been created. Once created, it is not re-triggered if any of its prerequisites are newer, nor does it trigger any rebuilds of tasks that depend on it whenever the file is updated.\n\n~~~js\nfileCreate(\"file/path/to/create.ext\", [\"pathA\", \"pathB\"], function (t) {\n    // create file...\n    t.done();\n});\n~~~\n\n\n(A)Synchronicity and Tasks\n--------------------------\n\nIn **saké** all task actions are assumed to be *asynchronous* and an action must call its task's `done` method to tell **saké** that it is done processing stuff.\n\n~~~js\ntask(\"long task\", function (t) {\n    sh(\"some long running shell command\", function (err, result) {\n        // do stuff...\n        t.done();\n    });\n});\n~~~\n\nAlternatively, you can use the `Sync` version of a task to add a *synchronous* action, and `done` will be called for you after the function completes.\n\n~~~js\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n~~~\n\nThere are `Sync` versions of all the core tasks: `taskSync`, `fileSync`, and `fileCreateSync`. There are also `Async` versions of each task: `taskAsync`, `fileAsync`, and `fileCreateAsync`. The actions created for a `directory` task are *synchronous*. You can add *asynchronous* task actions after the initial definition.\n\nThirdly, you can specify that all of the core task creation functions generate *synchronous* actions by setting **saké's** \"sync\" option to `true`, or by use of the command-line option `-S, --sync`.\n\n~~~js\nsake.options.sync = true;\n\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n\n//... define more synchronous tasks\n\n//... and then revert to async\nsake.options.sync = false;\n~~~\n\nUltimately, it is up to the **saké** script author to correctly designate a task action as *synchronous* or *asynchronous*. Nothing prevents the running of an *asynchronous* function within a task's *synchronous* action. If nothing is dependent on the result of that action, then no problem would occur. It's when other tasks rely on the completion of certain *asynchronous* actions, that problems may arise.\n\nIn the case of *asynchronous* actions, **Saké** will issue a `WARNING` when it can not detect a `done()` call within that action.\n\n\nNamespaces\n----------\n\n**Saké** supports simple name spacing of tasks. Simply prepend the namespace before the task name with a colon \":\". This can be done when defining a task, or in the list of prerequisites for a task.\n\n~~~js\n// Defines a task 'fuz' in the namespace 'foo' that depends on the task 'buz'\n// in the namespace 'baz'\ntask(\"foo:fuz\", [\"baz:buz\"], function (t) {\n    //...\n    t.done();\n});\n~~~\n\nThen invoke the task as so:\n\n~~~\n% sake foo:fuz\n~~~\n\nYou can also use the convenience function `namespace` to wrap your task definitions for a particular namespace. Any _namespace naked_ definitions will first be tried in the local namespace, otherwise they will fall-back to the default namespace:\n\n~~~js\n\ntask(\"default\", function (t) {\n    //...\n    t.done():\n});\n\ntask(\"bazil\", function (t) {\n    //...\n    t.done():\n});\n\n// define within the 'foo' namespace\nnamespace(\"foo\", function () {\n    \n    // defines 'foo:foom' task\n    task(\"foom\", function (t) {\n        //...\n        t.done():\n    });\n    \n});\n\nnamespace(\"baz\", function () {\n    \n    // this task is defined in the 'baz' namespace, and depends on the\n    // 'foom' task from the 'foo' namespace\n    task(\"bazil\", [\"foo:foom\"], function (t) {\n        //...\n        t.done():\n    });\n    // This task is also defined in the 'baz' namespace. It depends on \n    // the 'bazil' task, which is also defined in 'baz' namespace. It\n    // also depends on the 'default' task in the 'default' (top-level)\n    // namespace.\n    task(\"buzil\", [\"bazil\", \"default\"], function (t), {\n        //...\n        t.done():\n    });\n    // If 'bazil' wasn't defined in the 'baz' namespace, it would resolve\n    // to the 'default' namespace task.\n});\n~~~\n\n**Note:** prerequisite names are tied to the defined task's namespace. i.e: If a task \"foo:fuz\" depends on \"foom\" **saké** will look in the \"foo\" namespace for \"foom\", and then the \"default\" namespace.\n\n**Note:** although the `namespace` functions can be nested, **saké** does not track the hierarchy of `namespace` calls -- if a dependent task is not found in the current task's namespace, it will look for it in the default namespace.\n\n\nPassing Arguments to A Task\n---------------------------\n\nThere are two ways to pass arguments to a task.\n\nFirst, **saké** translates any arguments in the form of `ENV=VALUE` on the command-line into `process.env` values:\n\n~~~\n% sake build BUILD_TYPE=debug ENVIRONMENT=prod\n~~~\n\nWill set `process.env.BUILD_TYPE` to \"debug\" and `process.env.ENVIRONMENT` to \"prod\". The values are JSON parsed; so the values are translated into real JavaScript values (numbers, true, false, etc...).\n\nSecondly, **saké** passes all non-option, and non-ENV=VALUE, looking arguments from the command-line to the invoked task:\n\n~~~\n% sake foo 3.14 pie true\n~~~\n\nWill invoke the \"foo\" task and pass to each of foo's actions (after the task instance itself) `3.14`, \"pie\" and `true`. The arguments are also JSON parsed to get real JavaScript values.\n\n~~~js\ntask(\"foo\", function (t, amt, word, flag) {\n    log(amt);   // => 3.14\n    log(word);  // => \"pie\"\n    log(flag);  // => true\n});\n~~~\n\n**Note:** This differs from how **rake**, and **jake** do things. In **saké** you can only invoke one task on the command-line. All other arguments on the command-line are considered task arguments.\n\n\nIncluding Other Saké Files\n-------------------------------------\n\nYou can include other **saké** files with the `include` and `load` methods. The included files will be run in the **saké** context, so any variables declared will be set on the global **saké** context. This allows you to break your project build files up into discreet files. Just be aware of naming collisions.\n\nAll `require` and `include`, or `load` statements, are resolved relative to the current file, so you can create your own hierarchy of build dependencies.\n\nYou can also add your own paths to the list of ones that **saké** uses to resolve `requires`: `[sake.]includePaths` is an array of directory paths to search. They are tried in reverse order, so if you push a path on to the array that path will be tried first, followed by any others.\n\n~~~js\n// in a Sakefile\nincludePaths.push(\"some/path\");\n\nrequire(\"some-module\"); // will be tried in some/path/some-module.js\n~~~\n\nAlso, the `__dirname` and `__filename` properties are available in `included` files to help resolve local includes.\n\n~~~js\nvar Path = require(\"path\");\n\ninclude(Path.join(__dirname, \"include-dir/include-file\"));\n~~~\n\nSake Library\n------------\n\n**Saké** will load any `.sake`, `.sake.js`, or `.sake.coffee` files located in a `sakelib` directory relative to the `Sakefile` being run. This directory name can be modified with the `-l, --sakelib` option, and multiple directories can be specified. This allows you to re-use common tasks across multiple projects.\n\n\nFile Lists\n----------\n\nFileLists are lists of file paths.\n\n~~~js\nnew FileList(\"*.scss\");\n~~~\n\nWould contain all the file paths with a \".scss\" extension in the top-level directory of your project.\n\nYou can use FileLists pretty much like an `Array`. You can iterate them (with `forEach, filter, reduce`, etc...), `concat` them, `splice` them, and you get back a new FileList object.\n\nTo add files, or glob patterns to them, use the `#include` method:\n\n~~~js\nvar fl = new FileList(\"*.scss\");\nfl.include(\"core.css\", \"reset.css\", \"*.css\");\n~~~\n\nYou can also `exlucude` files by Glob pattern, `Regular Expression` pattern, or by use of a `function` that takes the file path as an argument and returns a `truthy` value to exclude a file.\n\n~~~js\n// Exclude by RegExp\nfl.exclude(/^dev-.*\\.css/);\n\n// Exclude by Glob pattern\nfl.exclude(\"dev-*.css\");\n\n// Exclude by function\nfl.exclude(function (path) {\n    return FS.statSync(path).mtime.getTime() < (Date.now() - 60 * 60 * 1000);\n});\n~~~\n\nTo get to the actual items of the FileList, use the `#items` property, or the `#toArray` method, to get a plain array back. You can also use the `#get` or `#set` methods to retrieve or set an item.\n\nFileLists are *lazy*, in that the actual file paths are not determined from the include and exclude patterns until the individual items are requested. This allows you to define a FileList and incrementally add patterns to it in the Sakefile file. The FileList paths will not be resolved until the task that uses it as a prerequisite actually asks for the final paths.\n\n\n### FileList Properties & Methods ###\n\n*   `existing` &mdash; will return a new `FileList` with all of the files that actually exist.\n*   `notExisting` &mdash; will return a new `FileList` of all the files that do not exist.\n*   `extension(ext)` &mdash; returns a new `FileList` with all paths that match the given extension.\n\n~~~js\nfl.extension(\".scss\").forEach(function (path) {\n    //...\n});\n~~~\n\n*   `grep(pattern)` &mdash; get a `FileList` of all the files that match the given `pattern`. `pattern` can be a plain `String`, a `Glob` pattern, a `RegExp`, or a `function` that receives each path and can return a truthy value to include it.\n*   `clearExcludes()` &mdash; clear all exclude patterns/functions.\n*   `clearIncludes()` &mdash; clear all include patterns.\n\nBy default, a `FileList` excludes directories. To allow directories call `FileList#clearExcludes()` before requesting any items.\n\n\nThe \"clean\" and \"clobber\" Tasks, and The CLEAN and CLOBBER FileLists\n--------------------------------------------------------------------\n\nWithin a `Sakefile`:\n\n~~~js\n// defines the CLEAN FileList and 'clean' task\nrequire(\"sake/clean\");\nCLEAN.include(\"**/*.js\");\n\n// defines the above, and also the CLOBBER FileTask and 'clobber' task\nrequire(\"sake/clobber\");\nCLOBBER.include(\"**/*.js\");\n~~~\n\nWhen the \"clean\" task is run, it will remove any files that have been included in the `CLEAN FileList`. \"clobber\" will remove any file, or directory, included in the `CLOBBER FileList`.\n\n\nSaké Utility Functions\n----------------------\n\nSaké defines a few utility functions to make life a little easier in an asynchronous world. Most of these are just wrappers for `node`'s File System (`require(\"fs\")`) utility methods.\n\n### Synchronous Utilities ###\n\n*   `mkdir(dirpath, mode=\"777\")` &mdash; create the `dirpath` directory, if it doesn't already exist.\n*   `mkdir_p(dirpath, mode=\"777\"])` &mdash; as above, but create all intermediate directories as needed.\n*   `rm(path, [path1, ..., pathN])` &mdash; remove one or more paths from the file system.\n*   `rm_rf(path, [path1, ..., pathN])` &mdash; as above, and remove directories and their contents.\n*   `cp(from, to)` &mdash; copy a file from `from` path to `to` path.\n*   `cp_r(from, to)` &mdash; copy all files from `from` path to `to` path.\n*   `mv(from, to)` &mdash; move a file from `from` path to `to` path.\n*   `ln(from, to)` &mdash; create a hard link from `from` path to `to` path.\n*   `ln_s(from, to)` &mdash; create a symlink from `from` path to `to` path.\n*   `cat(path, [path1, ..., pathN]) {string}` &mdash; read all supplied paths and return their contents as a string. If an argument is an `Array` it will be expanded and those paths will be read.\n*   `readdir(path) {array[string]}` &mdash; returns the files of directory `path`.\n*   `read(path, [enc]) {string|Buffer}` &mdash; read the supplied file path. Returns a `buffer`, or a `string` if `enc` is given.\n*   `write(path, data, [enc], mode=\"w\")` &mdash; write the `data` to the supplied file `path`. `data` should be a `buffer` or a `string` if `enc` is given. `mode` is a `string` of either \"w\", for over write,  or \"a\" for append.\n*   `slurp(path, [env]) {sring|Buffer}` &mdash; alias for `read`\n*   `spit(path, data, [enc], mode=\"w\")` &mdash; alias for `write`\n\n\n### Asynchronous Utilities ###\n\n*   `sh(cmd, fn(error, result))` &mdash; execute shell `cmd`. In the callback function, `error` will be a truthy value if there was an error, and `result` will contain the STDERR returned from `cmd`. Otherwise, `result` will contain the STDOUT from the `cmd`. If `cmd` is an array of shell commands, each one will be run before the next, and only when they all complete, or an error is encountered, will the callback `fn` be called, and `result` be an array of the results of the individual commands.\n\n\nDeveloper Notes\n---------------\n\n*   Due to an issue with npm v1.1.13 and up (see issue [#2490](https://github.com/isaacs/npm/issues/2490)), I had to move my code into the `node_modules/sake` directory and add a `bundleDependencies` array to the `package.json` file.\n\nReport an Issue\n---------------\n\n* [Bugs](http://github.com/jhamlet/node-sake/issues)\n* Contact the author: <jhamlet@hamletink.com>\n\n\nLicense\n-------\n\n> Copyright (c) 2012 Jerry Hamlet <jerry@hamletink.com>\n> \n> Permission is hereby granted, free of charge, to any person\n> obtaining a copy of this software and associated documentation\n> files (the \"Software\"), to deal in the Software without\n> restriction, including without limitation the rights to use,\n> copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the\n> Software is furnished to do so, subject to the following\n> conditions:\n> \n> The above copyright notice and this permission notice shall be\n> included in all copies or substantial portions of the Software.\n> \n> The Software shall be used for Good, not Evil.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n> OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n> HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n> WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n> FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n> OTHER DEALINGS IN THE SOFTWARE.\n\n","_id":"sake@0.1.29","dist":{"shasum":"829c1b29ed4dc7582036bacf5080249c5bd5ac84","tarball":"https://registry.npmjs.org/sake/-/sake-0.1.29.tgz","integrity":"sha512-07yYJBgK2IwJt/7LoCOiIRgy6W7jUYbiNm8UKHlXGd55MFd56CX3y8sVvqYYxx3YCodMZYSjEi0buNT3E8OMpw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDKooOI2bM/72DCNI41d3OX294/IxtPNBPmFYWyUWHT5AIhAP0oiLQLsTG0d+uM8w4tYhNVycXJGbm2E1bGck+QsLYA"}]},"maintainers":[{"name":"jhamlet","email":"jerry@hamletink.com"}]},"0.1.30":{"name":"sake","description":"[S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.","version":"0.1.30","keywords":["build","make","rake","jake"],"main":"./node_modules/sake/sake.js","bin":{"sake":"./bin/sake"},"dependencies":{"nomnom":"=1.5.x","async":"=0.1.x","resolve":"=0.2.x","proteus":"=0.1.x","wordwrap":"=0.0.x","glob":"=3.1.x","minimatch":"=0.2.x"},"devDependencies":{"mocha":"=0.3.x","should":"=0.5.x","ejs":"=0.7.x"},"bundleDependencies":["sake"],"scripts":{"test":"mocha test/test-*"},"licenses":[{"type":"MIT","url":"http://github.com/jhamlet/node-sake/raw/master/LICENSE"}],"repository":{"type":"git","url":"http://github.com/jhamlet/node-sake.git"},"bugs":{"url":"http://github.com/jhamlet/node-sake/issues"},"preferGlobal":true,"contributors":[{"name":"Jerry Hamlet","email":"jerry@hamletink.com"}],"readme":"\nSaké\n====\n\n> [S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.\n\n\nOverview\n--------\n\nThis package contains **saké**, a JavaScript build program that runs in node with capabilities similar to ruby's Rake.\n\nSaké has the following features:\n\n1.  `Sakefiles` (**saké’s** version of Rakefiles) are completely defined in standard JavaScript (or CoffeeScript, for those who want an even more Rake-like feel).\n2.  Flexible `FileLists` that act like arrays but know about manipulating file names and paths.\n3.  `clean` and `clobber` tasks are available for tidying up.\n4.  _Asynchronous_ task handling, with easy options for specifying _synchronous_ tasks.\n5.  Simple _namespacing_ of tasks to break projects into discreet parts.\n5.  Many utility methods for handling common build tasks (rm, rm_rf, mkdir, mkdir_p, sh, cat, etc...)\n\n\nInstallation\n------------\n\n### Install with npm\n\nDownload and install with the following:\n\n~~~\nnpm install -g sake\n~~~\n\nCommand-Line Usage\n------------------\n\n~~~\n% sake -h\n\nUsage: sake [TASKNAME] [ARGUMENTS ...] [ENV=VALUE ...] [options]\n\n[TASKNAME]     Name of the task to run. Defaults to 'default'.\n[ARGUMENTS ...]     Zero or more arguments to pass to the task invoked.\n[ENV=VALUE ...]     Zero or more arguments to translate into environment variables.\n\nOptions:\n   -f, --sakefile PATH       PATH to Sakefile to run instead of searching for one.\n   -T, --tasks [PATTERN]     List tasks with descriptions (optionally, just those\n                             matching PATTERN) and exit.\n   -P, --prereqs [PATTERN]   List tasks and their prerequisites (optionally, just\n                             those matching PATTERN) and exit.\n   -r, --require MODULE      Require MODULE before executing Sakefile and expose the\n                             MODULE under a sanitized namespace (i.e.: coffee-script\n                             => [sake.]coffeeScript). Can be specified multiple\n                             times.\n   -l, --sakelib PATH        Auto-include any .sake[.js|.coffeee] files in PATH.\n                             (default is 'sakelib'.) Can be specified multiple times\n   -n, --dry-run             Do a dry run without executing actions.\n   -C, --no-chdir            Do not change directory to the Sakefile location.\n   -N, --no-search           Do not search parent directories for a Sakefile.\n   -G, --no-system           Do not use SAKE_PATH environment variable to search for\n                             a Sakefile.\n   -S, --sync                Make all standard tasks 'synchronous' by default.\n   -d, --debug               Enable additional debugging output.\n   -q, --quiet               Suppress informational messages.\n   -V, --version             Print the version of sake and exit.\n   -h, --help                Print this help information and exit.\n\nIf a Sakefile is not specified, sake searches the current directory, and all parent\ndirectories, for one (unless -N, --no-search is set). Otherwise, if the SAKE_PATH\nenvironment variable is defined it searches those path(s) (unless -G, --no-system is\nset).\n\nIf specified, or found through normal searching (not in SAKE_PATH(s)), sake changes the\nprocess' current working directory to the directory of the found Sakefile (unless -C,\n--no-chdir is set), otherwise it stays where it was run from.\n\nSake then invokes the specified TASKNAME, or the \"default\" one.\n\nSakefile can be one of \"Sakefile\", or \"sakefile\", with an optional extension of \".js\",\nor \".coffee\".\n\n~~~\n\n### Dependencies ###\n\nThese are installed when **sake** is installed.\n\n~~~\nnomnom:    =1.5.x\nasync:     =0.1.x\nresolve:   =0.2.x\nproteus:   =0.1.x\nwordwrap:  =0.0.x\nglob:      =3.1.x\nminimatch: =0.2.x\n~~~\n\n\n### Development Dependencies ###\n\nInstalled when you run `npm link` in the package directory.\n\n~~~\nmocha:  =0.3.x\nshould: =0.5.x\nejs:    =0.7.x\n~~~\n\n\nSakefile Usage\n--------------\n\nWithin a `Sakefile`, Saké's methods are exported to the global scope, so you can invoke them directly:\n\n~~~js\ntask(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n~~~\n    \nWithin another node module you can `require(\"sake\")` and access the methods on the exported object, or even run a block of code in the **saké** context (virtual machine):\n\n~~~js\nvar sake = require(\"sake\");\n    \nsake.task(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n\n// The function passed to sake#run is compiled and run in the sake context.\n// The function **will not** have access to any variables in this scope,\n// nor, will variables leak from the function's scope into this one.\nsake.run(function () {\n    var jsFiles = new FileList(\"src/js/**/*.js\");\n    \n    require(\"sake/clean\");\n    \n    task(\"script-min.js\", jsFiles, function (t) {\n        var cmd = \"infuse \" + jsFiles.map(function (path) {\n                return \"-i \" + path;\n            }) + \" -E\";\n            \n        sh(cmd, function (err, result) {\n            write(t.name, result, \"utf8\");\n            t.done();\n        })\n    });\n    \n    CLEAN.include(\"script-min.js\");\n});\n~~~\n\nThe remainder of this documentation will assume that we are calling the methods from within a `Sakefile`.\n\n\nDefining Tasks\n--------------\n\nThe various task methods take the following arguments:\n\n1.   `taskname`: `string` &mdash; naming the task\n2.   `prerequisites`: _optional_ \n    *   an `array` of:\n        *   `string` task name, or\n        *   a `FileLists`, or \n        *   a `function` that returns one of the above.\n    *   or, you can also pass a `FileList` in directly for `prerequisites`.\n3.   `action`: an _optional_ `function` that will be called when the task is invoked. It will be passed the task instance as its first argument, followed by any arguments that it was invoked with (either from the command-line, or through code). Task arguments can also be accessed through the instance's `arguments` property. i.e: `t.arguments`.\n\nAll task methods return the task *instance*.\n\nIf a task is already defined, it will be augmented by the additional arguments. So, this:\n\n~~~js\ntask(\"one\", [\"othertask\"], function (t) {\n    // do action one...\n    t.done();\n});\n\ntask(\"one\", function (t) {\n    // do action two...\n    t.done();\n});\n\ntask(\"othertask\");\n~~~\n\nWould result in a task \"othertask\" with no prerequisites, and no action, and a task \"one\" with \"othertask\" as a prerequisite and the two functions as its actions.\n\n**Note** how the dependent task was defined *after* it was required as a prerequisite. Task prerequisites are not resolved until the task is invoked. This leads to flexibility in how to compose your tasks and prerequisite tasks.\n\n\n### Task Instance Properties and Methods ###\n\n*   `name {string}` &mdash; the name of the task.\n*   `namespace {string}` &mdash; the task's namespace.\n*   `type {string}` &mdash; one of \"task\", \"file-task\", or \"file-create-task\"\n*   `fqn {string}` &mdash; the fully qualified name of the task. i.e: \"namespace:name\".\n*   `prerequisites {array}` &mdash; the list of prerequisite names for the task.\n*   `isNeeded {boolean}` &mdash; whether or not this task needs to run.\n*   `timestamp {boolean}` &mdash; the last modification time for the task.\n*   `invoke([args ...]) {Task}` &mdash; invoke the task passing args to each action for the task. Will run any prerequisites first. Returns the task instance.\n*   `execute([args ...]) {Task}` &mdash; Like `invoke`, but run the task even if it has already been run, or is not needed.\n*   `done()` &mdash; signal that the current task's action is done running.\n*   `abort([msg], [exitCode])` &mdash; abort the currently running task's actions, if _exitCode_ is specified **saké** will exit with that exit code and no other tasks will be processed. Otherwise, task processing will continue as normal.\n\n\n### Task Static Properties and Methods ###\n\n*   `namespace {string}` &mdash; the current namespace.\n*   `invoke(name, [rest ...]) {Task}` &mdash; invoke the named task and pass it the rest of the arguments.\n*   `get(name, [namespace]) {Task}` &mdash; get the task _name_, optionally start looking in _namespace_. Will throw an error if it can not find a task.\n*   `lookup(name, [namespace]) {Task|null}` &mdash; lookup a task with _name_, optionally start looking in _namespace_.\n*   `getAll() {array[Task]}` &mdash; return all defined tasks.\n*   `has(name, [namespace]) {boolean}` &mdash; does the task _name_ exist?\n*   `find(args, sortFn) {array[Task]}` &mdash; search for a task. _args_ can be an object with keys specifying which properties to match on, and their values denoting the value to match. _args_ can also be a function that accepts a task and returns a boolean whether or not that task matches.\n\n\nFile Tasks\n----------\n\nFile tasks are created with the (appropriately named) `file` method. File tasks are only triggered if the file doesn't exist, or the modification time of any of its prerequisites is newer than itself.\n\n~~~js\nfile(\"path/to/some/file\", function (t) {\n    cp(\"other/path\", t.name);\n    t.done();\n});\n~~~\n\nThe above task would only be triggered if `path/to/some/file` did not exist.\n\nThe following:\n\n~~~js\nfile(\"combined/file/path\", [\"pathA\", \"pathB\", \"pathC\"], function (t) {\n    write(t.name, cat(t.prerequisites), \"utf8\");\n    t.done();\n});\n~~~\n\nwould be triggered if `path/to/some/file` did not exist, or its modification time was earlier than any of its prerequisites (`pathA`, `pathB`, or  `pathC`).\n\n\nDirectory Tasks\n---------------\n\nDirectory tasks, created with the `directory` method, are tasks that will only be called if they do not exist. A task will be created for the named directory (and for all directories along the way) with the action of creating the directory.\n\nDirectory tasks do not take any `prerequisites` or an `action` when first defined, however, they may be augmented with such after they are created:\n\n~~~js\ndirectory(\"dir/path/to/create\");\n\ntask(\"dir/path/to/create\", [\"othertask\"], action (t) {\n    //... do stuff\n    t.done();\n});\n~~~\n\n\nFile Create Tasks\n-----------------\n\nA file create task is a file task, that when used as a prerequisite, will be needed if, and only if, the file has not been created. Once created, it is not re-triggered if any of its prerequisites are newer, nor does it trigger any rebuilds of tasks that depend on it whenever the file is updated.\n\n~~~js\nfileCreate(\"file/path/to/create.ext\", [\"pathA\", \"pathB\"], function (t) {\n    // create file...\n    t.done();\n});\n~~~\n\n\n(A)Synchronicity and Tasks\n--------------------------\n\nIn **saké** all task actions are assumed to be *asynchronous* and an action must call its task's `done` method to tell **saké** that it is done processing stuff.\n\n~~~js\ntask(\"long task\", function (t) {\n    sh(\"some long running shell command\", function (err, result) {\n        // do stuff...\n        t.done();\n    });\n});\n~~~\n\nAlternatively, you can use the `Sync` version of a task to add a *synchronous* action, and `done` will be called for you after the function completes.\n\n~~~js\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n~~~\n\nThere are `Sync` versions of all the core tasks: `taskSync`, `fileSync`, and `fileCreateSync`. There are also `Async` versions of each task: `taskAsync`, `fileAsync`, and `fileCreateAsync`. The actions created for a `directory` task are *synchronous*. You can add *asynchronous* task actions after the initial definition.\n\nThirdly, you can specify that all of the core task creation functions generate *synchronous* actions by setting **saké's** \"sync\" option to `true`, or by use of the command-line option `-S, --sync`.\n\n~~~js\nsake.options.sync = true;\n\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n\n//... define more synchronous tasks\n\n//... and then revert to async\nsake.options.sync = false;\n~~~\n\nUltimately, it is up to the **saké** script author to correctly designate a task action as *synchronous* or *asynchronous*. Nothing prevents the running of an *asynchronous* function within a task's *synchronous* action. If nothing is dependent on the result of that action, then no problem would occur. It's when other tasks rely on the completion of certain *asynchronous* actions, that problems may arise.\n\nIn the case of *asynchronous* actions, **Saké** will issue a `WARNING` when it can not detect a `done()` call within that action.\n\n\nNamespaces\n----------\n\n**Saké** supports simple name spacing of tasks. Simply prepend the namespace before the task name with a colon \":\". This can be done when defining a task, or in the list of prerequisites for a task.\n\n~~~js\n// Defines a task 'fuz' in the namespace 'foo' that depends on the task 'buz'\n// in the namespace 'baz'\ntask(\"foo:fuz\", [\"baz:buz\"], function (t) {\n    //...\n    t.done();\n});\n~~~\n\nThen invoke the task as so:\n\n~~~\n% sake foo:fuz\n~~~\n\nYou can also use the convenience function `namespace` to wrap your task definitions for a particular namespace. Any _namespace naked_ definitions will first be tried in the local namespace, otherwise they will fall-back to the default namespace:\n\n~~~js\n\ntask(\"default\", function (t) {\n    //...\n    t.done():\n});\n\ntask(\"bazil\", function (t) {\n    //...\n    t.done():\n});\n\n// define within the 'foo' namespace\nnamespace(\"foo\", function () {\n    \n    // defines 'foo:foom' task\n    task(\"foom\", function (t) {\n        //...\n        t.done():\n    });\n    \n});\n\nnamespace(\"baz\", function () {\n    \n    // this task is defined in the 'baz' namespace, and depends on the\n    // 'foom' task from the 'foo' namespace\n    task(\"bazil\", [\"foo:foom\"], function (t) {\n        //...\n        t.done():\n    });\n    // This task is also defined in the 'baz' namespace. It depends on \n    // the 'bazil' task, which is also defined in 'baz' namespace. It\n    // also depends on the 'default' task in the 'default' (top-level)\n    // namespace.\n    task(\"buzil\", [\"bazil\", \"default\"], function (t), {\n        //...\n        t.done():\n    });\n    // If 'bazil' wasn't defined in the 'baz' namespace, it would resolve\n    // to the 'default' namespace task.\n});\n~~~\n\n**Note:** prerequisite names are tied to the defined task's namespace. i.e: If a task \"foo:fuz\" depends on \"foom\" **saké** will look in the \"foo\" namespace for \"foom\", and then the \"default\" namespace.\n\n**Note:** although the `namespace` functions can be nested, **saké** does not track the hierarchy of `namespace` calls -- if a dependent task is not found in the current task's namespace, it will look for it in the default namespace.\n\n\nPassing Arguments to A Task\n---------------------------\n\nThere are two ways to pass arguments to a task.\n\nFirst, **saké** translates any arguments in the form of `ENV=VALUE` on the command-line into `process.env` values:\n\n~~~\n% sake build BUILD_TYPE=debug ENVIRONMENT=prod\n~~~\n\nWill set `process.env.BUILD_TYPE` to \"debug\" and `process.env.ENVIRONMENT` to \"prod\". The values are JSON parsed; so the values are translated into real JavaScript values (numbers, true, false, etc...).\n\nSecondly, **saké** passes all non-option, and non-ENV=VALUE, looking arguments from the command-line to the invoked task:\n\n~~~\n% sake foo 3.14 pie true\n~~~\n\nWill invoke the \"foo\" task and pass to each of foo's actions (after the task instance itself) `3.14`, \"pie\" and `true`. The arguments are also JSON parsed to get real JavaScript values.\n\n~~~js\ntask(\"foo\", function (t, amt, word, flag) {\n    log(amt);   // => 3.14\n    log(word);  // => \"pie\"\n    log(flag);  // => true\n});\n~~~\n\n**Note:** This differs from how **rake**, and **jake** do things. In **saké** you can only invoke one task on the command-line. All other arguments on the command-line are considered task arguments.\n\n\nIncluding Other Saké Files\n-------------------------------------\n\nYou can include other **saké** files with the `include` and `load` methods. The included files will be run in the **saké** context, so any variables declared will be set on the global **saké** context. This allows you to break your project build files up into discreet files. Just be aware of naming collisions.\n\nAll `require` and `include`, or `load` statements, are resolved relative to the current file, so you can create your own hierarchy of build dependencies.\n\nYou can also add your own paths to the list of ones that **saké** uses to resolve `requires`: `[sake.]includePaths` is an array of directory paths to search. They are tried in reverse order, so if you push a path on to the array that path will be tried first, followed by any others.\n\n~~~js\n// in a Sakefile\nincludePaths.push(\"some/path\");\n\nrequire(\"some-module\"); // will be tried in some/path/some-module.js\n~~~\n\nAlso, the `__dirname` and `__filename` properties are available in `included` files to help resolve local includes.\n\n~~~js\nvar Path = require(\"path\");\n\ninclude(Path.join(__dirname, \"include-dir/include-file\"));\n~~~\n\nSake Library\n------------\n\n**Saké** will load any `.sake`, `.sake.js`, or `.sake.coffee` files located in a `sakelib` directory relative to the `Sakefile` being run. This directory name can be modified with the `-l, --sakelib` option, and multiple directories can be specified. This allows you to re-use common tasks across multiple projects.\n\n\nFile Lists\n----------\n\nFileLists are lists of file paths.\n\n~~~js\nnew FileList(\"*.scss\");\n~~~\n\nWould contain all the file paths with a \".scss\" extension in the top-level directory of your project.\n\nYou can use FileLists pretty much like an `Array`. You can iterate them (with `forEach, filter, reduce`, etc...), `concat` them, `splice` them, and you get back a new FileList object.\n\nTo add files, or glob patterns to them, use the `#include` method:\n\n~~~js\nvar fl = new FileList(\"*.scss\");\nfl.include(\"core.css\", \"reset.css\", \"*.css\");\n~~~\n\nYou can also `exlucude` files by Glob pattern, `Regular Expression` pattern, or by use of a `function` that takes the file path as an argument and returns a `truthy` value to exclude a file.\n\n~~~js\n// Exclude by RegExp\nfl.exclude(/^dev-.*\\.css/);\n\n// Exclude by Glob pattern\nfl.exclude(\"dev-*.css\");\n\n// Exclude by function\nfl.exclude(function (path) {\n    return FS.statSync(path).mtime.getTime() < (Date.now() - 60 * 60 * 1000);\n});\n~~~\n\nTo get to the actual items of the FileList, use the `#items` property, or the `#toArray` method, to get a plain array back. You can also use the `#get` or `#set` methods to retrieve or set an item.\n\nFileLists are *lazy*, in that the actual file paths are not determined from the include and exclude patterns until the individual items are requested. This allows you to define a FileList and incrementally add patterns to it in the Sakefile file. The FileList paths will not be resolved until the task that uses it as a prerequisite actually asks for the final paths.\n\n\n### FileList Properties & Methods ###\n\n*   `existing` &mdash; will return a new `FileList` with all of the files that actually exist.\n*   `notExisting` &mdash; will return a new `FileList` of all the files that do not exist.\n*   `extension(ext)` &mdash; returns a new `FileList` with all paths that match the given extension.\n\n~~~js\nfl.extension(\".scss\").forEach(function (path) {\n    //...\n});\n~~~\n\n*   `grep(pattern)` &mdash; get a `FileList` of all the files that match the given `pattern`. `pattern` can be a plain `String`, a `Glob` pattern, a `RegExp`, or a `function` that receives each path and can return a truthy value to include it.\n*   `clearExcludes()` &mdash; clear all exclude patterns/functions.\n*   `clearIncludes()` &mdash; clear all include patterns.\n\nBy default, a `FileList` excludes directories. To allow directories call `FileList#clearExcludes()` before requesting any items.\n\n\nThe \"clean\" and \"clobber\" Tasks, and The CLEAN and CLOBBER FileLists\n--------------------------------------------------------------------\n\nWithin a `Sakefile`:\n\n~~~js\n// defines the CLEAN FileList and 'clean' task\nrequire(\"sake/clean\");\nCLEAN.include(\"**/*.js\");\n\n// defines the above, and also the CLOBBER FileTask and 'clobber' task\nrequire(\"sake/clobber\");\nCLOBBER.include(\"**/*.js\");\n~~~\n\nWhen the \"clean\" task is run, it will remove any files that have been included in the `CLEAN FileList`. \"clobber\" will remove any file, or directory, included in the `CLOBBER FileList`.\n\n\nSaké Utility Functions\n----------------------\n\nSaké defines a few utility functions to make life a little easier in an asynchronous world. Most of these are just wrappers for `node`'s File System (`require(\"fs\")`) utility methods.\n\n### Synchronous Utilities ###\n\n*   `mkdir(dirpath, mode=\"777\")` &mdash; create the `dirpath` directory, if it doesn't already exist.\n*   `mkdir_p(dirpath, mode=\"777\"])` &mdash; as above, but create all intermediate directories as needed.\n*   `rm(path, [path1, ..., pathN])` &mdash; remove one or more paths from the file system.\n*   `rm_rf(path, [path1, ..., pathN])` &mdash; as above, and remove directories and their contents.\n*   `cp(from, to)` &mdash; copy a file from `from` path to `to` path.\n*   `cp_r(from, to)` &mdash; copy all files from `from` path to `to` path.\n*   `mv(from, to)` &mdash; move a file from `from` path to `to` path.\n*   `ln(from, to)` &mdash; create a hard link from `from` path to `to` path.\n*   `ln_s(from, to)` &mdash; create a symlink from `from` path to `to` path.\n*   `cat(path, [path1, ..., pathN]) {string}` &mdash; read all supplied paths and return their contents as a string. If an argument is an `Array` it will be expanded and those paths will be read.\n*   `readdir(path) {array[string]}` &mdash; returns the files of directory `path`.\n*   `read(path, [enc]) {string|Buffer}` &mdash; read the supplied file path. Returns a `buffer`, or a `string` if `enc` is given.\n*   `write(path, data, [enc], mode=\"w\")` &mdash; write the `data` to the supplied file `path`. `data` should be a `buffer` or a `string` if `enc` is given. `mode` is a `string` of either \"w\", for over write,  or \"a\" for append.\n*   `slurp(path, [env]) {sring|Buffer}` &mdash; alias for `read`\n*   `spit(path, data, [enc], mode=\"w\")` &mdash; alias for `write`\n\n\n### Asynchronous Utilities ###\n\n*   `sh(cmd, fn(error, result))` &mdash; execute shell `cmd`. In the callback function, `error` will be a truthy value if there was an error, and `result` will contain the STDERR returned from `cmd`. Otherwise, `result` will contain the STDOUT from the `cmd`. If `cmd` is an array of shell commands, each one will be run before the next, and only when they all complete, or an error is encountered, will the callback `fn` be called, and `result` be an array of the results of the individual commands.\n\n\nDeveloper Notes\n---------------\n\n*   Due to an issue with npm v1.1.13 and up (see issue [#2490](https://github.com/isaacs/npm/issues/2490)), I had to move my code into the `node_modules/sake` directory and add a `bundleDependencies` array to the `package.json` file.\n\nReport an Issue\n---------------\n\n* [Bugs](http://github.com/jhamlet/node-sake/issues)\n* Contact the author: <jhamlet@hamletink.com>\n\n\nLicense\n-------\n\n> Copyright (c) 2012 Jerry Hamlet <jerry@hamletink.com>\n> \n> Permission is hereby granted, free of charge, to any person\n> obtaining a copy of this software and associated documentation\n> files (the \"Software\"), to deal in the Software without\n> restriction, including without limitation the rights to use,\n> copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the\n> Software is furnished to do so, subject to the following\n> conditions:\n> \n> The above copyright notice and this permission notice shall be\n> included in all copies or substantial portions of the Software.\n> \n> The Software shall be used for Good, not Evil.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n> OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n> HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n> WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n> FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n> OTHER DEALINGS IN THE SOFTWARE.\n\n","_id":"sake@0.1.30","dist":{"shasum":"3cb53b5a589d835e90dc700a508f98d254fc8355","tarball":"https://registry.npmjs.org/sake/-/sake-0.1.30.tgz","integrity":"sha512-jaHgXqMQLa64b4aFRKVoaJowfN/s2rcuIXAiaRab3Tf5iKzZpVk/r6y/yn62l5neYi1fMfW9GbcViM3ZgeEEsA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC4OFdtAax87Wvhn7PEnFuDknL8Z7ieFkosStIKoAH1bAIgBJHBX9QPWVFy6EsW8gmR0t9fc/GJepnB0FKrrRw39YI="}]},"maintainers":[{"name":"jhamlet","email":"jerry@hamletink.com"}]},"0.1.31":{"name":"sake","description":"[S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.","version":"0.1.31","keywords":["build","make","rake","jake"],"main":"./node_modules/sake/sake.js","bin":{"sake":"./bin/sake"},"dependencies":{"nomnom":"=1.5.x","async":"=0.2.x","resolve":"=0.2.x","proteus":"=0.1.x","wordwrap":"=0.0.x","glob":"=3.1.x","minimatch":"=0.2.x"},"devDependencies":{"mocha":"=0.3.x","should":"=0.5.x","ejs":"=0.7.x"},"bundleDependencies":["sake"],"scripts":{"test":"mocha test/test-*"},"licenses":[{"type":"MIT","url":"http://github.com/jhamlet/node-sake/raw/master/LICENSE"}],"repository":{"type":"git","url":"http://github.com/jhamlet/node-sake.git"},"bugs":{"url":"http://github.com/jhamlet/node-sake/issues"},"preferGlobal":true,"contributors":[{"name":"Jerry Hamlet","email":"jerry@hamletink.com"}],"readme":"\nSaké\n====\n\n> [S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.\n\n\nOverview\n--------\n\nThis package contains **saké**, a JavaScript build program that runs in node with capabilities similar to ruby's Rake.\n\nSaké has the following features:\n\n1.  `Sakefiles` (**saké’s** version of Rakefiles) are completely defined in standard JavaScript (or CoffeeScript, for those who want an even more Rake-like feel).\n2.  Flexible `FileLists` that act like arrays but know about manipulating file names and paths.\n3.  `clean` and `clobber` tasks are available for tidying up.\n4.  _Asynchronous_ task handling, with easy options for specifying _synchronous_ tasks.\n5.  Simple _namespacing_ of tasks to break projects into discreet parts.\n5.  Many utility methods for handling common build tasks (rm, rm_rf, mkdir, mkdir_p, sh, cat, etc...)\n\n\nInstallation\n------------\n\n### Install with npm\n\nDownload and install with the following:\n\n~~~\nnpm install -g sake\n~~~\n\nCommand-Line Usage\n------------------\n\n~~~\n% sake -h\n\nUsage: sake [TASKNAME] [ARGUMENTS ...] [ENV=VALUE ...] [options]\n\n[TASKNAME]     Name of the task to run. Defaults to 'default'.\n[ARGUMENTS ...]     Zero or more arguments to pass to the task invoked.\n[ENV=VALUE ...]     Zero or more arguments to translate into environment variables.\n\nOptions:\n   -f, --sakefile PATH       PATH to Sakefile to run instead of searching for one.\n   -T, --tasks [PATTERN]     List tasks with descriptions (optionally, just those\n                             matching PATTERN) and exit.\n   -P, --prereqs [PATTERN]   List tasks and their prerequisites (optionally, just\n                             those matching PATTERN) and exit.\n   -r, --require MODULE      Require MODULE before executing Sakefile and expose the\n                             MODULE under a sanitized namespace (i.e.: coffee-script\n                             => [sake.]coffeeScript). Can be specified multiple\n                             times.\n   -l, --sakelib PATH        Auto-include any .sake[.js|.coffeee] files in PATH.\n                             (default is 'sakelib'.) Can be specified multiple times\n   -n, --dry-run             Do a dry run without executing actions.\n   -C, --no-chdir            Do not change directory to the Sakefile location.\n   -N, --no-search           Do not search parent directories for a Sakefile.\n   -G, --no-system           Do not use SAKE_PATH environment variable to search for\n                             a Sakefile.\n   -S, --sync                Make all standard tasks 'synchronous' by default.\n   -d, --debug               Enable additional debugging output.\n   -q, --quiet               Suppress informational messages.\n   -V, --version             Print the version of sake and exit.\n   -h, --help                Print this help information and exit.\n\nIf a Sakefile is not specified, sake searches the current directory, and all parent\ndirectories, for one (unless -N, --no-search is set). Otherwise, if the SAKE_PATH\nenvironment variable is defined it searches those path(s) (unless -G, --no-system is\nset).\n\nIf specified, or found through normal searching (not in SAKE_PATH(s)), sake changes the\nprocess' current working directory to the directory of the found Sakefile (unless -C,\n--no-chdir is set), otherwise it stays where it was run from.\n\nSake then invokes the specified TASKNAME, or the \"default\" one.\n\nSakefile can be one of \"Sakefile\", or \"sakefile\", with an optional extension of \".js\",\nor \".coffee\".\n\n~~~\n\n### Dependencies ###\n\nThese are installed when **sake** is installed.\n\n~~~\nnomnom:    =1.5.x\nasync:     =0.1.x\nresolve:   =0.2.x\nproteus:   =0.1.x\nwordwrap:  =0.0.x\nglob:      =3.1.x\nminimatch: =0.2.x\n~~~\n\n\n### Development Dependencies ###\n\nInstalled when you run `npm link` in the package directory.\n\n~~~\nmocha:  =0.3.x\nshould: =0.5.x\nejs:    =0.7.x\n~~~\n\n\nSakefile Usage\n--------------\n\nWithin a `Sakefile`, Saké's methods are exported to the global scope, so you can invoke them directly:\n\n~~~js\ntask(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n~~~\n    \nWithin another node module you can `require(\"sake\")` and access the methods on the exported object, or even run a block of code in the **saké** context (virtual machine):\n\n~~~js\nvar sake = require(\"sake\");\n    \nsake.task(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n\n// The function passed to sake#run is compiled and run in the sake context.\n// The function **will not** have access to any variables in this scope,\n// nor, will variables leak from the function's scope into this one.\nsake.run(function () {\n    var jsFiles = new FileList(\"src/js/**/*.js\");\n    \n    require(\"sake/clean\");\n    \n    task(\"script-min.js\", jsFiles, function (t) {\n        var cmd = \"infuse \" + jsFiles.map(function (path) {\n                return \"-i \" + path;\n            }) + \" -E\";\n            \n        sh(cmd, function (err, result) {\n            write(t.name, result, \"utf8\");\n            t.done();\n        })\n    });\n    \n    CLEAN.include(\"script-min.js\");\n});\n~~~\n\nThe remainder of this documentation will assume that we are calling the methods from within a `Sakefile`.\n\n\nDefining Tasks\n--------------\n\nThe various task methods take the following arguments:\n\n1.   `taskname`: `string` &mdash; naming the task\n2.   `prerequisites`: _optional_ \n    *   an `array` of:\n        *   `string` task name, or\n        *   a `FileLists`, or \n        *   a `function` that returns one of the above.\n    *   or, you can also pass a `FileList` in directly for `prerequisites`.\n3.   `action`: an _optional_ `function` that will be called when the task is invoked. It will be passed the task instance as its first argument, followed by any arguments that it was invoked with (either from the command-line, or through code). Task arguments can also be accessed through the instance's `arguments` property. i.e: `t.arguments`.\n\nAll task methods return the task *instance*.\n\nIf a task is already defined, it will be augmented by the additional arguments. So, this:\n\n~~~js\ntask(\"one\", [\"othertask\"], function (t) {\n    // do action one...\n    t.done();\n});\n\ntask(\"one\", function (t) {\n    // do action two...\n    t.done();\n});\n\ntask(\"othertask\");\n~~~\n\nWould result in a task \"othertask\" with no prerequisites, and no action, and a task \"one\" with \"othertask\" as a prerequisite and the two functions as its actions.\n\n**Note** how the dependent task was defined *after* it was required as a prerequisite. Task prerequisites are not resolved until the task is invoked. This leads to flexibility in how to compose your tasks and prerequisite tasks.\n\n\n### Task Instance Properties and Methods ###\n\n*   `name {string}` &mdash; the name of the task.\n*   `namespace {string}` &mdash; the task's namespace.\n*   `type {string}` &mdash; one of \"task\", \"file-task\", or \"file-create-task\"\n*   `fqn {string}` &mdash; the fully qualified name of the task. i.e: \"namespace:name\".\n*   `prerequisites {array}` &mdash; the list of prerequisite names for the task.\n*   `isNeeded {boolean}` &mdash; whether or not this task needs to run.\n*   `timestamp {boolean}` &mdash; the last modification time for the task.\n*   `invoke([args ...]) {Task}` &mdash; invoke the task passing args to each action for the task. Will run any prerequisites first. Returns the task instance.\n*   `execute([args ...]) {Task}` &mdash; Like `invoke`, but run the task even if it has already been run, or is not needed.\n*   `done()` &mdash; signal that the current task's action is done running.\n*   `abort([msg], [exitCode])` &mdash; abort the currently running task's actions, if _exitCode_ is specified **saké** will exit with that exit code and no other tasks will be processed. Otherwise, task processing will continue as normal.\n\n\n### Task Static Properties and Methods ###\n\n*   `namespace {string}` &mdash; the current namespace.\n*   `invoke(name, [rest ...]) {Task}` &mdash; invoke the named task and pass it the rest of the arguments.\n*   `get(name, [namespace]) {Task}` &mdash; get the task _name_, optionally start looking in _namespace_. Will throw an error if it can not find a task.\n*   `lookup(name, [namespace]) {Task|null}` &mdash; lookup a task with _name_, optionally start looking in _namespace_.\n*   `getAll() {array[Task]}` &mdash; return all defined tasks.\n*   `has(name, [namespace]) {boolean}` &mdash; does the task _name_ exist?\n*   `find(args, sortFn) {array[Task]}` &mdash; search for a task. _args_ can be an object with keys specifying which properties to match on, and their values denoting the value to match. _args_ can also be a function that accepts a task and returns a boolean whether or not that task matches.\n\n\nFile Tasks\n----------\n\nFile tasks are created with the (appropriately named) `file` method. File tasks are only triggered if the file doesn't exist, or the modification time of any of its prerequisites is newer than itself.\n\n~~~js\nfile(\"path/to/some/file\", function (t) {\n    cp(\"other/path\", t.name);\n    t.done();\n});\n~~~\n\nThe above task would only be triggered if `path/to/some/file` did not exist.\n\nThe following:\n\n~~~js\nfile(\"combined/file/path\", [\"pathA\", \"pathB\", \"pathC\"], function (t) {\n    write(t.name, cat(t.prerequisites), \"utf8\");\n    t.done();\n});\n~~~\n\nwould be triggered if `path/to/some/file` did not exist, or its modification time was earlier than any of its prerequisites (`pathA`, `pathB`, or  `pathC`).\n\n\nDirectory Tasks\n---------------\n\nDirectory tasks, created with the `directory` method, are tasks that will only be called if they do not exist. A task will be created for the named directory (and for all directories along the way) with the action of creating the directory.\n\nDirectory tasks do not take any `prerequisites` or an `action` when first defined, however, they may be augmented with such after they are created:\n\n~~~js\ndirectory(\"dir/path/to/create\");\n\ntask(\"dir/path/to/create\", [\"othertask\"], action (t) {\n    //... do stuff\n    t.done();\n});\n~~~\n\n\nFile Create Tasks\n-----------------\n\nA file create task is a file task, that when used as a prerequisite, will be needed if, and only if, the file has not been created. Once created, it is not re-triggered if any of its prerequisites are newer, nor does it trigger any rebuilds of tasks that depend on it whenever the file is updated.\n\n~~~js\nfileCreate(\"file/path/to/create.ext\", [\"pathA\", \"pathB\"], function (t) {\n    // create file...\n    t.done();\n});\n~~~\n\n\n(A)Synchronicity and Tasks\n--------------------------\n\nIn **saké** all task actions are assumed to be *asynchronous* and an action must call its task's `done` method to tell **saké** that it is done processing stuff.\n\n~~~js\ntask(\"long task\", function (t) {\n    sh(\"some long running shell command\", function (err, result) {\n        // do stuff...\n        t.done();\n    });\n});\n~~~\n\nAlternatively, you can use the `Sync` version of a task to add a *synchronous* action, and `done` will be called for you after the function completes.\n\n~~~js\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n~~~\n\nThere are `Sync` versions of all the core tasks: `taskSync`, `fileSync`, and `fileCreateSync`. There are also `Async` versions of each task: `taskAsync`, `fileAsync`, and `fileCreateAsync`. The actions created for a `directory` task are *synchronous*. You can add *asynchronous* task actions after the initial definition.\n\nThirdly, you can specify that all of the core task creation functions generate *synchronous* actions by setting **saké's** \"sync\" option to `true`, or by use of the command-line option `-S, --sync`.\n\n~~~js\nsake.options.sync = true;\n\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n\n//... define more synchronous tasks\n\n//... and then revert to async\nsake.options.sync = false;\n~~~\n\nUltimately, it is up to the **saké** script author to correctly designate a task action as *synchronous* or *asynchronous*. Nothing prevents the running of an *asynchronous* function within a task's *synchronous* action. If nothing is dependent on the result of that action, then no problem would occur. It's when other tasks rely on the completion of certain *asynchronous* actions, that problems may arise.\n\nIn the case of *asynchronous* actions, **Saké** will issue a `WARNING` when it can not detect a `done()` call within that action.\n\n\nNamespaces\n----------\n\n**Saké** supports simple name spacing of tasks. Simply prepend the namespace before the task name with a colon \":\". This can be done when defining a task, or in the list of prerequisites for a task.\n\n~~~js\n// Defines a task 'fuz' in the namespace 'foo' that depends on the task 'buz'\n// in the namespace 'baz'\ntask(\"foo:fuz\", [\"baz:buz\"], function (t) {\n    //...\n    t.done();\n});\n~~~\n\nThen invoke the task as so:\n\n~~~\n% sake foo:fuz\n~~~\n\nYou can also use the convenience function `namespace` to wrap your task definitions for a particular namespace. Any _namespace naked_ definitions will first be tried in the local namespace, otherwise they will fall-back to the default namespace:\n\n~~~js\n\ntask(\"default\", function (t) {\n    //...\n    t.done():\n});\n\ntask(\"bazil\", function (t) {\n    //...\n    t.done():\n});\n\n// define within the 'foo' namespace\nnamespace(\"foo\", function () {\n    \n    // defines 'foo:foom' task\n    task(\"foom\", function (t) {\n        //...\n        t.done():\n    });\n    \n});\n\nnamespace(\"baz\", function () {\n    \n    // this task is defined in the 'baz' namespace, and depends on the\n    // 'foom' task from the 'foo' namespace\n    task(\"bazil\", [\"foo:foom\"], function (t) {\n        //...\n        t.done():\n    });\n    // This task is also defined in the 'baz' namespace. It depends on \n    // the 'bazil' task, which is also defined in 'baz' namespace. It\n    // also depends on the 'default' task in the 'default' (top-level)\n    // namespace.\n    task(\"buzil\", [\"bazil\", \"default\"], function (t), {\n        //...\n        t.done():\n    });\n    // If 'bazil' wasn't defined in the 'baz' namespace, it would resolve\n    // to the 'default' namespace task.\n});\n~~~\n\n**Note:** prerequisite names are tied to the defined task's namespace. i.e: If a task \"foo:fuz\" depends on \"foom\" **saké** will look in the \"foo\" namespace for \"foom\", and then the \"default\" namespace.\n\n**Note:** although the `namespace` functions can be nested, **saké** does not track the hierarchy of `namespace` calls -- if a dependent task is not found in the current task's namespace, it will look for it in the default namespace.\n\n\nPassing Arguments to A Task\n---------------------------\n\nThere are two ways to pass arguments to a task.\n\nFirst, **saké** translates any arguments in the form of `ENV=VALUE` on the command-line into `process.env` values:\n\n~~~\n% sake build BUILD_TYPE=debug ENVIRONMENT=prod\n~~~\n\nWill set `process.env.BUILD_TYPE` to \"debug\" and `process.env.ENVIRONMENT` to \"prod\". The values are JSON parsed; so the values are translated into real JavaScript values (numbers, true, false, etc...).\n\nSecondly, **saké** passes all non-option, and non-ENV=VALUE, looking arguments from the command-line to the invoked task:\n\n~~~\n% sake foo 3.14 pie true\n~~~\n\nWill invoke the \"foo\" task and pass to each of foo's actions (after the task instance itself) `3.14`, \"pie\" and `true`. The arguments are also JSON parsed to get real JavaScript values.\n\n~~~js\ntask(\"foo\", function (t, amt, word, flag) {\n    log(amt);   // => 3.14\n    log(word);  // => \"pie\"\n    log(flag);  // => true\n});\n~~~\n\n**Note:** This differs from how **rake**, and **jake** do things. In **saké** you can only invoke one task on the command-line. All other arguments on the command-line are considered task arguments.\n\n\nIncluding Other Saké Files\n-------------------------------------\n\nYou can include other **saké** files with the `include` and `load` methods. The included files will be run in the **saké** context, so any variables declared will be set on the global **saké** context. This allows you to break your project build files up into discreet files. Just be aware of naming collisions.\n\nAll `require` and `include`, or `load` statements, are resolved relative to the current file, so you can create your own hierarchy of build dependencies.\n\nYou can also add your own paths to the list of ones that **saké** uses to resolve `requires`: `[sake.]includePaths` is an array of directory paths to search. They are tried in reverse order, so if you push a path on to the array that path will be tried first, followed by any others.\n\n~~~js\n// in a Sakefile\nincludePaths.push(\"some/path\");\n\nrequire(\"some-module\"); // will be tried in some/path/some-module.js\n~~~\n\nAlso, the `__dirname` and `__filename` properties are available in `included` files to help resolve local includes.\n\n~~~js\nvar Path = require(\"path\");\n\ninclude(Path.join(__dirname, \"include-dir/include-file\"));\n~~~\n\nSake Library\n------------\n\n**Saké** will load any `.sake`, `.sake.js`, or `.sake.coffee` files located in a `sakelib` directory relative to the `Sakefile` being run. This directory name can be modified with the `-l, --sakelib` option, and multiple directories can be specified. This allows you to re-use common tasks across multiple projects.\n\n\nFile Lists\n----------\n\nFileLists are lists of file paths.\n\n~~~js\nnew FileList(\"*.scss\");\n~~~\n\nWould contain all the file paths with a \".scss\" extension in the top-level directory of your project.\n\nYou can use FileLists pretty much like an `Array`. You can iterate them (with `forEach, filter, reduce`, etc...), `concat` them, `splice` them, and you get back a new FileList object.\n\nTo add files, or glob patterns to them, use the `#include` method:\n\n~~~js\nvar fl = new FileList(\"*.scss\");\nfl.include(\"core.css\", \"reset.css\", \"*.css\");\n~~~\n\nYou can also `exlucude` files by Glob pattern, `Regular Expression` pattern, or by use of a `function` that takes the file path as an argument and returns a `truthy` value to exclude a file.\n\n~~~js\n// Exclude by RegExp\nfl.exclude(/^dev-.*\\.css/);\n\n// Exclude by Glob pattern\nfl.exclude(\"dev-*.css\");\n\n// Exclude by function\nfl.exclude(function (path) {\n    return FS.statSync(path).mtime.getTime() < (Date.now() - 60 * 60 * 1000);\n});\n~~~\n\nTo get to the actual items of the FileList, use the `#items` property, or the `#toArray` method, to get a plain array back. You can also use the `#get` or `#set` methods to retrieve or set an item.\n\nFileLists are *lazy*, in that the actual file paths are not determined from the include and exclude patterns until the individual items are requested. This allows you to define a FileList and incrementally add patterns to it in the Sakefile file. The FileList paths will not be resolved until the task that uses it as a prerequisite actually asks for the final paths.\n\n\n### FileList Properties & Methods ###\n\n*   `existing` &mdash; will return a new `FileList` with all of the files that actually exist.\n*   `notExisting` &mdash; will return a new `FileList` of all the files that do not exist.\n*   `extension(ext)` &mdash; returns a new `FileList` with all paths that match the given extension.\n\n~~~js\nfl.extension(\".scss\").forEach(function (path) {\n    //...\n});\n~~~\n\n*   `grep(pattern)` &mdash; get a `FileList` of all the files that match the given `pattern`. `pattern` can be a plain `String`, a `Glob` pattern, a `RegExp`, or a `function` that receives each path and can return a truthy value to include it.\n*   `clearExcludes()` &mdash; clear all exclude patterns/functions.\n*   `clearIncludes()` &mdash; clear all include patterns.\n\nBy default, a `FileList` excludes directories. To allow directories call `FileList#clearExcludes()` before requesting any items.\n\n\nThe \"clean\" and \"clobber\" Tasks, and The CLEAN and CLOBBER FileLists\n--------------------------------------------------------------------\n\nWithin a `Sakefile`:\n\n~~~js\n// defines the CLEAN FileList and 'clean' task\nrequire(\"sake/clean\");\nCLEAN.include(\"**/*.js\");\n\n// defines the above, and also the CLOBBER FileTask and 'clobber' task\nrequire(\"sake/clobber\");\nCLOBBER.include(\"**/*.js\");\n~~~\n\nWhen the \"clean\" task is run, it will remove any files that have been included in the `CLEAN FileList`. \"clobber\" will remove any file, or directory, included in the `CLOBBER FileList`.\n\n\nSaké Utility Functions\n----------------------\n\nSaké defines a few utility functions to make life a little easier in an asynchronous world. Most of these are just wrappers for `node`'s File System (`require(\"fs\")`) utility methods.\n\n### Synchronous Utilities ###\n\n*   `mkdir(dirpath, mode=\"777\")` &mdash; create the `dirpath` directory, if it doesn't already exist.\n*   `mkdir_p(dirpath, mode=\"777\"])` &mdash; as above, but create all intermediate directories as needed.\n*   `rm(path, [path1, ..., pathN])` &mdash; remove one or more paths from the file system.\n*   `rm_rf(path, [path1, ..., pathN])` &mdash; as above, and remove directories and their contents.\n*   `cp(from, to)` &mdash; copy a file from `from` path to `to` path.\n*   `cp_r(from, to)` &mdash; copy all files from `from` path to `to` path.\n*   `mv(from, to)` &mdash; move a file from `from` path to `to` path.\n*   `ln(from, to)` &mdash; create a hard link from `from` path to `to` path.\n*   `ln_s(from, to)` &mdash; create a symlink from `from` path to `to` path.\n*   `cat(path, [path1, ..., pathN]) {string}` &mdash; read all supplied paths and return their contents as a string. If an argument is an `Array` it will be expanded and those paths will be read.\n*   `readdir(path) {array[string]}` &mdash; returns the files of directory `path`.\n*   `read(path, [enc]) {string|Buffer}` &mdash; read the supplied file path. Returns a `buffer`, or a `string` if `enc` is given.\n*   `write(path, data, [enc], mode=\"w\")` &mdash; write the `data` to the supplied file `path`. `data` should be a `buffer` or a `string` if `enc` is given. `mode` is a `string` of either \"w\", for over write,  or \"a\" for append.\n*   `slurp(path, [env]) {sring|Buffer}` &mdash; alias for `read`\n*   `spit(path, data, [enc], mode=\"w\")` &mdash; alias for `write`\n\n\n### Asynchronous Utilities ###\n\n*   `sh(cmd, fn(error, result))` &mdash; execute shell `cmd`. In the callback function, `error` will be a truthy value if there was an error, and `result` will contain the STDERR returned from `cmd`. Otherwise, `result` will contain the STDOUT from the `cmd`. If `cmd` is an array of shell commands, each one will be run before the next, and only when they all complete, or an error is encountered, will the callback `fn` be called, and `result` be an array of the results of the individual commands.\n\n\nDeveloper Notes\n---------------\n\n*   Due to an issue with npm v1.1.13 and up (see issue [#2490](https://github.com/isaacs/npm/issues/2490)), I had to move my code into the `node_modules/sake` directory and add a `bundleDependencies` array to the `package.json` file.\n\nReport an Issue\n---------------\n\n* [Bugs](http://github.com/jhamlet/node-sake/issues)\n* Contact the author: <jhamlet@hamletink.com>\n\n\nLicense\n-------\n\n> Copyright (c) 2012 Jerry Hamlet <jerry@hamletink.com>\n> \n> Permission is hereby granted, free of charge, to any person\n> obtaining a copy of this software and associated documentation\n> files (the \"Software\"), to deal in the Software without\n> restriction, including without limitation the rights to use,\n> copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the\n> Software is furnished to do so, subject to the following\n> conditions:\n> \n> The above copyright notice and this permission notice shall be\n> included in all copies or substantial portions of the Software.\n> \n> The Software shall be used for Good, not Evil.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n> OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n> HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n> WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n> FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n> OTHER DEALINGS IN THE SOFTWARE.\n\n","readmeFilename":"README.md","_id":"sake@0.1.31","dist":{"shasum":"ec9530a0d71f511c977c3ba552a2cf1129af980c","tarball":"https://registry.npmjs.org/sake/-/sake-0.1.31.tgz","integrity":"sha512-Sp9LyR71nspDLJfR8YHyMMYy4lG7vJHgGbLPa9P2TyaMeT8x+4oVD7v8ex+t2xP7vv91eLj0TnE8DKeldyllGQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDRn0HQMQvo8qae4Yi60p5u3uCNWm5QWeOkIES7sl21lgIgCgZAHU7HBhuhOUmvf809EynB6b79GaNbXgyyupqyCNY="}]},"_npmVersion":"1.1.65","_npmUser":{"name":"jhamlet","email":"jerry@hamletink.com"},"maintainers":[{"name":"jhamlet","email":"jerry@hamletink.com"}]},"0.1.32":{"name":"sake","description":"[S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.","version":"0.1.32","keywords":["build","make","rake","jake"],"main":"./node_modules/sake/sake.js","bin":{"sake":"./bin/sake"},"dependencies":{"nomnom":"=1.5.x","async":"=0.2.x","resolve":"=0.2.x","proteus":"=0.1.x","wordwrap":"=0.0.x","glob":"=3.1.x","minimatch":"=0.2.x"},"devDependencies":{"mocha":"=0.3.x","should":"=0.5.x","ejs":"=0.7.x"},"bundleDependencies":["sake"],"scripts":{"test":"mocha test/test-*"},"licenses":[{"type":"MIT","url":"http://github.com/jhamlet/node-sake/raw/master/LICENSE"}],"repository":{"type":"git","url":"http://github.com/jhamlet/node-sake.git"},"bugs":{"url":"http://github.com/jhamlet/node-sake/issues"},"preferGlobal":true,"contributors":[{"name":"Jerry Hamlet","email":"jerry@hamletink.com"}],"readme":"\nSaké\n====\n\n> [S]cripted-r[ake] -- a JavaScript build tool similar to rake, or make.\n\n\nOverview\n--------\n\nThis package contains **saké**, a JavaScript build program that runs in node with capabilities similar to ruby's Rake.\n\nSaké has the following features:\n\n1.  `Sakefiles` (**saké’s** version of Rakefiles) are completely defined in standard JavaScript (or CoffeeScript, for those who want an even more Rake-like feel).\n2.  Flexible `FileLists` that act like arrays but know about manipulating file names and paths.\n3.  `clean` and `clobber` tasks are available for tidying up.\n4.  _Asynchronous_ task handling, with easy options for specifying _synchronous_ tasks.\n5.  Simple _namespacing_ of tasks to break projects into discreet parts.\n5.  Many utility methods for handling common build tasks (rm, rm_rf, mkdir, mkdir_p, sh, cat, etc...)\n\n\nInstallation\n------------\n\n### Install with npm\n\nDownload and install with the following:\n\n~~~\nnpm install -g sake\n~~~\n\nCommand-Line Usage\n------------------\n\n~~~\n% sake -h\n\nUsage: sake [TASKNAME] [ARGUMENTS ...] [ENV=VALUE ...] [options]\n\n[TASKNAME]     Name of the task to run. Defaults to 'default'.\n[ARGUMENTS ...]     Zero or more arguments to pass to the task invoked.\n[ENV=VALUE ...]     Zero or more arguments to translate into environment variables.\n\nOptions:\n   -f, --sakefile PATH       PATH to Sakefile to run instead of searching for one.\n   -T, --tasks [PATTERN]     List tasks with descriptions (optionally, just those\n                             matching PATTERN) and exit.\n   -P, --prereqs [PATTERN]   List tasks and their prerequisites (optionally, just\n                             those matching PATTERN) and exit.\n   -r, --require MODULE      Require MODULE before executing Sakefile and expose the\n                             MODULE under a sanitized namespace (i.e.: coffee-script\n                             => [sake.]coffeeScript). Can be specified multiple\n                             times.\n   -l, --sakelib PATH        Auto-include any .sake[.js|.coffeee] files in PATH.\n                             (default is 'sakelib'.) Can be specified multiple times\n   -n, --dry-run             Do a dry run without executing actions.\n   -C, --no-chdir            Do not change directory to the Sakefile location.\n   -N, --no-search           Do not search parent directories for a Sakefile.\n   -G, --no-system           Do not use SAKE_PATH environment variable to search for\n                             a Sakefile.\n   -S, --sync                Make all standard tasks 'synchronous' by default.\n   -d, --debug               Enable additional debugging output.\n   -q, --quiet               Suppress informational messages.\n   -V, --version             Print the version of sake and exit.\n   -h, --help                Print this help information and exit.\n\nIf a Sakefile is not specified, sake searches the current directory, and all parent\ndirectories, for one (unless -N, --no-search is set). Otherwise, if the SAKE_PATH\nenvironment variable is defined it searches those path(s) (unless -G, --no-system is\nset).\n\nIf specified, or found through normal searching (not in SAKE_PATH(s)), sake changes the\nprocess' current working directory to the directory of the found Sakefile (unless -C,\n--no-chdir is set), otherwise it stays where it was run from.\n\nSake then invokes the specified TASKNAME, or the \"default\" one.\n\nSakefile can be one of \"Sakefile\", or \"sakefile\", with an optional extension of \".js\",\nor \".coffee\".\n\n~~~\n\n### Dependencies ###\n\nThese are installed when **sake** is installed.\n\n~~~\nnomnom:    =1.5.x\nasync:     =0.1.x\nresolve:   =0.2.x\nproteus:   =0.1.x\nwordwrap:  =0.0.x\nglob:      =3.1.x\nminimatch: =0.2.x\n~~~\n\n\n### Development Dependencies ###\n\nInstalled when you run `npm link` in the package directory.\n\n~~~\nmocha:  =0.3.x\nshould: =0.5.x\nejs:    =0.7.x\n~~~\n\n\nSakefile Usage\n--------------\n\nWithin a `Sakefile`, Saké's methods are exported to the global scope, so you can invoke them directly:\n\n~~~js\ntask(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n~~~\n    \nWithin another node module you can `require(\"sake\")` and access the methods on the exported object, or even run a block of code in the **saké** context (virtual machine):\n\n~~~js\nvar sake = require(\"sake\");\n    \nsake.task(\"taskname\", [\"prereq1\", \"prereq2\"], function (t) {\n    // task action...\n    t.done();\n});\n\n// The function passed to sake#run is compiled and run in the sake context.\n// The function **will not** have access to any variables in this scope,\n// nor, will variables leak from the function's scope into this one.\nsake.run(function () {\n    var jsFiles = new FileList(\"src/js/**/*.js\");\n    \n    require(\"sake/clean\");\n    \n    task(\"script-min.js\", jsFiles, function (t) {\n        var cmd = \"infuse \" + jsFiles.map(function (path) {\n                return \"-i \" + path;\n            }) + \" -E\";\n            \n        sh(cmd, function (err, result) {\n            write(t.name, result, \"utf8\");\n            t.done();\n        })\n    });\n    \n    CLEAN.include(\"script-min.js\");\n});\n~~~\n\nThe remainder of this documentation will assume that we are calling the methods from within a `Sakefile`.\n\n\nDefining Tasks\n--------------\n\nThe various task methods take the following arguments:\n\n1.   `taskname`: `string` &mdash; naming the task\n2.   `prerequisites`: _optional_ \n    *   an `array` of:\n        *   `string` task name, or\n        *   a `FileLists`, or \n        *   a `function` that returns one of the above.\n    *   or, you can also pass a `FileList` in directly for `prerequisites`.\n3.   `action`: an _optional_ `function` that will be called when the task is invoked. It will be passed the task instance as its first argument, followed by any arguments that it was invoked with (either from the command-line, or through code). Task arguments can also be accessed through the instance's `arguments` property. i.e: `t.arguments`.\n\nAll task methods return the task *instance*.\n\nIf a task is already defined, it will be augmented by the additional arguments. So, this:\n\n~~~js\ntask(\"one\", [\"othertask\"], function (t) {\n    // do action one...\n    t.done();\n});\n\ntask(\"one\", function (t) {\n    // do action two...\n    t.done();\n});\n\ntask(\"othertask\");\n~~~\n\nWould result in a task \"othertask\" with no prerequisites, and no action, and a task \"one\" with \"othertask\" as a prerequisite and the two functions as its actions.\n\n**Note** how the dependent task was defined *after* it was required as a prerequisite. Task prerequisites are not resolved until the task is invoked. This leads to flexibility in how to compose your tasks and prerequisite tasks.\n\n\n### Task Instance Properties and Methods ###\n\n*   `name {string}` &mdash; the name of the task.\n*   `namespace {string}` &mdash; the task's namespace.\n*   `type {string}` &mdash; one of \"task\", \"file-task\", or \"file-create-task\"\n*   `fqn {string}` &mdash; the fully qualified name of the task. i.e: \"namespace:name\".\n*   `prerequisites {array}` &mdash; the list of prerequisite names for the task.\n*   `isNeeded {boolean}` &mdash; whether or not this task needs to run.\n*   `timestamp {boolean}` &mdash; the last modification time for the task.\n*   `invoke([args ...]) {Task}` &mdash; invoke the task passing args to each action for the task. Will run any prerequisites first. Returns the task instance.\n*   `execute([args ...]) {Task}` &mdash; Like `invoke`, but run the task even if it has already been run, or is not needed.\n*   `done()` &mdash; signal that the current task's action is done running.\n*   `abort([msg], [exitCode])` &mdash; abort the currently running task's actions, if _exitCode_ is specified **saké** will exit with that exit code and no other tasks will be processed. Otherwise, task processing will continue as normal.\n\n\n### Task Static Properties and Methods ###\n\n*   `namespace {string}` &mdash; the current namespace.\n*   `invoke(name, [rest ...]) {Task}` &mdash; invoke the named task and pass it the rest of the arguments.\n*   `get(name, [namespace]) {Task}` &mdash; get the task _name_, optionally start looking in _namespace_. Will throw an error if it can not find a task.\n*   `lookup(name, [namespace]) {Task|null}` &mdash; lookup a task with _name_, optionally start looking in _namespace_.\n*   `getAll() {array[Task]}` &mdash; return all defined tasks.\n*   `has(name, [namespace]) {boolean}` &mdash; does the task _name_ exist?\n*   `find(args, sortFn) {array[Task]}` &mdash; search for a task. _args_ can be an object with keys specifying which properties to match on, and their values denoting the value to match. _args_ can also be a function that accepts a task and returns a boolean whether or not that task matches.\n\n\nFile Tasks\n----------\n\nFile tasks are created with the (appropriately named) `file` method. File tasks are only triggered if the file doesn't exist, or the modification time of any of its prerequisites is newer than itself.\n\n~~~js\nfile(\"path/to/some/file\", function (t) {\n    cp(\"other/path\", t.name);\n    t.done();\n});\n~~~\n\nThe above task would only be triggered if `path/to/some/file` did not exist.\n\nThe following:\n\n~~~js\nfile(\"combined/file/path\", [\"pathA\", \"pathB\", \"pathC\"], function (t) {\n    write(t.name, cat(t.prerequisites), \"utf8\");\n    t.done();\n});\n~~~\n\nwould be triggered if `path/to/some/file` did not exist, or its modification time was earlier than any of its prerequisites (`pathA`, `pathB`, or  `pathC`).\n\n\nDirectory Tasks\n---------------\n\nDirectory tasks, created with the `directory` method, are tasks that will only be called if they do not exist. A task will be created for the named directory (and for all directories along the way) with the action of creating the directory.\n\nDirectory tasks do not take any `prerequisites` or an `action` when first defined, however, they may be augmented with such after they are created:\n\n~~~js\ndirectory(\"dir/path/to/create\");\n\ntask(\"dir/path/to/create\", [\"othertask\"], action (t) {\n    //... do stuff\n    t.done();\n});\n~~~\n\n\nFile Create Tasks\n-----------------\n\nA file create task is a file task, that when used as a prerequisite, will be needed if, and only if, the file has not been created. Once created, it is not re-triggered if any of its prerequisites are newer, nor does it trigger any rebuilds of tasks that depend on it whenever the file is updated.\n\n~~~js\nfileCreate(\"file/path/to/create.ext\", [\"pathA\", \"pathB\"], function (t) {\n    // create file...\n    t.done();\n});\n~~~\n\n\n(A)Synchronicity and Tasks\n--------------------------\n\nIn **saké** all task actions are assumed to be *asynchronous* and an action must call its task's `done` method to tell **saké** that it is done processing stuff.\n\n~~~js\ntask(\"long task\", function (t) {\n    sh(\"some long running shell command\", function (err, result) {\n        // do stuff...\n        t.done();\n    });\n});\n~~~\n\nAlternatively, you can use the `Sync` version of a task to add a *synchronous* action, and `done` will be called for you after the function completes.\n\n~~~js\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n~~~\n\nThere are `Sync` versions of all the core tasks: `taskSync`, `fileSync`, and `fileCreateSync`. There are also `Async` versions of each task: `taskAsync`, `fileAsync`, and `fileCreateAsync`. The actions created for a `directory` task are *synchronous*. You can add *asynchronous* task actions after the initial definition.\n\nThirdly, you can specify that all of the core task creation functions generate *synchronous* actions by setting **saké's** \"sync\" option to `true`, or by use of the command-line option `-S, --sync`.\n\n~~~js\nsake.options.sync = true;\n\ntaskSync(\"longtask\", function (t) {\n    cp(\"some/dir/file.js\", \"other/dir/file.js\");\n});\n\n//... define more synchronous tasks\n\n//... and then revert to async\nsake.options.sync = false;\n~~~\n\nUltimately, it is up to the **saké** script author to correctly designate a task action as *synchronous* or *asynchronous*. Nothing prevents the running of an *asynchronous* function within a task's *synchronous* action. If nothing is dependent on the result of that action, then no problem would occur. It's when other tasks rely on the completion of certain *asynchronous* actions, that problems may arise.\n\nIn the case of *asynchronous* actions, **Saké** will issue a `WARNING` when it can not detect a `done()` call within that action.\n\n\nNamespaces\n----------\n\n**Saké** supports simple name spacing of tasks. Simply prepend the namespace before the task name with a colon \":\". This can be done when defining a task, or in the list of prerequisites for a task.\n\n~~~js\n// Defines a task 'fuz' in the namespace 'foo' that depends on the task 'buz'\n// in the namespace 'baz'\ntask(\"foo:fuz\", [\"baz:buz\"], function (t) {\n    //...\n    t.done();\n});\n~~~\n\nThen invoke the task as so:\n\n~~~\n% sake foo:fuz\n~~~\n\nYou can also use the convenience function `namespace` to wrap your task definitions for a particular namespace. Any _namespace naked_ definitions will first be tried in the local namespace, otherwise they will fall-back to the default namespace:\n\n~~~js\n\ntask(\"default\", function (t) {\n    //...\n    t.done():\n});\n\ntask(\"bazil\", function (t) {\n    //...\n    t.done():\n});\n\n// define within the 'foo' namespace\nnamespace(\"foo\", function () {\n    \n    // defines 'foo:foom' task\n    task(\"foom\", function (t) {\n        //...\n        t.done():\n    });\n    \n});\n\nnamespace(\"baz\", function () {\n    \n    // this task is defined in the 'baz' namespace, and depends on the\n    // 'foom' task from the 'foo' namespace\n    task(\"bazil\", [\"foo:foom\"], function (t) {\n        //...\n        t.done():\n    });\n    // This task is also defined in the 'baz' namespace. It depends on \n    // the 'bazil' task, which is also defined in 'baz' namespace. It\n    // also depends on the 'default' task in the 'default' (top-level)\n    // namespace.\n    task(\"buzil\", [\"bazil\", \"default\"], function (t), {\n        //...\n        t.done():\n    });\n    // If 'bazil' wasn't defined in the 'baz' namespace, it would resolve\n    // to the 'default' namespace task.\n});\n~~~\n\n**Note:** prerequisite names are tied to the defined task's namespace. i.e: If a task \"foo:fuz\" depends on \"foom\" **saké** will look in the \"foo\" namespace for \"foom\", and then the \"default\" namespace.\n\n**Note:** although the `namespace` functions can be nested, **saké** does not track the hierarchy of `namespace` calls -- if a dependent task is not found in the current task's namespace, it will look for it in the default namespace.\n\n\nPassing Arguments to A Task\n---------------------------\n\nThere are two ways to pass arguments to a task.\n\nFirst, **saké** translates any arguments in the form of `ENV=VALUE` on the command-line into `process.env` values:\n\n~~~\n% sake build BUILD_TYPE=debug ENVIRONMENT=prod\n~~~\n\nWill set `process.env.BUILD_TYPE` to \"debug\" and `process.env.ENVIRONMENT` to \"prod\". The values are JSON parsed; so the values are translated into real JavaScript values (numbers, true, false, etc...).\n\nSecondly, **saké** passes all non-option, and non-ENV=VALUE, looking arguments from the command-line to the invoked task:\n\n~~~\n% sake foo 3.14 pie true\n~~~\n\nWill invoke the \"foo\" task and pass to each of foo's actions (after the task instance itself) `3.14`, \"pie\" and `true`. The arguments are also JSON parsed to get real JavaScript values.\n\n~~~js\ntask(\"foo\", function (t, amt, word, flag) {\n    log(amt);   // => 3.14\n    log(word);  // => \"pie\"\n    log(flag);  // => true\n});\n~~~\n\n**Note:** This differs from how **rake**, and **jake** do things. In **saké** you can only invoke one task on the command-line. All other arguments on the command-line are considered task arguments.\n\n\nIncluding Other Saké Files\n-------------------------------------\n\nYou can include other **saké** files with the `include` and `load` methods. The included files will be run in the **saké** context, so any variables declared will be set on the global **saké** context. This allows you to break your project build files up into discreet files. Just be aware of naming collisions.\n\nAll `require` and `include`, or `load` statements, are resolved relative to the current file, so you can create your own hierarchy of build dependencies.\n\nYou can also add your own paths to the list of ones that **saké** uses to resolve `requires`: `[sake.]includePaths` is an array of directory paths to search. They are tried in reverse order, so if you push a path on to the array that path will be tried first, followed by any others.\n\n~~~js\n// in a Sakefile\nincludePaths.push(\"some/path\");\n\nrequire(\"some-module\"); // will be tried in some/path/some-module.js\n~~~\n\nAlso, the `__dirname` and `__filename` properties are available in `included` files to help resolve local includes.\n\n~~~js\nvar Path = require(\"path\");\n\ninclude(Path.join(__dirname, \"include-dir/include-file\"));\n~~~\n\nSake Library\n------------\n\n**Saké** will load any `.sake`, `.sake.js`, or `.sake.coffee` files located in a `sakelib` directory relative to the `Sakefile` being run. This directory name can be modified with the `-l, --sakelib` option, and multiple directories can be specified. This allows you to re-use common tasks across multiple projects.\n\n\nFile Lists\n----------\n\nFileLists are lists of file paths.\n\n~~~js\nnew FileList(\"*.scss\");\n~~~\n\nWould contain all the file paths with a \".scss\" extension in the top-level directory of your project.\n\nYou can use FileLists pretty much like an `Array`. You can iterate them (with `forEach, filter, reduce`, etc...), `concat` them, `splice` them, and you get back a new FileList object.\n\nTo add files, or glob patterns to them, use the `#include` method:\n\n~~~js\nvar fl = new FileList(\"*.scss\");\nfl.include(\"core.css\", \"reset.css\", \"*.css\");\n~~~\n\nYou can also `exlucude` files by Glob pattern, `Regular Expression` pattern, or by use of a `function` that takes the file path as an argument and returns a `truthy` value to exclude a file.\n\n~~~js\n// Exclude by RegExp\nfl.exclude(/^dev-.*\\.css/);\n\n// Exclude by Glob pattern\nfl.exclude(\"dev-*.css\");\n\n// Exclude by function\nfl.exclude(function (path) {\n    return FS.statSync(path).mtime.getTime() < (Date.now() - 60 * 60 * 1000);\n});\n~~~\n\nTo get to the actual items of the FileList, use the `#items` property, or the `#toArray` method, to get a plain array back. You can also use the `#get` or `#set` methods to retrieve or set an item.\n\nFileLists are *lazy*, in that the actual file paths are not determined from the include and exclude patterns until the individual items are requested. This allows you to define a FileList and incrementally add patterns to it in the Sakefile file. The FileList paths will not be resolved until the task that uses it as a prerequisite actually asks for the final paths.\n\n\n### FileList Properties & Methods ###\n\n*   `existing` &mdash; will return a new `FileList` with all of the files that actually exist.\n*   `notExisting` &mdash; will return a new `FileList` of all the files that do not exist.\n*   `extension(ext)` &mdash; returns a new `FileList` with all paths that match the given extension.\n\n~~~js\nfl.extension(\".scss\").forEach(function (path) {\n    //...\n});\n~~~\n\n*   `grep(pattern)` &mdash; get a `FileList` of all the files that match the given `pattern`. `pattern` can be a plain `String`, a `Glob` pattern, a `RegExp`, or a `function` that receives each path and can return a truthy value to include it.\n*   `clearExcludes()` &mdash; clear all exclude patterns/functions.\n*   `clearIncludes()` &mdash; clear all include patterns.\n\nBy default, a `FileList` excludes directories. To allow directories call `FileList#clearExcludes()` before requesting any items.\n\n\nThe \"clean\" and \"clobber\" Tasks, and The CLEAN and CLOBBER FileLists\n--------------------------------------------------------------------\n\nWithin a `Sakefile`:\n\n~~~js\n// defines the CLEAN FileList and 'clean' task\nrequire(\"sake/clean\");\nCLEAN.include(\"**/*.js\");\n\n// defines the above, and also the CLOBBER FileTask and 'clobber' task\nrequire(\"sake/clobber\");\nCLOBBER.include(\"**/*.js\");\n~~~\n\nWhen the \"clean\" task is run, it will remove any files that have been included in the `CLEAN FileList`. \"clobber\" will remove any file, or directory, included in the `CLOBBER FileList`.\n\n\nSaké Utility Functions\n----------------------\n\nSaké defines a few utility functions to make life a little easier in an asynchronous world. Most of these are just wrappers for `node`'s File System (`require(\"fs\")`) utility methods.\n\n### Synchronous Utilities ###\n\n*   `mkdir(dirpath, mode=\"777\")` &mdash; create the `dirpath` directory, if it doesn't already exist.\n*   `mkdir_p(dirpath, mode=\"777\"])` &mdash; as above, but create all intermediate directories as needed.\n*   `rm(path, [path1, ..., pathN])` &mdash; remove one or more paths from the file system.\n*   `rm_rf(path, [path1, ..., pathN])` &mdash; as above, and remove directories and their contents.\n*   `cp(from, to)` &mdash; copy a file from `from` path to `to` path.\n*   `cp_r(from, to)` &mdash; copy all files from `from` path to `to` path.\n*   `mv(from, to)` &mdash; move a file from `from` path to `to` path.\n*   `ln(from, to)` &mdash; create a hard link from `from` path to `to` path.\n*   `ln_s(from, to)` &mdash; create a symlink from `from` path to `to` path.\n*   `cat(path, [path1, ..., pathN]) {string}` &mdash; read all supplied paths and return their contents as a string. If an argument is an `Array` it will be expanded and those paths will be read.\n*   `readdir(path) {array[string]}` &mdash; returns the files of directory `path`.\n*   `read(path, [enc]) {string|Buffer}` &mdash; read the supplied file path. Returns a `buffer`, or a `string` if `enc` is given.\n*   `write(path, data, [enc], mode=\"w\")` &mdash; write the `data` to the supplied file `path`. `data` should be a `buffer` or a `string` if `enc` is given. `mode` is a `string` of either \"w\", for over write,  or \"a\" for append.\n*   `slurp(path, [env]) {sring|Buffer}` &mdash; alias for `read`\n*   `spit(path, data, [enc], mode=\"w\")` &mdash; alias for `write`\n\n\n### Asynchronous Utilities ###\n\n*   `sh(cmd, fn(error, result))` &mdash; execute shell `cmd`. In the callback function, `error` will be a truthy value if there was an error, and `result` will contain the STDERR returned from `cmd`. Otherwise, `result` will contain the STDOUT from the `cmd`. If `cmd` is an array of shell commands, each one will be run before the next, and only when they all complete, or an error is encountered, will the callback `fn` be called, and `result` be an array of the results of the individual commands.\n\n\nDeveloper Notes\n---------------\n\n*   Due to an issue with npm v1.1.13 and up (see issue [#2490](https://github.com/isaacs/npm/issues/2490)), I had to move my code into the `node_modules/sake` directory and add a `bundleDependencies` array to the `package.json` file.\n\nReport an Issue\n---------------\n\n* [Bugs](http://github.com/jhamlet/node-sake/issues)\n* Contact the author: <jhamlet@hamletink.com>\n\n\nLicense\n-------\n\n> Copyright (c) 2012 Jerry Hamlet <jerry@hamletink.com>\n> \n> Permission is hereby granted, free of charge, to any person\n> obtaining a copy of this software and associated documentation\n> files (the \"Software\"), to deal in the Software without\n> restriction, including without limitation the rights to use,\n> copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the\n> Software is furnished to do so, subject to the following\n> conditions:\n> \n> The above copyright notice and this permission notice shall be\n> included in all copies or substantial portions of the Software.\n> \n> The Software shall be used for Good, not Evil.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n> OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n> HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n> WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n> FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n> OTHER DEALINGS IN THE SOFTWARE.\n\n","readmeFilename":"README.md","_id":"sake@0.1.32","dist":{"shasum":"a34c21edf227aacd0b7260261ef236b41b31c67e","tarball":"https://registry.npmjs.org/sake/-/sake-0.1.32.tgz","integrity":"sha512-af6S/5upKmTv3U0sm7ZWDn8NAHh5xHOzO62HqAdeT26DLTFw7jo1GGPqRil2FLBdtPzpZEDUV5Eo/XZBF3r2Ew==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFM/jDPQS55TboyEQVPr1IAkXnw6Gm2Dizq0hFsOCqXXAiAPg+Qe8w3feXFWHv/zz7byu3wAE97oZdz0d8ugYNvxRA=="}]},"_from":".","_npmVersion":"1.2.15","_npmUser":{"name":"jhamlet","email":"jerry@hamletink.com"},"maintainers":[{"name":"jhamlet","email":"jerry@hamletink.com"}]}},"readme":null,"maintainers":[{"name":"jhamlet","email":"jerry@hamletink.com"}],"time":{"modified":"2022-06-26T15:38:19.376Z","created":"2011-12-10T00:44:26.444Z","0.0.1":"2011-12-10T00:44:28.050Z","0.0.2":"2012-04-13T14:59:04.814Z","0.0.3":"2012-04-16T15:57:32.246Z","0.0.4":"2012-04-21T23:35:52.610Z","0.1.0":"2012-05-03T17:18:40.819Z","0.1.1":"2012-05-05T17:37:39.957Z","0.1.2":"2012-05-05T23:46:14.862Z","0.1.3":"2012-05-06T01:29:03.113Z","0.1.4":"2012-05-06T05:50:01.371Z","0.1.5":"2012-05-07T04:16:51.850Z","0.1.6":"2012-05-07T07:15:09.453Z","0.1.7":"2012-05-07T19:56:24.786Z","0.1.8":"2012-05-08T00:04:07.275Z","0.1.9":"2012-05-08T04:33:53.851Z","0.1.10":"2012-05-08T13:19:46.051Z","0.1.11":"2012-05-08T13:41:34.755Z","0.1.12":"2012-05-08T17:34:15.306Z","0.1.13":"2012-05-09T03:26:30.334Z","0.1.14":"2012-05-10T01:13:07.767Z","0.1.16":"2012-05-23T20:48:28.084Z","0.1.17":"2012-05-29T22:09:38.603Z","0.1.18":"2012-06-01T22:07:24.842Z","0.1.19":"2012-06-08T17:11:25.452Z","0.1.20":"2012-06-13T20:24:41.045Z","0.1.21":"2012-06-19T19:51:36.016Z","0.1.22":"2012-06-25T22:58:00.021Z","0.1.23":"2012-07-02T23:55:43.361Z","0.1.24":"2012-07-27T21:00:36.471Z","0.1.25":"2012-09-25T16:50:05.422Z","0.1.26":"2012-12-03T20:38:25.681Z","0.1.27":"2012-12-03T20:48:52.999Z","0.1.28":"2012-12-03T21:50:56.452Z","0.1.29":"2012-12-04T00:14:24.492Z","0.1.30":"2012-12-06T18:38:03.379Z","0.1.31":"2013-02-28T23:27:13.129Z","0.1.32":"2013-03-25T23:08:39.744Z"},"repository":{"type":"git","url":"http://github.com/jhamlet/node-sake.git"},"users":{"fgribreau":true,"marshallbu":true}}