feat(testing): package angular2_testing to prepare it for publishing

Closes #5682
This commit is contained in:
Julie Ralph 2015-12-03 17:26:18 -08:00
parent cbf788869d
commit cc8f1f9552
4 changed files with 47 additions and 16 deletions

View File

@ -791,7 +791,7 @@ gulp.task('test.transpiler.unittest',
// Make a temporary directory and symlink dartium from there (just for this command) // Make a temporary directory and symlink dartium from there (just for this command)
// so that it can run. // so that it can run.
var dartiumTmpdir = path.join(os.tmpdir(), 'dartium' + new Date().getTime().toString()); var dartiumTmpdir = path.join(os.tmpdir(), 'dartium' + new Date().getTime().toString());
gulp.task('test.dart.angular2_testing/ci', ['!pubget.angular2_testing.dart'], function(done) { gulp.task('test.dart.angular2_testing/ci', ['build/pubspec.dart'], function(done) {
runSequence('test.dart.angular2_testing_symlink', 'test.dart.angular2_testing', runSequence('test.dart.angular2_testing_symlink', 'test.dart.angular2_testing',
sequenceComplete(done)); sequenceComplete(done));
}); });
@ -802,11 +802,8 @@ gulp.task(
gulp.task('test.dart.angular2_testing', gulp.task('test.dart.angular2_testing',
shell.task(['PATH=$PATH:' + dartiumTmpdir + ' pub run test -p dartium'], shell.task(['PATH=$PATH:' + dartiumTmpdir + ' pub run test -p dartium'],
{'cwd': 'modules_dart/angular2_testing'})); {'cwd': 'dist/dart/angular2_testing'}));
gulp.task(
'!pubget.angular2_testing.dart',
pubget.dir(gulp, gulpPlugins, {dir: 'modules_dart/angular2_testing', command: DART_SDK.PUB}));
// ----------------- // -----------------
// Pre-test checks // Pre-test checks
@ -865,18 +862,42 @@ gulp.task('test.typings',
// unmodified and directory structure is preserved. // unmodified and directory structure is preserved.
// //
// This task is expected to be run after build/tree.dart // This task is expected to be run after build/tree.dart
gulp.task('build/pure-packages.dart', function() { gulp.task('build/pure-packages.dart', function(done) {
var yaml = require('js-yaml'); runSequence('build/pure-packages.dart/standalone', 'build/pure-packages.dart/license',
'build/pure-packages.dart/angular2', sequenceComplete(done));
return gulp.src([
'modules_dart/transform/**/*',
'!modules_dart/transform/**/*.proto',
'!modules_dart/transform/pubspec.yaml',
'!modules_dart/transform/**/packages{,/**}',
])
.pipe(gulp.dest(path.join(CONFIG.dest.dart, 'angular2')));
}); });
gulp.task('build/pure-packages.dart/standalone', function() {
return gulp.src([
'modules_dart/**/*',
'!modules_dart/**/*.proto',
'!modules_dart/**/packages{,/**}',
'!modules_dart/payload{,/**}',
'!modules_dart/transform{,/**}',
])
.pipe(gulp.dest(CONFIG.dest.dart));
});
gulp.task('build/pure-packages.dart/license',
function() {
return gulp.src(['LICENSE'])
.pipe(gulp.dest(path.join(CONFIG.dest.dart, 'angular2_testing')));
})
gulp.task('build/pure-packages.dart/angular2', function() {
var yaml = require('js-yaml');
return gulp.src([
'modules_dart/transform/**/*',
'!modules_dart/transform/**/*.proto',
'!modules_dart/transform/pubspec.yaml',
'!modules_dart/transform/**/packages{,/**}',
])
.pipe(gulp.dest(path.join(CONFIG.dest.dart, 'angular2')));
});
// Builds all Dart packages, but does not compile them // Builds all Dart packages, but does not compile them
gulp.task('build/packages.dart', function(done) { gulp.task('build/packages.dart', function(done) {
runSequence('lint_protos.dart', 'build/tree.dart', 'build/pure-packages.dart', runSequence('lint_protos.dart', 'build/tree.dart', 'build/pure-packages.dart',

View File

@ -1,9 +1,13 @@
name: angular2_testing name: angular2_testing
description: 'Helpers to run unit tests for angular2 components and injectables.'
version: 0.0.0
environment: environment:
sdk: '>=1.10.0 <2.0.0' sdk: '>=1.10.0 <2.0.0'
dependencies: dependencies:
# This will be overridden by scripts/publish/pubspec_cleaner
# to point to the current version of Angular2.
angular2: angular2:
path: ../../dist/dart/angular2 path: '../angular2'
dev_dependencies: dev_dependencies:
test: '^0.12.6' test: '^0.12.6'
transformers: transformers:

View File

@ -37,3 +37,4 @@ publishModule angular2
publishModule benchpress publishModule benchpress
publishModule benchmarks publishModule benchmarks
publishModule angular2_material publishModule angular2_material
publishModule angular2_testing

View File

@ -27,4 +27,9 @@ doc['authors'] = Object.keys(BASE_PACKAGE_JSON.contributors).map(function(name)
return BASE_PACKAGE_JSON.contributors[name]; return BASE_PACKAGE_JSON.contributors[name];
}); });
if (doc['dependencies'] && doc['dependencies']['angular2']) {
delete doc['dependencies']['angular2'];
doc['dependencies']['angular2'] = BASE_PACKAGE_JSON.version;
}
fs.writeFileSync(pubspecFile, yaml.safeDump(doc)); fs.writeFileSync(pubspecFile, yaml.safeDump(doc));