Skip to content

Commit

Permalink
Implemented and documented command line interface
Browse files Browse the repository at this point in the history
  • Loading branch information
josdejong committed Jul 13, 2013
1 parent e5e1e6c commit 8839fc1
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 6 deletions.
37 changes: 31 additions & 6 deletions README.md
Expand Up @@ -133,12 +133,7 @@ Save the contents to a file.
###clear()
Reset/clear contents.


### task()
Create a task. Buildify supports modularizing a build script in different tasks,
and define dependencies between tasks.
By specifying tasks names as command line arguments, buildify will only run
the specified tasks and their dependencies.
## Tasks

For example create a script named `buildify.js` with the following contents:
```js
Expand Down Expand Up @@ -170,6 +165,36 @@ To run a specific task, specify the task name as command line arguments.
node buildify.js concat
```

### Tasks API

#### buildify.task(options)
Create a task. Buildify supports modularizing a build script in different tasks,
and define dependencies between tasks.
By specifying tasks names as command line arguments, buildify will only run
the specified tasks and their dependencies.

Options:
- `name` A string containing the task name
- `desc` An optional description of the task
- `depends` An optional string or an array with strings containing the name(s)
of tasks which this task depends on.
- `task`: The function to be executed as task, doing the actual work.
Optional.


## Command Line Interface

When installed globally, the command line application `buildify` is available.
Running `buildify` will execute the script named `buildify.js` in the current
directory (typically the root of a project).

```sh
buildify [tasks]
```

Optionally, a list of task names can be provided to only execute specified tasks.
If no tasks are provided, buildify will run the script including all tasks.


##Changelog

Expand Down
19 changes: 19 additions & 0 deletions bin/cli.js
@@ -0,0 +1,19 @@
#!/usr/bin/env node
/**
* Buildify
*
* Builder for creating distributable JavaScript files from source.
* Concatenate, wrap, uglify.
*
* Usage:
* buildify [tasks]
*
* The application will execute the script named `buildify.js` in the current
* directory.
*
* The option tasks is an optional list with task names to be executed.
* If no tasks are provided, buildify will run the script including all tasks.
*/

// read build script from current directory
require(process.cwd() + '/buildify.js');
3 changes: 3 additions & 0 deletions package.json
Expand Up @@ -8,6 +8,9 @@
"url": "git://github.com/powmedia/buildify.git"
},
"main": "index.js",
"bin": {
"buildify": "./bin/cli.js"
},
"dependencies": {
"mkdirp": "0.3.2",
"uglify-js": "1.3.4",
Expand Down

0 comments on commit 8839fc1

Please sign in to comment.