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

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

Issue 12052038: Rename new Uri.fromString to Uri.parse. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Reupload because of Error. 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 | « tests/utils/uri_test.dart ('k') | 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 20 matching lines...) Expand all
31 ArgParser get commandParser { 31 ArgParser get commandParser {
32 var parser = new ArgParser(); 32 var parser = new ArgParser();
33 // TODO(nweiz): Use HostedSource.defaultUrl as the default value once we use 33 // TODO(nweiz): Use HostedSource.defaultUrl as the default value once we use
34 // dart:io for HTTPS requests. 34 // dart:io for HTTPS requests.
35 parser.addOption('server', defaultsTo: 'https://pub.dartlang.org', 35 parser.addOption('server', defaultsTo: 'https://pub.dartlang.org',
36 help: 'The package server to which to upload this package'); 36 help: 'The package server to which to upload this package');
37 return parser; 37 return parser;
38 } 38 }
39 39
40 /// The URL of the server to which to upload the package. 40 /// The URL of the server to which to upload the package.
41 Uri get server => new Uri.fromString(commandOptions['server']); 41 Uri get server => Uri.parse(commandOptions['server']);
42 42
43 Future _publish(packageBytes) { 43 Future _publish(packageBytes) {
44 var cloudStorageUrl; 44 var cloudStorageUrl;
45 return oauth2.withClient(cache, (client) { 45 return oauth2.withClient(cache, (client) {
46 // TODO(nweiz): Cloud Storage can provide an XML-formatted error. We 46 // TODO(nweiz): Cloud Storage can provide an XML-formatted error. We
47 // should report that error and exit. 47 // should report that error and exit.
48 var newUri = server.resolve("/packages/versions/new.json"); 48 var newUri = server.resolve("/packages/versions/new.json");
49 return client.get(newUri).then((response) { 49 return client.get(newUri).then((response) {
50 var parameters = parseJsonResponse(response); 50 var parameters = parseJsonResponse(response);
51 51
52 var url = _expectField(parameters, 'url', response); 52 var url = _expectField(parameters, 'url', response);
53 if (url is! String) invalidServerResponse(response); 53 if (url is! String) invalidServerResponse(response);
54 cloudStorageUrl = new Uri.fromString(url); 54 cloudStorageUrl = Uri.parse(url);
55 var request = new http.MultipartRequest('POST', cloudStorageUrl); 55 var request = new http.MultipartRequest('POST', cloudStorageUrl);
56 56
57 var fields = _expectField(parameters, 'fields', response); 57 var fields = _expectField(parameters, 'fields', response);
58 if (fields is! Map) invalidServerResponse(response); 58 if (fields is! Map) invalidServerResponse(response);
59 fields.forEach((key, value) { 59 fields.forEach((key, value) {
60 if (value is! String) invalidServerResponse(response); 60 if (value is! String) invalidServerResponse(response);
61 request.fields[key] = value; 61 request.fields[key] = value;
62 }); 62 });
63 63
64 request.followRedirects = false; 64 request.followRedirects = false;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 var s = warnings.length == 1 ? '' : 's'; 177 var s = warnings.length == 1 ? '' : 's';
178 message = "Package has ${warnings.length} warning$s. Upload anyway"; 178 message = "Package has ${warnings.length} warning$s. Upload anyway";
179 } 179 }
180 180
181 return confirm(message).then((confirmed) { 181 return confirm(message).then((confirmed) {
182 if (!confirmed) throw "Package upload canceled."; 182 if (!confirmed) throw "Package upload canceled.";
183 }); 183 });
184 }); 184 });
185 } 185 }
186 } 186 }
OLDNEW
« no previous file with comments | « tests/utils/uri_test.dart ('k') | utils/pub/command_uploader.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698