gulp e2e: remove unneeded abstraction

This commit is contained in:
Andrew
2015-03-27 13:31:32 -06:00
parent 013e94d5b2
commit f53b7e13b6

View File

@ -84,15 +84,6 @@ gulp.task('e2e', ['build'], function() {
}) })
var testTemplate = _.template( fs.readFileSync('scripts/e2e/e2e.template.js') ) var testTemplate = _.template( fs.readFileSync('scripts/e2e/e2e.template.js') )
function wrapContents(file, template, data) {
var contents = file.contents.toString();
contents = template(_.defaults(data || {}, {
contents: contents,
buildConfig: buildConfig,
}))
file.contents = new Buffer(contents);
}
return gulp.src(buildConfig.src.e2e) return gulp.src(buildConfig.src.e2e)
.pipe(rename(function(file) { .pipe(rename(function(file) {
file.dirname = file.dirname.replace('/test/', '/') file.dirname = file.dirname.replace('/test/', '/')
@ -108,9 +99,13 @@ gulp.task('e2e', ['build'], function() {
.pipe(gulpif(/.e2e.js$/, through2.obj(function(file, enc, next) { .pipe(gulpif(/.e2e.js$/, through2.obj(function(file, enc, next) {
var basename = path.basename(file); var basename = path.basename(file);
var relativePath = path.dirname(file.path.replace(/^.*?src.components/, '')) var relativePath = path.dirname(file.path.replace(/^.*?src.components/, ''))
wrapContents(file, testTemplate, { var contents = file.contents.toString();
relativePath: relativePath, contents = template(_.defaults(data || {}, {
}); contents: contents,
buildConfig: buildConfig,
relativePath: relativePath
}))
file.contents = new Buffer(contents);
next(null, file); next(null, file);
}))) })))
.pipe(gulpif({ isFile: true }, gulp.dest(buildConfig.dist + '/e2e'))) .pipe(gulpif({ isFile: true }, gulp.dest(buildConfig.dist + '/e2e')))