Skip to content

Commit f0866cc

Browse files
committed
Scaffold: Normalize project
1 parent 52c3cad commit f0866cc

File tree

4 files changed

+81
-50
lines changed

4 files changed

+81
-50
lines changed

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
test/fixtures/out
2+
test/fixtures/tmp

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2014 Blaine Bublitz
3+
Copyright (c) 2014 Blaine Bublitz, Eric Schoffstall and other contributors
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+76-47
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
undertaker
2-
==========
1+
<p align="center">
2+
<a href="http://gulpjs.com">
3+
<img height="257" width="114" src="https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png">
4+
</a>
5+
</p>
36

4-
[![Build Status](https://travis-ci.org/gulpjs/undertaker.svg?branch=master)](https://travis-ci.org/gulpjs/undertaker)
7+
# undertaker
8+
9+
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![AppVeyor Build Status][appveyor-image]][appveyor-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url]
510

611
Task registry that allows composition through `series`/`parallel` methods.
712

@@ -40,20 +45,19 @@ taker.task('all', taker.parallel('combined', 'task3'));
4045
## API
4146

4247
__Task functions can be completed in any of the ways supported by
43-
[`async-done`](https://github.com/phated/async-done#completion-and-error-resolution)__
48+
[`async-done`][async-resolution]__
4449

45-
### `new Undertaker([RegistryConstructor])`
50+
### `new Undertaker([registryInstance])`
4651

4752
The constructor is used to create a new instance of `Undertaker`. Each instance of
4853
`Undertaker` gets its own instance of a registry. By default, the registry is an
49-
instance of [`undertaker-registry`](https://github.com/gulpjs/undertaker-registry)
50-
but it can be any other registry that follows the [Custom Registries API](#custom-registries).
54+
instance of [`undertaker-registry`][undertaker-registry]
55+
but it can be an instance of any other registry that follows the [Custom Registries API][custom-registries].
5156

52-
To use a custom registry, pass the custom registry's constructor function when
53-
instantiating a new `Undertaker` instance. This will use the custom constructor
54-
to create the registry for this instance.
57+
To use a custom registry, pass a custom registry instance (`new CustomRegistry([options])`) when
58+
instantiating a new `Undertaker` instance. This will use the custom registry instance for that `Undertaker` instance.
5559

56-
### `task([taskName,] fn)` => [Function]
60+
### `task([taskName,] fn)`
5761

5862
Both a `getter` and `setter` for tasks.
5963

@@ -65,16 +69,13 @@ If a function (`fn`) and optionally a string (`taskName`) is given, it behaves a
6569
a `setter` and will register the task by the `taskName`. If `taskName` is not
6670
specified, the `name` or `displayName` property of the function is used as the `taskName`.
6771

68-
__Note: If you attempt to register the same function with different names, it will
69-
only be registered by the last name attempted.__
70-
7172
Will throw if:
7273

73-
* `taskName` is missing or not a string when behaving as a `getter` or
74-
is missing and function is anonymous when behaving as a `setter`.
75-
* `fn` is missing or not a function when behaving as a `setter`.
74+
* As a `getter`: `taskName` is missing or not a string.
75+
* As a `setter`: `taskName` is missing and `fn` is anonymous.
76+
* As a `setter`: `fn` is missing or not a function.
7677

77-
### `series(taskName || fn...)` => Function
78+
### `series(taskName || fn...)`
7879

7980
Takes a variable amount of strings (`taskName`) and/or functions (`fn`) and
8081
returns a function of the composed tasks or functions. Any `taskNames` are
@@ -84,7 +85,7 @@ When the returned function is executed, the tasks or functions will be executed
8485
in series, each waiting for the prior to finish. If an error occurs, execution
8586
will stop.
8687

87-
### `parallel(taskName || fn...)` => Function
88+
### `parallel(taskName || fn...)`
8889

8990
Takes a variable amount of strings (`taskName`) and/or functions (`fn`) and
9091
returns a function of the composed tasks or functions. Any `taskNames` are
@@ -102,21 +103,26 @@ the tasks from the current registry will be transferred to it and the current re
102103
will be replaced with the new registry.
103104

104105
The ability to assign new registries will allow you to pre-define/share tasks or add
105-
custom functionality to your registries. See [Custom Registries](#custom-registries)
106+
custom functionality to your registries. See [Custom Registries][custom-registries]
106107
for more information.
107108

108-
### `tree([options])` => Object
109+
### `tree([options])`
109110

110-
Optionally takes an object (`options`) and returns an object representing the
111-
tree of registered tasks. The object returned is [`archy`](https://www.npmjs.org/package/archy)
112-
compatible when assigned to the `nodes` key. Also, each node has a `type`
113-
property that can be used to determine if the node is a `task` or `function`.
111+
Optionally takes an `options` object and returns an object representing the
112+
tree of registered tasks. The object returned is [`archy`][archy]
113+
compatible. Also, each node has a `type` property that can be used to determine if the node is a `task` or `function`.
114114

115115
#### `options`
116116

117-
* `deep` - if the whole tree should be returned (Default: `false`)
117+
##### `options.deep`
118+
119+
Whether or not the whole tree should be returned.
118120

119-
### `lastRun(task, [timeResolution])` => [Timestamp]
121+
Type: `Boolean`
122+
123+
Default: `false`
124+
125+
### `lastRun(task, [timeResolution])`
120126

121127
Takes a string or function (`task`) and returns a timestamp of the last time the task
122128
was run successfully. The time will be the time the task started.
@@ -127,20 +133,16 @@ If a task errors, the result of `lastRun` will be undefined because the task
127133
should probably be re-run from scratch to get into a good state again.
128134

129135
The timestamp is always given in millisecond but the time resolution can be
130-
reduced (rounded down). The use case is to be able to compare a build time
136+
rounded using the `timeResolution` parameter. The use case is to be able to compare a build time
131137
to a file time attribute. On node v0.10 or with file system like HFS or FAT,
132138
`fs.stat` time attributes like `mtime` precision is one second.
133139

134140
Assuming `undertakerInst.lastRun('someTask')` returns `1426000001111`,
135141
`undertakerInst.lastRun('someTask', 1000)` returns `1426000001000`.
136142

137-
The default time resolution is `1000` on node v0.10, `0` on node 0.11+ and iojs.
143+
The default time resolution is `1000` on node v0.10, `0` on node 0.11+ but
138144
it can be overwritten using `UNDERTAKER_TIME_RESOLUTION` environment variable.
139145

140-
__Note: if you use a custom registry that modifies the function (such as `.bind`),
141-
you will need to use the string for `task` instead of a function because we have no
142-
way of looking up the function that was altered.__
143-
144146
## Custom Registries
145147

146148
Custom registries are constructor functions allowing you to pre-define/share tasks
@@ -157,10 +159,9 @@ A registry's prototype should define:
157159
You should not call these functions yourself; leave that to Undertaker, so it can
158160
keep its metadata consistent.
159161

160-
The easiest way to create a custom registry is to inherit from
161-
[undertaker-registry](https://www.npmjs.com/package/undertaker-registry):
162+
The easiest way to create a custom registry is to inherit from [undertaker-registry]:
162163

163-
```javascript
164+
```js
164165
var util = require('util');
165166

166167
var DefaultRegistry = require('undertaker-registry');
@@ -177,12 +178,12 @@ module.exports = MyRegistry;
177178
### Sharing tasks
178179

179180
To share common tasks with all your projects, you can expose an `init` method on the registry
180-
prototype and it will receive the Undertaker instance as the only argument. You can then use
181+
prototype and it will receive the `Undertaker` instance as the only argument. You can then use
181182
`undertaker.task(name, fn)` to register pre-defined tasks.
182183

183184
For example you might want to share a `clean` task:
184185

185-
```javascript
186+
```js
186187
var fs = require('fs');
187188
var util = require('util');
188189

@@ -216,7 +217,7 @@ module.exports = CommonRegistry;
216217
```
217218

218219
Then to use it in a project:
219-
```javascript
220+
```js
220221
var Undertaker = require('undertaker');
221222
var CommonRegistry = require('myorg-common-tasks');
222223

@@ -236,7 +237,7 @@ For example if you wanted all tasks to share some data, you can use a custom re
236237
to bind them to that data. Be sure to return the altered task, as per the description
237238
of registry methods above:
238239

239-
```javascript
240+
```js
240241
var util = require('util');
241242

242243
var Undertaker = require('undertaker');
@@ -281,14 +282,42 @@ taker.task('default', taker.series('clean', 'build', 'serve', function(cb) {
281282

282283
### In the wild
283284

284-
* [undertaker-registry](https://github.com/gulpjs/undertaker-registry) - Custom registries probably want to inherit from this.
285-
* [undertaker-forward-reference](https://github.com/gulpjs/undertaker-forward-reference) - Custom registry supporting forward referenced tasks (similar to gulp 3.x).
286-
* [undertaker-task-metadata](https://github.com/gulpjs/undertaker-task-metadata) - Proof-of-concept custom registry that attaches metadata to each task.
287-
* [undertaker-common-tasks](https://github.com/gulpjs/undertaker-common-tasks) - Proof-of-concept custom registry that pre-defines some tasks.
288-
* [alchemist-gulp](https://github.com/webdesserts/alchemist-gulp) - A default set of tasks for building alchemist plugins.
289-
* [gulp-hub](https://github.com/frankwallis/gulp-hub/tree/registry-init) - Custom registry to run tasks in multiple gulpfiles. (In a branch as of this writing)
290-
* [gulp-pipeline](https://github.com/alienfast/gulp-pipeline) - [RailsRegistry](https://github.com/alienfast/gulp-pipeline/blob/master/src/registry/railsRegistry.js) is an ES2015 class that provides a gulp pipeline replacement for rails applications
285+
* [undertaker-registry] - Custom registries probably want to inherit from this.
286+
* [undertaker-forward-reference] - Custom registry supporting forward referenced tasks (similar to gulp 3.x).
287+
* [undertaker-task-metadata] - Proof-of-concept custom registry that attaches metadata to each task.
288+
* [undertaker-common-tasks] - Proof-of-concept custom registry that pre-defines some tasks.
289+
* [alchemist-gulp] - A default set of tasks for building alchemist plugins.
290+
* [gulp-hub] - Custom registry to run tasks in multiple gulpfiles. (In a branch as of this writing)
291+
* [gulp-pipeline] - [RailsRegistry][rails-registry] is an ES2015 class that provides a gulp pipeline replacement for rails applications
291292

292293
## License
293294

294295
MIT
296+
297+
[custom-registries]: #custom-registries
298+
[async-resolution]: https://github.com/phated/async-done#completion-and-error-resolution
299+
[archy]: https://www.npmjs.org/package/archy
300+
[undertaker-registry]: https://github.com/gulpjs/undertaker-registry
301+
[undertaker-forward-reference]: https://github.com/gulpjs/undertaker-forward-reference
302+
[undertaker-task-metadata]: https://github.com/gulpjs/undertaker-task-metadata
303+
[undertaker-common-tasks]: https://github.com/gulpjs/undertaker-common-tasks
304+
[alchemist-gulp]: https://github.com/webdesserts/alchemist-gulp
305+
[gulp-hub]: https://github.com/frankwallis/gulp-hub/tree/registry-init
306+
[gulp-pipeline]: https://github.com/alienfast/gulp-pipeline
307+
[rails-registry]: https://github.com/alienfast/gulp-pipeline/blob/master/src/registry/railsRegistry.js
308+
309+
[downloads-image]: http://img.shields.io/npm/dm/undertaker.svg
310+
[npm-url]: https://www.npmjs.com/package/undertaker
311+
[npm-image]: http://img.shields.io/npm/v/undertaker.svg
312+
313+
[travis-url]: https://travis-ci.org/gulpjs/undertaker
314+
[travis-image]: http://img.shields.io/travis/gulpjs/undertaker.svg?label=travis-ci
315+
316+
[appveyor-url]: https://ci.appveyor.com/project/gulpjs/undertaker
317+
[appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/undertaker.svg?label=appveyor
318+
319+
[coveralls-url]: https://coveralls.io/r/gulpjs/undertaker
320+
[coveralls-image]: http://img.shields.io/coveralls/gulpjs/undertaker/master.svg
321+
322+
[gitter-url]: https://gitter.im/gulpjs/gulp
323+
[gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
"name": "undertaker",
33
"version": "0.15.0",
44
"description": "Task registry that allows composition through series/parallel methods.",
5-
"author": "Blaine Bublitz <blaine@iceddev.com> (http://iceddev.com/)",
5+
"author": "Gulp Team <team@gulpjs.com> (http://gulpjs.com/)",
66
"contributors": [
7+
"Blaine Bublitz <[email protected]>",
78
"Damien Lebrun <[email protected]>"
89
],
9-
"repository": "phated/undertaker",
10+
"repository": "gulpjs/undertaker",
1011
"license": "MIT",
1112
"engines": {
1213
"node": ">= 0.10"

0 commit comments

Comments
 (0)