node-gulp-4.0.2+~cs38.20.35/000077500000000000000000000000001415667007300150405ustar00rootroot00000000000000node-gulp-4.0.2+~cs38.20.35/.editorconfig000066400000000000000000000003261415667007300175160ustar00rootroot00000000000000# http://editorconfig.org root = true [*] indent_style = space indent_size = 2 charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true end_of_line = lf [*.md] trim_trailing_whitespace = false node-gulp-4.0.2+~cs38.20.35/.eslintrc000066400000000000000000000000301415667007300166550ustar00rootroot00000000000000{ "extends": "gulp" } node-gulp-4.0.2+~cs38.20.35/.gitattributes000066400000000000000000000000161415667007300177300ustar00rootroot00000000000000* text eol=lf node-gulp-4.0.2+~cs38.20.35/.jscsrc000066400000000000000000000000271415667007300163270ustar00rootroot00000000000000{ "preset": "gulp" } node-gulp-4.0.2+~cs38.20.35/.travis.yml000066400000000000000000000002011415667007300171420ustar00rootroot00000000000000sudo: false language: node_js node_js: - '8' - '6' - '5' - '4' - '0.12' - '0.10' after_script: - npm run coveralls node-gulp-4.0.2+~cs38.20.35/LICENSE000066400000000000000000000022221415667007300160430ustar00rootroot00000000000000The MIT License (MIT) Copyright (c) 2015, 2017 Blaine Bublitz , Eric Schoffstall and other contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. node-gulp-4.0.2+~cs38.20.35/README.md000066400000000000000000000145221415667007300163230ustar00rootroot00000000000000

# undertaker-registry [![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] Default registry in gulp 4. ## Usage ```js var gulp = require('gulp'); var UndertakerRegistry = require('undertaker-registry'); var registry = new UndertakerRegistry(); gulp.registry(registry); ``` ## API ### new UndertakerRegistry([options]) Constructor for the default registry. Inherit from this constructor to build custom registries. ### init(taker) No-op method that receives the undertaker instance. Useful to set pre-defined tasks using the `undertaker.task(taskName, fn)` method. Custom registries can override this method when inheriting from this default registry. ### get(taskName) => Function Returns the task with that name or undefined if no task is registered with that name. Useful for custom task storage. Custom registries can override this method when inheriting from this default registry. ### set(taskName, fn) => [Function] Adds a task to the registry. If `set` modifies a task, it should return the new task so Undertaker can properly maintain metadata for the task. Useful for adding custom behavior to every task as it is registered in the system. Custom registries can override this method when inheriting from this default registry. ### tasks() => Object Returns an object listing all tasks in the registry. Necessary to override if the `get` method is overridden for custom task storage. Custom registries can override this when when inheriting from this default registry. ## Custom Registries Custom registries are constructor functions allowing you to pre-define/share tasks or add custom functionality to your registries. A registry's prototype should define: - `init(taker)`: receives the undertaker instance to set pre-defined tasks using the `task(taskName, fn)` method. - `get(taskName)`: returns the task with that name or `undefined` if no task is registered with that name. - `set(taskName, fn)`: add task to the registry. If `set` modifies a task, it should return the new task. - `tasks()`: returns an object listing all tasks in the registry. You should not call these functions yourself; leave that to Undertaker, so it can keep its metadata consistent. The easiest way to create a custom registry is to inherit from [undertaker-registry](https://www.npmjs.com/package/undertaker-registry): ```javascript var util = require('util'); var DefaultRegistry = require('undertaker-registry'); function MyRegistry(){ DefaultRegistry.call(this); } util.inherits(MyRegistry, DefaultRegistry); module.exports = MyRegistry; ``` ### Sharing tasks To share common tasks with all your projects, you can expose an `init` method on the registry prototype and it will receive the Undertaker instance as the only argument. You can then use `undertaker.task(name, fn)` to register pre-defined tasks. For example you might want to share a `clean` task: ```javascript var fs = require('fs'); var util = require('util'); var DefaultRegistry = require('undertaker-registry'); var del = require('del'); function CommonRegistry(opts){ DefaultRegistry.call(this); opts = opts || {}; this.buildDir = opts.buildDir || './build'; } util.inherits(CommonRegistry, DefaultRegistry); CommonRegistry.prototype.init = function(takerInst){ var buildDir = this.buildDir; var exists = fs.existsSync(buildDir); if(exists){ throw new Error('Cannot initialize common tasks. ' + buildDir + ' directory exists.'); } takerInst.task('clean', function(){ return del([buildDir]); }); } module.exports = CommonRegistry; ``` Then to use it in a project: ```javascript var Undertaker = require('undertaker'); var CommonRegistry = require('myorg-common-tasks'); var taker = new Undertaker(CommonRegistry({ buildDir: '/dist' })); taker.task('build', taker.series('clean', function build(cb) { // do things cb(); })); ``` ### Sharing Functionalities By controlling how tasks are added to the registry, you can decorate them. For example if you wanted all tasks to share some data, you can use a custom registry to bind them to that data. Be sure to return the altered task, as per the description of registry methods above: ```javascript var util = require('util'); var Undertaker = require('undertaker'); var DefaultRegistry = require('undertaker-registry'); // Some task defined somewhere else var BuildRegistry = require('./build.js'); var ServeRegistry = require('./serve.js'); function ConfigRegistry(config){ DefaultRegistry.call(this); this.config = config; } util.inherits(ConfigRegistry, DefaultRegistry); ConfigRegistry.prototype.set = function set(name, fn) { // The `DefaultRegistry` uses `this._tasks` for storage. var task = this._tasks[name] = fn.bind(this.config); return task; }; var taker = new Undertaker(); taker.registry(new BuildRegistry()); taker.registry(new ServeRegistry()); // `taker.registry` will reset each task in the registry with // `ConfigRegistry.prototype.set` which will bind them to the config object. taker.registry(new ConfigRegistry({ src: './src', build: './build', bindTo: '0.0.0.0:8888' })); taker.task('default', taker.series('clean', 'build', 'serve', function(cb) { console.log('Server bind to ' + this.bindTo); console.log('Serving' + this.build); cb(); })); ``` ## License MIT [downloads-image]: http://img.shields.io/npm/dm/undertaker-registry.svg [npm-url]: https://npmjs.org/package/undertaker-registry [npm-image]: http://img.shields.io/npm/v/undertaker-registry.svg [travis-url]: https://travis-ci.org/gulpjs/undertaker-registry [travis-image]: http://img.shields.io/travis/gulpjs/undertaker-registry.svg [appveyor-url]: https://ci.appveyor.com/project/gulpjs/undertaker-registry [appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/undertaker-registry.svg?label=appveyor [coveralls-url]: https://coveralls.io/r/gulpjs/undertaker-registry [coveralls-image]: http://img.shields.io/coveralls/gulpjs/undertaker-registry/master.svg [gitter-url]: https://gitter.im/gulpjs/gulp [gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg node-gulp-4.0.2+~cs38.20.35/appveyor.yml000066400000000000000000000007531415667007300174350ustar00rootroot00000000000000# http://www.appveyor.com/docs/appveyor-yml # http://www.appveyor.com/docs/lang/nodejs-iojs environment: matrix: # node.js - nodejs_version: "0.10" - nodejs_version: "0.12" - nodejs_version: "4" - nodejs_version: "5" - nodejs_version: "6" - nodejs_version: "8" install: - ps: Install-Product node $env:nodejs_version - npm install test_script: - node --version - npm --version - cmd: npm test build: off # build version format version: "{build}" node-gulp-4.0.2+~cs38.20.35/index.js000066400000000000000000000011711415667007300165050ustar00rootroot00000000000000'use strict'; function DefaultRegistry() { if (this instanceof DefaultRegistry === false) { return new DefaultRegistry(); } this._tasks = {}; } DefaultRegistry.prototype.init = function init(taker) {}; DefaultRegistry.prototype.get = function get(name) { return this._tasks[name]; }; DefaultRegistry.prototype.set = function set(name, fn) { return this._tasks[name] = fn; }; DefaultRegistry.prototype.tasks = function tasks() { var self = this; return Object.keys(this._tasks).reduce(function(tasks, name) { tasks[name] = self.get(name); return tasks; }, {}); }; module.exports = DefaultRegistry; node-gulp-4.0.2+~cs38.20.35/package.json000066400000000000000000000017441415667007300173340ustar00rootroot00000000000000{ "name": "undertaker-registry", "version": "1.0.1", "description": "Default registry in gulp 4.", "author": "Gulp Team (http://gulpjs.com/)", "contributors": [ "Blaine Bublitz " ], "repository": "gulpjs/undertaker-registry", "license": "MIT", "engines": { "node": ">= 0.10" }, "main": "index.js", "files": [ "LICENSE", "index.js" ], "scripts": { "lint": "eslint . && jscs index.js test/", "pretest": "npm run lint", "test": "mocha --async-only", "cover": "istanbul cover _mocha --report lcovonly", "coveralls": "npm run cover && istanbul-coveralls" }, "devDependencies": { "eslint": "^1.7.3", "eslint-config-gulp": "^2.0.0", "expect": "^1.19.0", "istanbul": "^0.4.3", "istanbul-coveralls": "^1.0.3", "jscs": "^2.3.5", "jscs-preset-gulp": "^1.0.0", "mocha": "^3.5.0" }, "keywords": [ "registry", "tasks", "undertaker", "gulp" ] } node-gulp-4.0.2+~cs38.20.35/test/000077500000000000000000000000001415667007300160175ustar00rootroot00000000000000node-gulp-4.0.2+~cs38.20.35/test/.eslintrc000066400000000000000000000000351415667007300176410ustar00rootroot00000000000000{ "extends": "gulp/test" } node-gulp-4.0.2+~cs38.20.35/test/index.js000066400000000000000000000033421415667007300174660ustar00rootroot00000000000000'use strict'; var expect = require('expect'); var Registry = require('../'); function noop() {} describe('undertaker-registry', function() { describe('constructor', function() { it('can be constructed with new', function(done) { var reg = new Registry(); expect(reg.get).toBeA('function'); expect(reg.set).toBeA('function'); expect(reg.tasks).toBeA('function'); done(); }); it('can be constructed without new', function(done) { var reg = Registry(); expect(reg.get).toBeA('function'); expect(reg.set).toBeA('function'); expect(reg.tasks).toBeA('function'); done(); }); }); describe('init', function() { it('is a noop', function(done) { var reg = new Registry(); expect(reg.init).toBeA('function'); done(); }); }); describe('get', function() { it('returns a task from the registry', function(done) { var reg = new Registry(); reg._tasks.test = noop; expect(reg.get('test')).toEqual(noop); done(); }); }); describe('set', function() { it('registers a task', function(done) { var reg = new Registry(); reg.set('test', noop); expect(reg._tasks.test).toEqual(noop); done(); }); it('returns the task (useful for inheriting)', function(done) { var reg = new Registry(); var task = reg.set('test', noop); expect(task).toEqual(noop); done(); }); }); describe('tasks', function() { it('returns an object of task name->functions', function(done) { var reg = new Registry(); reg.set('test1', noop); reg.set('test2', noop); expect(reg.tasks()).toEqual({ test1: noop, test2: noop }); done(); }); }); });