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

Side by Side Diff: utils/pub/command_lish.dart

Issue 12193014: Wait until file list is available before printing it. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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 | utils/tests/pub/pub_lish_test.dart » ('j') | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 library command_lish; 5 library command_lish;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 import 'dart:json'; 9 import 'dart:json';
10 import 'dart:uri'; 10 import 'dart:uri';
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // the error. Try to parse that out once we have an easily-accessible 79 // the error. Try to parse that out once we have an easily-accessible
80 // XML parser. 80 // XML parser.
81 throw 'Failed to upload the package.'; 81 throw 'Failed to upload the package.';
82 } else if (url.origin == server.origin) { 82 } else if (url.origin == server.origin) {
83 handleJsonError(asyncError.error.response); 83 handleJsonError(asyncError.error.response);
84 } 84 }
85 }); 85 });
86 } 86 }
87 87
88 Future onRun() { 88 Future onRun() {
89 var files; 89 var packageBytesFuture = _filesToPublish.then((files) {
90 var packageBytesFuture = _filesToPublish.then((f) {
91 files = f;
92 log.fine('Archiving and publishing ${entrypoint.root}.'); 90 log.fine('Archiving and publishing ${entrypoint.root}.');
91
92 // Show the package contents so the user can verify they look OK.
93 var package = entrypoint.root;
94 log.message(
95 'Publishing "${package.name}" ${package.version}:\n'
96 '${generateTree(files)}');
97
93 return createTarGz(files, baseDir: entrypoint.root.dir); 98 return createTarGz(files, baseDir: entrypoint.root.dir);
94 }).then((stream) => stream.toBytes()); 99 }).then((stream) => stream.toBytes());
95 100
96 // Show the package contents so the user can verify they look OK. 101 // Validate the package.
97 var package = entrypoint.root;
98 log.message(
99 'Publishing "${package.name}" ${package.version}:\n'
100 '${generateTree(files)}');
101
102 // Validate the package.
103 return _validate(packageBytesFuture.then((bytes) => bytes.length)) 102 return _validate(packageBytesFuture.then((bytes) => bytes.length))
104 .then((_) => packageBytesFuture).then(_publish); 103 .then((_) => packageBytesFuture).then(_publish);
105 } 104 }
106 105
107 /// The basenames of files that are automatically excluded from archives. 106 /// The basenames of files that are automatically excluded from archives.
108 final _BLACKLISTED_FILES = const ['pubspec.lock']; 107 final _BLACKLISTED_FILES = const ['pubspec.lock'];
109 108
110 /// The basenames of directories that are automatically excluded from 109 /// The basenames of directories that are automatically excluded from
111 /// archives. 110 /// archives.
112 final _BLACKLISTED_DIRS = const ['packages']; 111 final _BLACKLISTED_DIRS = const ['packages'];
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 var s = warnings.length == 1 ? '' : 's'; 164 var s = warnings.length == 1 ? '' : 's';
166 message = "Package has ${warnings.length} warning$s. Upload anyway"; 165 message = "Package has ${warnings.length} warning$s. Upload anyway";
167 } 166 }
168 167
169 return confirm(message).then((confirmed) { 168 return confirm(message).then((confirmed) {
170 if (!confirmed) throw "Package upload canceled."; 169 if (!confirmed) throw "Package upload canceled.";
171 }); 170 });
172 }); 171 });
173 } 172 }
174 } 173 }
OLDNEW
« no previous file with comments | « no previous file | utils/tests/pub/pub_lish_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698