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

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

Issue 11881032: Stop working around issue 7781 in Pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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/pub/command_uploader.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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 request.files.add(new http.MultipartFile.fromBytes( 65 request.files.add(new http.MultipartFile.fromBytes(
66 'file', packageBytes, filename: 'package.tar.gz')); 66 'file', packageBytes, filename: 'package.tar.gz'));
67 return client.send(request); 67 return client.send(request);
68 }).then(http.Response.fromStream).then((response) { 68 }).then(http.Response.fromStream).then((response) {
69 var location = response.headers['location']; 69 var location = response.headers['location'];
70 if (location == null) throw new PubHttpException(response); 70 if (location == null) throw new PubHttpException(response);
71 return location; 71 return location;
72 }).then((location) => client.get(location)) 72 }).then((location) => client.get(location))
73 .then(handleJsonSuccess); 73 .then(handleJsonSuccess);
74 }).catchError((asyncError) { 74 }).catchError((asyncError) {
75 var e = getRealError(asyncError); 75 if (asyncError.error is! PubHttpException) throw asyncError;
76 if (e is! PubHttpException) throw asyncError; 76 var url = asyncError.error.response.request.url;
77 var url = e.response.request.url;
78 if (url.toString() == cloudStorageUrl.toString()) { 77 if (url.toString() == cloudStorageUrl.toString()) {
79 // TODO(nweiz): the response may have XML-formatted information about 78 // TODO(nweiz): the response may have XML-formatted information about
80 // 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
81 // XML parser. 80 // XML parser.
82 throw 'Failed to upload the package.'; 81 throw 'Failed to upload the package.';
83 } else if (url.origin == server.origin) { 82 } else if (url.origin == server.origin) {
84 handleJsonError(e.response); 83 handleJsonError(asyncError.error.response);
85 } 84 }
86 }); 85 });
87 } 86 }
88 87
89 Future onRun() { 88 Future onRun() {
90 var files; 89 var files;
91 return _filesToPublish.then((f) { 90 return _filesToPublish.then((f) {
92 files = f; 91 files = f;
93 log.fine('Archiving and publishing ${entrypoint.root}.'); 92 log.fine('Archiving and publishing ${entrypoint.root}.');
94 return createTarGz(files, baseDir: entrypoint.root.dir); 93 return createTarGz(files, baseDir: entrypoint.root.dir);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 var s = warnings.length == 1 ? '' : 's'; 177 var s = warnings.length == 1 ? '' : 's';
179 message = "Package has ${warnings.length} warning$s. Upload anyway"; 178 message = "Package has ${warnings.length} warning$s. Upload anyway";
180 } 179 }
181 180
182 return confirm(message).then((confirmed) { 181 return confirm(message).then((confirmed) {
183 if (!confirmed) throw "Package upload canceled."; 182 if (!confirmed) throw "Package upload canceled.";
184 }); 183 });
185 }); 184 });
186 } 185 }
187 } 186 }
OLDNEW
« no previous file with comments | « no previous file | utils/pub/command_uploader.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698