-
-
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.
Browse files
Browse the repository at this point in the history
Includes implementation for description configuration (closes #70)
- Loading branch information
Showing
44 changed files
with
531 additions
and
98 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
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
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,67 @@ | ||
'use strict'; | ||
|
||
var lab = exports.lab = require('lab').script(); | ||
var expect = require('code').expect; | ||
var path = require('path'); | ||
var fs = require('fs'); | ||
|
||
var skipLines = require('./tools/skip-lines'); | ||
var eraseTime = require('./tools/erase-time'); | ||
var runner = require('./tools/run-gulp'); | ||
|
||
var fixturesDir = path.join(__dirname, 'fixtures', 'config'); | ||
var expectedDir = path.join(__dirname, 'expected', 'config'); | ||
|
||
lab.experiment('gulp configuration', function() { | ||
|
||
lab.test('Should configure with a .gulp.* file in cwd', | ||
function(done) { | ||
runner({ verbose: false }) | ||
.basedir(fixturesDir) | ||
.chdir('foo/bar') | ||
.gulp('--tasks') | ||
.run(cb); | ||
|
||
function cb(err, stdout) { | ||
var expected = fs.readFileSync(path.join(expectedDir, 'output0.txt'), | ||
'utf-8'); | ||
stdout = eraseTime(stdout); | ||
expect(stdout).to.equal(expected); | ||
done(err); | ||
} | ||
}); | ||
|
||
lab.test('Should configure with a .gulp.* file in cwd found up', | ||
function(done) { | ||
runner({ verbose: false }) | ||
.basedir(fixturesDir) | ||
.chdir('foo/bar/baz') | ||
.gulp('--tasks') | ||
.run(cb); | ||
|
||
function cb(err, stdout) { | ||
var expected = fs.readFileSync(path.join(expectedDir, 'output0.txt'), | ||
'utf-8'); | ||
stdout = eraseTime(skipLines(stdout, 1)); | ||
expect(stdout).to.equal(expected); | ||
done(err); | ||
} | ||
}); | ||
|
||
lab.test('Should configure with a .gulp.* file in cwd by --cwd', | ||
function(done) { | ||
runner({ verbose: false }) | ||
.basedir(fixturesDir) | ||
.chdir('qux') | ||
.gulp('--tasks', '--gulpfile ../foo/bar/gulpfile.js', '--cwd .') | ||
.run(cb); | ||
|
||
function cb(err, stdout) { | ||
var expected = fs.readFileSync(path.join(expectedDir, 'output1.txt'), | ||
'utf-8'); | ||
stdout = eraseTime(stdout); | ||
expect(stdout).to.equal(expected); | ||
done(err); | ||
} | ||
}); | ||
}); |
2 changes: 1 addition & 1 deletion
2
...ags-tasks/by-unwrap-and-not-by-unwrap.txt → .../expected/by-unwrap-and-not-by-unwrap.txt
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,4 +1,4 @@ | ||
gulp-cli/test | ||
gulp-cli/test/fixtures | ||
├─┬ default | ||
│ └─┬ <series> | ||
│ ├── task1 | ||
|
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,2 @@ | ||
Description by .gulp.json in directory foo/bar | ||
└── default |
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,2 @@ | ||
description by .gulp.js in directory qux | ||
└── default |
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 +1 @@ | ||
{"label":"Tasks for {{path}}","nodes":[{"label":"test1","type":"task","nodes":[{"label":"<series>","type":"function","branch":true,"nodes":[{"label":"noop","type":"function","nodes":[]}]}]},{"label":"test2","type":"task","nodes":[{"label":"<series>","type":"function","branch":true,"nodes":[{"label":"test1","type":"task","nodes":[{"label":"<series>","type":"function","branch":true,"nodes":[{"label":"noop","type":"function","nodes":[]}]}]},{"label":"noop","type":"function","nodes":[]}]}]},{"label":"test3","type":"task","nodes":[{"label":"<series>","type":"function","branch":true,"nodes":[{"label":"described","type":"function","nodes":[]}]}]},{"label":"test4","type":"task","nodes":[{"label":"<series>","type":"function","branch":true,"nodes":[{"label":"errorFunction","type":"function","nodes":[]},{"label":"anon","type":"function","nodes":[]}]}]},{"label":"default","type":"task","nodes":[{"label":"<series>","type":"function","branch":true,"nodes":[{"label":"test1","type":"task","nodes":[{"label":"<series>","type":"function","branch":true,"nodes":[{"label":"noop","type":"function","nodes":[]}]}]},{"label":"test3","type":"task","nodes":[{"label":"<series>","type":"function","branch":true,"nodes":[{"label":"described","type":"function","nodes":[]}]}]},{"label":"noop","type":"function","nodes":[]}]}]}]} | ||
{"label":"gulp-cli/test/fixtures/gulpfiles","nodes":[{"label":"test1","type":"task","nodes":[{"label":"<series>","type":"function","branch":true,"nodes":[{"label":"noop","type":"function","nodes":[]}]}]},{"label":"test2","type":"task","nodes":[{"label":"<series>","type":"function","branch":true,"nodes":[{"label":"test1","type":"task","nodes":[{"label":"<series>","type":"function","branch":true,"nodes":[{"label":"noop","type":"function","nodes":[]}]}]},{"label":"noop","type":"function","nodes":[]}]}]},{"label":"test3","type":"task","nodes":[{"label":"<series>","type":"function","branch":true,"nodes":[{"label":"described","type":"function","nodes":[]}]}]},{"label":"test4","type":"task","nodes":[{"label":"<series>","type":"function","branch":true,"nodes":[{"label":"errorFunction","type":"function","nodes":[]},{"label":"anon","type":"function","nodes":[]}]}]},{"label":"default","type":"task","nodes":[{"label":"<series>","type":"function","branch":true,"nodes":[{"label":"test1","type":"task","nodes":[{"label":"<series>","type":"function","branch":true,"nodes":[{"label":"noop","type":"function","nodes":[]}]}]},{"label":"test3","type":"task","nodes":[{"label":"<series>","type":"function","branch":true,"nodes":[{"label":"described","type":"function","nodes":[]}]}]},{"label":"noop","type":"function","nodes":[]}]}]}]} |
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,4 +1,4 @@ | ||
gulp-cli/test | ||
gulp-cli/test/fixtures/gulpfiles | ||
├─┬ default | ||
│ └─┬ <series> | ||
│ ├─┬ test1 | ||
|
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,4 +1,4 @@ | ||
gulp-cli/test | ||
gulp-cli/test/fixtures/gulpfiles | ||
├── build | ||
├── clean | ||
└─┬ dist | ||
|
2 changes: 1 addition & 1 deletion
2
...ected/flags-tasks/with-desc-and-flags.txt → test/expected/with-desc-and-flags.txt
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 |
---|---|---|
@@ -1,26 +1,31 @@ | ||
'use strict'; | ||
|
||
var lab = exports.lab = require('lab').script(); | ||
var code = require('code'); | ||
var expect = require('code').expect; | ||
var fs = require('fs'); | ||
var child = require('child_process'); | ||
var path = require('path'); | ||
var skipLines = require('./tools/skip-lines'); | ||
var eraseTime = require('./tools/erase-time'); | ||
var runner = require('./tools/run-gulp'); | ||
|
||
var output = fs.readFileSync(__dirname + '/expected/tasks-as-exports.txt', 'utf8').replace(/(\r\n|\n|\r)/gm,'\n'); | ||
var expectedDir = path.join(__dirname, 'expected'); | ||
|
||
// Long timeout is required because parse time is slow | ||
lab.experiment('exports as tasks', { timeout: 0 }, function() { | ||
|
||
lab.test('prints the task list', function(done) { | ||
runner({ verbose: false }) | ||
.gulp('--tasks', | ||
'--gulpfile ./fixtures/gulpfiles/gulpfile-exports.babel.js') | ||
.run(cb); | ||
|
||
child.exec('node ' + __dirname + '/../bin/gulp.js --tasks --gulpfile "./test/fixtures/gulpfile-exports.babel.js"', function(err, stdout) { | ||
code.expect(stdout).to.contain('Tasks for'); | ||
stdout = stdout.replace(/\\/g, '/').split('Tasks for')[1].split('\n'); | ||
var outputArray = output.split('\n'); | ||
for (var i = 0; i < stdout.length; i++) { | ||
code.expect(stdout[i]).to.contain(outputArray[i]); | ||
} | ||
done(err); | ||
}); | ||
function cb(err, stdout) { | ||
var filepath = path.join(expectedDir, 'tasks-as-exports.txt'); | ||
var expected = fs.readFileSync(filepath, 'utf-8'); | ||
stdout = eraseTime(skipLines(stdout, 2)); | ||
expect(stdout).to.equal(expected); | ||
done(); | ||
} | ||
}); | ||
|
||
}); |
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,3 @@ | ||
{ | ||
"description" : "gulp-cli/test/fixtures" | ||
} |
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,3 @@ | ||
{ | ||
"description": "Description by .gulp.json in directory foo/bar" | ||
} |
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,3 @@ | ||
// jscs:disable | ||
|
||
exports.description = 'DESCRIPTION BY .gulp.babel.js in directory foo/bar/baz' |
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,7 @@ | ||
'use strict'; | ||
|
||
var gulp = require('gulp'); | ||
|
||
gulp.task('default', function(done) { | ||
done(); | ||
}); |
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,5 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
description: 'description by .gulp.js in directory qux', | ||
}; |
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,3 @@ | ||
{ | ||
"description" : "gulp-cli/test/fixtures/gulpfiles" | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
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
Oops, something went wrong.