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

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

Issue 12667016: Use default-port-aware URI comparisons in pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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/http.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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 return client.send(request); 78 return client.send(request);
79 }).then(http.Response.fromStream).then((response) { 79 }).then(http.Response.fromStream).then((response) {
80 var location = response.headers['location']; 80 var location = response.headers['location'];
81 if (location == null) throw new PubHttpException(response); 81 if (location == null) throw new PubHttpException(response);
82 return location; 82 return location;
83 }).then((location) => client.get(location)) 83 }).then((location) => client.get(location))
84 .then(handleJsonSuccess); 84 .then(handleJsonSuccess);
85 }).catchError((asyncError) { 85 }).catchError((asyncError) {
86 if (asyncError.error is! PubHttpException) throw asyncError; 86 if (asyncError.error is! PubHttpException) throw asyncError;
87 var url = asyncError.error.response.request.url; 87 var url = asyncError.error.response.request.url;
88 if (url.toString() == cloudStorageUrl.toString()) { 88 if (uriEqual(url, cloudStorageUrl)) {
89 // TODO(nweiz): the response may have XML-formatted information about 89 // TODO(nweiz): the response may have XML-formatted information about
Jennifer Messerly 2013/03/11 22:58:54 you could vendor in http://pub.dartlang.org/packag
nweiz 2013/03/11 22:59:37 we might, at some point
90 // the error. Try to parse that out once we have an easily-accessible 90 // the error. Try to parse that out once we have an easily-accessible
91 // XML parser. 91 // XML parser.
92 throw 'Failed to upload the package.'; 92 throw 'Failed to upload the package.';
93 } else if (url.origin == server.origin) { 93 } else if (uriEqual(url.origin, server.origin)) {
94 handleJsonError(asyncError.error.response); 94 handleJsonError(asyncError.error.response);
95 } else { 95 } else {
96 throw asyncError; 96 throw asyncError;
97 } 97 }
98 }); 98 });
99 } 99 }
100 100
101 Future onRun() { 101 Future onRun() {
102 if (force && dryRun) { 102 if (force && dryRun) {
103 log.error('Cannot use both --force and --dry-run.'); 103 log.error('Cannot use both --force and --dry-run.');
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 return confirm(message).then((confirmed) { 199 return confirm(message).then((confirmed) {
200 if (!confirmed) { 200 if (!confirmed) {
201 log.error("Package upload canceled."); 201 log.error("Package upload canceled.");
202 return false; 202 return false;
203 } 203 }
204 return true; 204 return true;
205 }); 205 });
206 }); 206 });
207 } 207 }
208 } 208 }
OLDNEW
« no previous file with comments | « no previous file | utils/pub/http.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698