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

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

Issue 11865005: Remove Futures class, move methods to Future. (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 | « utils/pub/entrypoint.dart ('k') | utils/pub/io.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 hosted_source; 5 library hosted_source;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io' as io; 8 import 'dart:io' as io;
9 import 'dart:json' as json; 9 import 'dart:json' as json;
10 import 'dart:uri'; 10 import 'dart:uri';
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 var parsedDescription = _parseDescription(id.description); 65 var parsedDescription = _parseDescription(id.description);
66 var name = parsedDescription.first; 66 var name = parsedDescription.first;
67 var url = parsedDescription.last; 67 var url = parsedDescription.last;
68 68
69 var fullUrl = "$url/packages/$name/versions/${id.version}.tar.gz"; 69 var fullUrl = "$url/packages/$name/versions/${id.version}.tar.gz";
70 70
71 log.message('Downloading $id...'); 71 log.message('Downloading $id...');
72 72
73 // Download and extract the archive to a temp directory. 73 // Download and extract the archive to a temp directory.
74 var tempDir; 74 var tempDir;
75 return Futures.wait([ 75 return Future.wait([
76 httpClient.send(new http.Request("GET", new Uri.fromString(fullUrl))) 76 httpClient.send(new http.Request("GET", new Uri.fromString(fullUrl)))
77 .then((response) => response.stream), 77 .then((response) => response.stream),
78 systemCache.createTempDir() 78 systemCache.createTempDir()
79 ]).then((args) { 79 ]).then((args) {
80 var stream = streamToInputStream(args[0]); 80 var stream = streamToInputStream(args[0]);
81 tempDir = args[1]; 81 tempDir = args[1];
82 return timeout(extractTarGz(stream, tempDir), HTTP_TIMEOUT, 82 return timeout(extractTarGz(stream, tempDir), HTTP_TIMEOUT,
83 'fetching URL "$fullUrl"'); 83 'fetching URL "$fullUrl"');
84 }).then((_) { 84 }).then((_) {
85 // Now that the install has succeeded, move it to the real location in 85 // Now that the install has succeeded, move it to the real location in
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 160
161 var name = description["name"]; 161 var name = description["name"];
162 if (name is! String) { 162 if (name is! String) {
163 throw new FormatException("The 'name' key must have a string value."); 163 throw new FormatException("The 'name' key must have a string value.");
164 } 164 }
165 165
166 var url = description.containsKey("url") ? description["url"] : defaultUrl; 166 var url = description.containsKey("url") ? description["url"] : defaultUrl;
167 return new Pair<String, String>(name, url); 167 return new Pair<String, String>(name, url);
168 } 168 }
169 } 169 }
OLDNEW
« no previous file with comments | « utils/pub/entrypoint.dart ('k') | utils/pub/io.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698