| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 /** |
| 6 * Temporary deploy command used to create a version of the app that can be |
| 7 * compiled with dart2js and deployed. Following pub layout conventions, this |
| 8 * script will treat any HTML file under a package 'web/' and 'test/' |
| 9 * directories as entry points. |
| 10 * |
| 11 * From an application package you can run deploy by creating a small program |
| 12 * like this file with a main. |
| 13 * |
| 14 * This application should go away once `pub deploy` can be configured to run |
| 15 * barback transformers. |
| 16 */ |
| 17 import 'dart:io'; |
| 18 |
| 19 import 'package:polymer/deploy.dart'; |
| 20 import 'package:args/args.dart'; |
| 21 |
| 22 main() { |
| 23 var args = _parseArgs(new Options().arguments); |
| 24 if (args == null) return; |
| 25 print('polymer/deploy.dart: creating a deploy target for "$currentPackage"'); |
| 26 var outDir = args['out']; |
| 27 run(args['webdir'], outDir).then( |
| 28 (_) => print('Done! All files written to "$outDir"')); |
| 29 } |
| 30 |
| 31 ArgResults _parseArgs(arguments) { |
| 32 var parser = new ArgParser() |
| 33 ..addFlag('help', abbr: 'h', help: 'Displays this help message', |
| 34 defaultsTo: false, negatable: false) |
| 35 ..addOption('webdir', help: 'Directory containing the application', |
| 36 defaultsTo: 'web') |
| 37 ..addOption('out', abbr: 'o', help: 'Directory where to generated files', |
| 38 defaultsTo: 'out'); |
| 39 try { |
| 40 var results = parser.parse(arguments); |
| 41 if (results['help']) { |
| 42 _showUsage(parser); |
| 43 return null; |
| 44 } |
| 45 return results; |
| 46 } on FormatException catch (e) { |
| 47 print(e.message); |
| 48 _showUsage(parser); |
| 49 return null; |
| 50 } |
| 51 } |
| 52 |
| 53 _showUsage(parser) { |
| 54 print('Usage: dart polymer/bin/deploy.dart [options]'); |
| 55 print(parser.getUsage()); |
| 56 } |
| OLD | NEW |