Skip to content

Commit

Permalink
Fix: Improve task dependency regexp
Browse files Browse the repository at this point in the history
  • Loading branch information
= authored and phated committed Dec 21, 2017
1 parent 612eab1 commit 86bcf42
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
7 changes: 4 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ function handleArguments(env) {
function logTasks(env, localGulp) {
var tree = taskTree(localGulp.tasks);
var padding = 0;
var rdependency = /[ │] [├└]/;
tree.label = 'Tasks for ' + chalk.magenta(tildify(env.configPath));
archy(tree)
.split('\n')
Expand All @@ -156,11 +157,11 @@ function logTasks(env, localGulp) {
var line = v.split(' ');
var task = line.slice(1).join(' ');

if ( /.└/.test(v) ) {
// log dependencies as is
// log dependencies as is
if ( rdependency.test(v) ) {
gutil.log(v);
// pretty task with optionnal description
} else {
// pretty task with optionnal description
gutil.log(
line[0] + ' ' +
chalk.cyan(task) +
Expand Down
5 changes: 4 additions & 1 deletion test/flags-tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ lab.experiment('flag: --tasks', function () {
code.expect(stdout[2]).to.contain('├─┬ test2');
code.expect(stdout[3]).to.contain('│ └── test1');
code.expect(stdout[4]).to.contain('├── test3 description');
code.expect(stdout[5]).to.contain('└── default');
code.expect(stdout[5]).to.contain('└─┬ default');
code.expect(stdout[6]).to.contain(' ├── test1');
code.expect(stdout[7]).to.contain(' └── test3');
code.expect(stdout[8]).to.not.contain('description');
done(err);
});
});
Expand Down
2 changes: 1 addition & 1 deletion test/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ gulp.task('test1', noop);
gulp.task('test2', ['test1'], noop);
gulp.task('test3', described);

gulp.task('default', noop);
gulp.task('default', ['test1', 'test3'], noop);

0 comments on commit 86bcf42

Please sign in to comment.