Chromium Code Reviews| Index: pkg/polymer/lib/deploy.dart |
| diff --git a/pkg/polymer/lib/deploy.dart b/pkg/polymer/lib/deploy.dart |
| index 8d3c47b4e397e8b4b38074e940dde9af4050c6dd..5a0057e1552bf63c7a60804f0ad5e153ebd0b907 100644 |
| --- a/pkg/polymer/lib/deploy.dart |
| +++ b/pkg/polymer/lib/deploy.dart |
| @@ -2,21 +2,6 @@ |
| // 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 |
|
Siggi Cherem (dart-lang)
2013/09/08 20:31:33
Let's revert the changes to lib/deploy.dart bin/de
|
| - * 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 |
| - * as follows: |
| - * |
| - * import "package:polymer/deploy.dart" as deploy; |
| - * main() => deploy.main(); |
| - * |
| - * This library should go away once `pub deploy` can be configured to run |
| - * barback transformers. |
| - */ |
| library polymer.deploy; |
| import 'dart:async'; |
| @@ -28,23 +13,13 @@ import 'package:path/path.dart' as path; |
| import 'package:polymer/src/transform.dart' show phases; |
| import 'package:stack_trace/stack_trace.dart'; |
| import 'package:yaml/yaml.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"')); |
| -} |
| /** |
| * API exposed for testing purposes. Runs this deploy command but prentend that |
| * the sources under [webDir] belong to package 'test'. |
| */ |
| Future runForTest(String webDir, String outDir) { |
| - _currentPackage = 'test'; |
| + currentPackage = 'test'; |
| // associate package dirs with their location in the repo: |
| _packageDirs = {'test' : '.'}; |
| @@ -56,10 +31,10 @@ Future runForTest(String webDir, String outDir) { |
| addPackages('..'); |
| addPackages('../third_party'); |
| addPackages('../../third_party/pkg'); |
| - return _run(webDir, outDir); |
| + return run(webDir, outDir); |
| } |
| -Future _run(String webDir, String outDir) { |
| +Future run(String webDir, String outDir) { |
| var barback = new Barback(new _PolymerDeployProvider()); |
| _initializeBarback(barback, webDir); |
| _attachListeners(barback); |
| @@ -85,8 +60,8 @@ void _initializeBarback(Barback barback, String webDir) { |
| } |
| // In case of the current package, include also 'web'. |
| - for (var filepath in _listDir(_currentPackage, webDir)) { |
| - assets.add(new AssetId(_currentPackage, filepath)); |
| + for (var filepath in _listDir(currentPackage, webDir)) { |
| + assets.add(new AssetId(currentPackage, filepath)); |
| } |
| barback.updateSources(assets); |
| } |
| @@ -138,7 +113,7 @@ Future _emitAllFiles(Barback barback, String webDir, String outDir) { |
| for (var asset in assets) { |
| var id = asset.id; |
| var filepath; |
| - if (id.package == _currentPackage && id.path.startsWith('$webDir/')) { |
| + if (id.package == currentPackage && id.path.startsWith('$webDir/')) { |
| filepath = path.join(outDir, id.path); |
| } else if (id.path.startsWith('lib/')) { |
| filepath = path.join(outDir, webDir, 'packages', id.package, |
| @@ -187,7 +162,7 @@ class _PolymerDeployProvider implements PackageProvider { |
| /** The current package extracted from the pubspec.yaml file. */ |
| -String _currentPackage = () { |
| +String currentPackage = () { |
| var pubspec = new File('pubspec.yaml'); |
| if (!pubspec.existsSync()) { |
| print('error: pubspec.yaml file not found, please run this script from ' |
| @@ -214,7 +189,7 @@ Map<String, String> _packageDirs = () { |
| } |
| var map = JSON.decode(result.stdout)["packages"]; |
| map.forEach((k, v) { map[k] = path.dirname(v); }); |
| - map[_currentPackage] = '.'; |
| + map[currentPackage] = '.'; |
| return map; |
| }(); |
| @@ -232,30 +207,3 @@ final Set<String> _ignoredPackages = |
| 'source_maps', 'stack_trace', 'unittest', |
| 'unmodifiable_collection', 'yaml' |
| ]).toSet(); |
| - |
| -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 package:polymer/deploy.dart [options]'); |
| - print(parser.getUsage()); |
| -} |