Skip to content

Commit 86bcf42

Browse files
=phated
authored andcommitted
Fix: Improve task dependency regexp
1 parent 612eab1 commit 86bcf42

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ function handleArguments(env) {
137137
function logTasks(env, localGulp) {
138138
var tree = taskTree(localGulp.tasks);
139139
var padding = 0;
140+
var rdependency = /[ ] []/;
140141
tree.label = 'Tasks for ' + chalk.magenta(tildify(env.configPath));
141142
archy(tree)
142143
.split('\n')
@@ -156,11 +157,11 @@ function logTasks(env, localGulp) {
156157
var line = v.split(' ');
157158
var task = line.slice(1).join(' ');
158159

159-
if ( /./.test(v) ) {
160-
// log dependencies as is
160+
// log dependencies as is
161+
if ( rdependency.test(v) ) {
161162
gutil.log(v);
163+
// pretty task with optionnal description
162164
} else {
163-
// pretty task with optionnal description
164165
gutil.log(
165166
line[0] + ' ' +
166167
chalk.cyan(task) +

test/flags-tasks.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ lab.experiment('flag: --tasks', function () {
1616
code.expect(stdout[2]).to.contain('├─┬ test2');
1717
code.expect(stdout[3]).to.contain('│ └── test1');
1818
code.expect(stdout[4]).to.contain('├── test3 description');
19-
code.expect(stdout[5]).to.contain('└── default');
19+
code.expect(stdout[5]).to.contain('└─┬ default');
20+
code.expect(stdout[6]).to.contain(' ├── test1');
21+
code.expect(stdout[7]).to.contain(' └── test3');
22+
code.expect(stdout[8]).to.not.contain('description');
2023
done(err);
2124
});
2225
});

test/gulpfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ gulp.task('test1', noop);
1010
gulp.task('test2', ['test1'], noop);
1111
gulp.task('test3', described);
1212

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

0 commit comments

Comments
 (0)