mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
gulp e2e: remove unneeded abstraction
This commit is contained in:
19
gulpfile.js
19
gulpfile.js
@ -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')))
|
||||||
|
Reference in New Issue
Block a user