-
-
Notifications
You must be signed in to change notification settings - Fork 112
Adapt to undertaker v1.0.0 #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,8 @@ | ||
| sudo: false | ||
| language: node_js | ||
| node_js: | ||
| - "stable" | ||
| - "6" | ||
| - "5" | ||
| - "4" | ||
| - "0.12" | ||
| - "0.10" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| 'use strict'; | ||
|
|
||
| var isString = require('lodash.isstring'); | ||
| var isObject = require('lodash.isplainobject'); | ||
| var isFunction = require('lodash.isfunction'); | ||
|
|
||
| function getTask(gulpInst) { | ||
| return function(name) { | ||
| var task = gulpInst.task(name); | ||
| return { | ||
| description: getDescription(task), | ||
| flags: getFlags(task), | ||
| }; | ||
| }; | ||
| } | ||
|
|
||
| function getDescription(task) { | ||
| if (isString(task.description)) { | ||
| return task.description; | ||
| } | ||
| if (isFunction(task.unwrap)) { | ||
| var origFn = task.unwrap(); | ||
| if (isString(origFn.description)) { | ||
| return origFn.description; | ||
| } | ||
| } | ||
| return undefined; | ||
| } | ||
|
|
||
| function getFlags(task) { | ||
| if (isObject(task.flags)) { | ||
| return task.flags; | ||
| } | ||
| if (isFunction(task.unwrap)) { | ||
| var origFn = task.unwrap(); | ||
| if (isObject(origFn.flags)) { | ||
| return origFn.flags; | ||
| } | ||
| } | ||
| return undefined; | ||
| } | ||
|
|
||
| module.exports = getTask; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,7 +27,7 @@ | |
| "lint": "eslint . && jscs index.js bin/ lib/ test/", | ||
| "prepublish": "marked-man --name gulp docs/CLI.md > gulp.1", | ||
| "pretest": "npm run lint", | ||
| "test": "lab test/*.js -cv", | ||
| "test": "lab test/*.js -cv -I Reflect", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, this is annoying. These tests will need to be switch to mocha like all the other repositories. This is a fine fix for now. |
||
| "changelog": "github-changes -o gulpjs -r gulp-cli -b master -f ./CHANGELOG.md --order-semver --use-commit-body" | ||
| }, | ||
| "dependencies": { | ||
|
|
@@ -37,7 +37,10 @@ | |
| "gulplog": "^1.0.0", | ||
| "interpret": "^1.0.0", | ||
| "liftoff": "^2.1.0", | ||
| "lodash.sortby": "^4.0.1", | ||
| "lodash.isfunction": "^3.0.8", | ||
| "lodash.isplainobject": "^4.0.4", | ||
| "lodash.isstring": "^4.0.1", | ||
| "lodash.sortby": "^4.5.0", | ||
| "matchdep": "^1.0.0", | ||
| "mute-stdout": "^1.0.0", | ||
| "pretty-hrtime": "^1.0.0", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| gulp-cli/test | ||
| ├─┬ default | ||
| │ └─┬ <series> | ||
| │ ├── task1 | ||
| │ └─┬ <parallel> | ||
| │ ├── task2 | ||
| │ └── task3 | ||
| ├── no-desc | ||
| ├── task1 Description for gulp.task("task1") | ||
| │ --flag-of-task1 …Description for flag of task1 | ||
| ├── task2 Description for gulp.task("task2").unwrap() | ||
| │ --flag-of-task2 …Description for flag of task2 | ||
| └── task3 Use gulp.task("task3").description preferentially | ||
| --flag0-of-task3 …Description for flag0 of task3 | ||
| --flag1-of-task3 …Use gulp.task("task3").flags preferentially |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| 'use strict'; | ||
|
|
||
| var gulp = require('gulp'); | ||
|
|
||
| // Test case when description and flags are gotten by gulp.task(name) | ||
| gulp.task('task1', function() {}); | ||
| gulp.task('task1').description = 'Description for gulp.task("task1")'; | ||
| gulp.task('task1').flags = { | ||
| '--flag-of-task1': 'Description for flag of task1', | ||
| }; | ||
|
|
||
| // Test case when description and flags are gotten by gulp.task(name).unwrap() | ||
| gulp.task('task2', function() {}); | ||
| if (!gulp.task('task2').unwrap) { | ||
| var fn2 = function() {}; | ||
| gulp.task('task2').unwrap = function() { | ||
| return fn2; | ||
| }; | ||
| } | ||
| gulp.task('task2').unwrap().description = | ||
| 'Description for gulp.task("task2").unwrap()'; | ||
| gulp.task('task2').unwrap().flags = { | ||
| '--flag-of-task2': 'Description for flag of task2', | ||
| }; | ||
|
|
||
| // Test case when description and flags are gotten by both gulp.task(name) and | ||
| // gulp.task(name).unwrap() => Use things by gulp.task(name) preferentially. | ||
| gulp.task('task3', function() {}); | ||
| if (!gulp.task('task3').unwrap) { | ||
| var fn3 = function() {}; | ||
| gulp.task('task3').unwrap = function() { | ||
| return fn3; | ||
| }; | ||
| } | ||
| gulp.task('task3').description = | ||
| 'Use gulp.task("task3").description preferentially'; | ||
| gulp.task('task3').flags = { | ||
| '--flag0-of-task3': 'Description for flag0 of task3', | ||
| '--flag1-of-task3': 'Use gulp.task("task3").flags preferentially', | ||
| }; | ||
| gulp.task('task3').unwrap().description = | ||
| 'This description should not output'; | ||
| gulp.task('task3').unwrap().flags = { | ||
| '--flag1-of-task3': 'This description should not output', | ||
| '--flag2-of-task3': 'This description should not output', | ||
| }; | ||
|
|
||
| gulp.task('no-desc', function() {}); | ||
| if (!gulp.task('no-desc').unwrap) { | ||
| var fn4 = function() {}; | ||
| gulp.task('no-desc').unwrap = function() { | ||
| return fn4; | ||
| }; | ||
| } | ||
|
|
||
| gulp.task('default', gulp.series('task1', gulp.parallel('task2', 'task3'))); | ||
|
|
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,4 +48,58 @@ lab.experiment('taskTree()', function() { | |
| code.expect(taskTree(tasks)).to.deep.equal(expectTree); | ||
| done(); | ||
| }); | ||
|
|
||
| lab.test('processes children recursively.', function(done) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. where did this test come from?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test is what I forgot to include in previous PR and for coverage 100%. |
||
| var tasks = { | ||
| test: { | ||
| dep: ['test2', 'test3'], | ||
| }, | ||
| test2: { | ||
| dep: ['test3'], | ||
| }, | ||
| test3: { | ||
| dep: [], | ||
| }, | ||
| }; | ||
|
|
||
| var expectTree = { | ||
| label: 'Tasks', | ||
| nodes: [ | ||
| { | ||
| label: 'test', | ||
| nodes: [ | ||
| { | ||
| label: 'test2', | ||
| nodes: [ | ||
| { | ||
| label: 'test3', | ||
| nodes: [], | ||
| }, | ||
| ], | ||
| }, | ||
| { | ||
| label: 'test3', | ||
| nodes: [], | ||
| }, | ||
| ], | ||
| }, | ||
| { | ||
| label: 'test2', | ||
| nodes: [ | ||
| { | ||
| label: 'dep3', | ||
| nodes: [], | ||
| }, | ||
| ], | ||
| }, | ||
| { | ||
| label: 'test3', | ||
| nodes: [], | ||
| }, | ||
| ], | ||
| }; | ||
|
|
||
| code.expect(taskTree(tasks)).to.deep.equal(expectTree); | ||
| done(); | ||
| }); | ||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you sure you want to be using npm 3? It's so much slower, and appveyor is already extremely slow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
npm install EPERM errors frequently occured on appveyor, and it seems that this error can be fixed by using npm3.
ref. npm/npm#9696