-
-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Adapt to undertaker v1.0.0 (#87)
- Loading branch information
Showing
14 changed files
with
224 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'))); | ||
|
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters