Skip to content

Commit

Permalink
Scaffold: Normalize repository
Browse files Browse the repository at this point in the history
  • Loading branch information
phated committed Oct 1, 2017
1 parent 2d5c9cc commit c0a6b72
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 29 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,7 @@ node_modules

# Garbage files
.DS_Store

# Generated by integration tests
test/fixtures/tmp
test/fixtures/out
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
sudo: false
language: node_js
node_js:
- 'stable'
- '6'
- '5'
- '4'
- '0.12'
- '0.10'
after_script:
- npm run coveralls
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015 Blaine Bublitz, Eric Schoffstall and other contributors
Copyright (c) 2015, 2017 Blaine Bublitz <blaine.bublitz@gmail.com>, Eric Schoffstall <yo@contra.io> 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
Expand Down
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# undertaker-forward-reference

[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Gitter chat][gitter-image]][gitter-url]
[![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]

Undertaker custom registry supporting forward referenced tasks.

Expand Down Expand Up @@ -38,7 +38,7 @@ gulp.task('forward-ref', function(cb){

## API

### ForwardReferenceRegistry
### `ForwardReferenceRegistry()`

Constructor for the registry. Pass an instance of this registry to `gulp.registry`.

Expand All @@ -47,11 +47,17 @@ Constructor for the registry. Pass an instance of this registry to `gulp.registr
MIT

[downloads-image]: http://img.shields.io/npm/dm/undertaker-forward-reference.svg
[npm-url]: https://npmjs.org/package/undertaker-forward-reference
[npm-url]: https://npmjs.com/package/undertaker-forward-reference
[npm-image]: http://img.shields.io/npm/v/undertaker-forward-reference.svg

[travis-url]: https://travis-ci.org/gulpjs/undertaker-forward-reference
[travis-image]: http://img.shields.io/travis/gulpjs/undertaker-forward-reference.svg
[travis-image]: http://img.shields.io/travis/gulpjs/undertaker-forward-reference.svg?label=travis-ci

[appveyor-url]: https://ci.appveyor.com/project/gulpjs/undertaker-forward-reference
[appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/undertaker-forward-reference.svg?label=appveyor

[coveralls-url]: https://coveralls.io/r/gulpjs/undertaker-forward-reference
[coveralls-image]: http://img.shields.io/coveralls/gulpjs/undertaker-forward-reference/master.svg

[gitter-url]: https://gitter.im/gulpjs/gulp
[gitter-image]: https://badges.gitter.im/gulpjs/gulp.png
25 changes: 25 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 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"

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}"
20 changes: 13 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"name": "undertaker-forward-reference",
"version": "1.0.1",
"description": "Undertaker custom registry supporting forward referenced tasks",
"description": "Undertaker custom registry supporting forward referenced tasks.",
"author": "Gulp Team <team@gulpjs.com> (http://gulpjs.com/)",
"contributors": [],
"contributors": [
"Blaine Bublitz <blaine.bublitz@gmail.com>"
],
"repository": "gulpjs/undertaker-forward-reference",
"license": "MIT",
"engines": {
Expand All @@ -15,20 +17,24 @@
"index.js"
],
"scripts": {
"lint": "eslint . && jscs index.js test/",
"lint": "eslint index.js test/ && jscs index.js test/",
"pretest": "npm run lint",
"test": "lab -cv"
"test": "mocha --async-only",
"cover": "istanbul cover _mocha --report lcovonly",
"coveralls": "npm run cover && istanbul-coveralls"
},
"dependencies": {
"undertaker-registry": "^1.0.0"
},
"devDependencies": {
"code": "^1.4.1",
"eslint": "^1.7.3",
"eslint": "^1.10.3",
"eslint-config-gulp": "^2.0.0",
"expect": "^1.20.2",
"istanbul": "^0.4.3",
"istanbul-coveralls": "^1.0.3",
"jscs": "^2.4.0",
"jscs-preset-gulp": "^1.0.0",
"lab": "^6.2.0"
"mocha": "^3.2.0"
},
"keywords": [
"forward reference",
Expand Down
31 changes: 15 additions & 16 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -1,53 +1,52 @@
'use strict';

var lab = exports.lab = require('lab').script();
var code = require('code');
var expect = require('expect');

var Registry = require('../');

function noop() {}

lab.experiment('Forward Reference Registry', function() {
describe('Forward Reference Registry', function() {

var registry;

lab.beforeEach(function(done) {
beforeEach(function(done) {
registry = new Registry();
done();
});

lab.test('returns a function even if not registered', function(done) {
it('returns a function even if not registered', function(done) {
var task = registry.get('nothing');
code.expect(task).to.be.a.function();
expect(task).toBeA('function');
done();
});

lab.test('does not need to be constructed with new', function(done) {
it('does not need to be constructed with new', function(done) {
registry = Registry();
var task = registry.get('nothing');
code.expect(task).to.be.a.function();
expect(task).toBeA('function');
done();
});

lab.test('forward reference function mimics task name', function(done) {
it('forward reference function mimics task name', function(done) {
var task = registry.get('nothing');
code.expect(task.displayName).to.equal('nothing');
expect(task.displayName).toEqual('nothing');
done();
});

lab.test('returns the task if already registered', function(done) {
it('returns the task if already registered', function(done) {
registry.set('nothing', noop);
var task = registry.get('nothing');
code.expect(task).to.equal(noop);
expect(task).toEqual(noop);
done();
});

lab.test('excutes task when forward reference is called', function(done) {
it('excutes task when forward reference is called', function(done) {
var count = 0;

function actualTask() {
count++;
code.expect(count).to.equal(1);
expect(count).toEqual(1);
done();
}

Expand All @@ -57,9 +56,9 @@ lab.experiment('Forward Reference Registry', function() {
task();
});

lab.test('throws if task is not defined before forward ref is called', function(done) {
it('throws if task is not defined before forward ref is called', function(done) {
var task = registry.get('nothing');
code.expect(task).to.throw('Forward referenced task \'nothing\' not defined before use');
expect(task).toThrow('Forward referenced task \'nothing\' not defined before use');
done();
});
});

0 comments on commit c0a6b72

Please sign in to comment.