| Index: pkg/polymer/bin/deploy.dart
|
| diff --git a/pkg/polymer/bin/deploy.dart b/pkg/polymer/bin/deploy.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..012d2264c585756fd4880a40ec2d2da174bf8bbb
|
| --- /dev/null
|
| +++ b/pkg/polymer/bin/deploy.dart
|
| @@ -0,0 +1,56 @@
|
| +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
| +// for details. All rights reserved. Use of this source code is governed by a
|
| +// BSD-style license that can be found in the LICENSE file.
|
| +
|
| +/**
|
| + * Temporary deploy command used to create a version of the app that can be
|
| + * compiled with dart2js and deployed. Following pub layout conventions, this
|
| + * script will treat any HTML file under a package 'web/' and 'test/'
|
| + * directories as entry points.
|
| + *
|
| + * From an application package you can run deploy by creating a small program
|
| + * like this file with a main.
|
| + *
|
| + * This application should go away once `pub deploy` can be configured to run
|
| + * barback transformers.
|
| + */
|
| +import 'dart:io';
|
| +
|
| +import 'package:polymer/deploy.dart';
|
| +import 'package:args/args.dart';
|
| +
|
| +main() {
|
| + var args = _parseArgs(new Options().arguments);
|
| + if (args == null) return;
|
| + print('polymer/deploy.dart: creating a deploy target for "$currentPackage"');
|
| + var outDir = args['out'];
|
| + run(args['webdir'], outDir).then(
|
| + (_) => print('Done! All files written to "$outDir"'));
|
| +}
|
| +
|
| +ArgResults _parseArgs(arguments) {
|
| + var parser = new ArgParser()
|
| + ..addFlag('help', abbr: 'h', help: 'Displays this help message',
|
| + defaultsTo: false, negatable: false)
|
| + ..addOption('webdir', help: 'Directory containing the application',
|
| + defaultsTo: 'web')
|
| + ..addOption('out', abbr: 'o', help: 'Directory where to generated files',
|
| + defaultsTo: 'out');
|
| + try {
|
| + var results = parser.parse(arguments);
|
| + if (results['help']) {
|
| + _showUsage(parser);
|
| + return null;
|
| + }
|
| + return results;
|
| + } on FormatException catch (e) {
|
| + print(e.message);
|
| + _showUsage(parser);
|
| + return null;
|
| + }
|
| +}
|
| +
|
| +_showUsage(parser) {
|
| + print('Usage: dart polymer/bin/deploy.dart [options]');
|
| + print(parser.getUsage());
|
| +}
|
|
|