Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(448)

Side by Side Diff: pkg/polymer/lib/deploy.dart

Issue 23599003: Fix read/write of binary assets in deploy (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698