Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * Temporary deploy command used to create a version of the app that can be | 6 * Temporary deploy command used to create a version of the app that can be |
| 7 * compiled with dart2js and deployed. This library should go away once `pub | 7 * compiled with dart2js and deployed. This library should go away once `pub |
| 8 * deploy` can be configured to run barback transformers. | 8 * deploy` can be configured to run barback transformers. |
| 9 * | 9 * |
| 10 * From an application package you can run this program by calling dart with a | 10 * From an application package you can run this program by calling dart with a |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 111 filepath = path.join(outDir, id.path); | 111 filepath = path.join(outDir, id.path); |
| 112 } else if (id.path.startsWith('lib/')) { | 112 } else if (id.path.startsWith('lib/')) { |
| 113 filepath = path.join(outDir, 'web', 'packages', id.package, | 113 filepath = path.join(outDir, 'web', 'packages', id.package, |
| 114 id.path.substring(4)); | 114 id.path.substring(4)); |
| 115 } else { | 115 } else { |
| 116 // TODO(sigmund): do something about other assets? | 116 // TODO(sigmund): do something about other assets? |
| 117 continue; | 117 continue; |
| 118 } | 118 } |
| 119 | 119 |
| 120 _ensureDir(path.dirname(filepath)); | 120 _ensureDir(path.dirname(filepath)); |
| 121 futures.add(asset.readAsString() | 121 var writer = new File(filepath).openWrite(); |
| 122 .then((content) => new File(filepath).writeAsStringSync(content))); | 122 futures.add(writer.addStream(asset.read()).then((_) => writer.close())); |
|
Siggi Cherem (dart-lang)
2013/08/27 16:54:28
turns out I was reading a .png file this way, yike
| |
| 123 } | 123 } |
| 124 return Future.wait(futures); | 124 return Future.wait(futures); |
| 125 }).then((_) { | 125 }).then((_) { |
| 126 // Copy also all the files we didn't process | 126 // Copy also all the files we didn't process |
| 127 var futures = []; | 127 var futures = []; |
| 128 for (var package in _ignoredPackages) { | 128 for (var package in _ignoredPackages) { |
| 129 for (var relpath in _listDir(package, 'lib')) { | 129 for (var relpath in _listDir(package, 'lib')) { |
| 130 var inpath = path.join(_packageDirs[package], relpath); | 130 var inpath = path.join(_packageDirs[package], relpath); |
| 131 var outpath = path.join(outDir, 'web', 'packages', package, | 131 var outpath = path.join(outDir, 'web', 'packages', package, |
| 132 relpath.substring(4)); | 132 relpath.substring(4)); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 220 print(e.message); | 220 print(e.message); |
| 221 _showUsage(parser); | 221 _showUsage(parser); |
| 222 return null; | 222 return null; |
| 223 } | 223 } |
| 224 } | 224 } |
| 225 | 225 |
| 226 _showUsage(parser) { | 226 _showUsage(parser) { |
| 227 print('Usage: dart package:polymer/deploy.dart [options]'); | 227 print('Usage: dart package:polymer/deploy.dart [options]'); |
| 228 print(parser.getUsage()); | 228 print(parser.getUsage()); |
| 229 } | 229 } |
| OLD | NEW |