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

Side by Side Diff: sdk/lib/_internal/pub/lib/src/hosted_source.dart

Issue 15184003: Add additional Schedule heartbeat calls. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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 | « pkg/scheduled_test/lib/scheduled_process.dart ('k') | sdk/lib/_internal/pub/lib/src/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 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 18 matching lines...) Expand all
29 final shouldCache = true; 29 final shouldCache = true;
30 30
31 /// Downloads a list of all versions of a package that are available from the 31 /// Downloads a list of all versions of a package that are available from the
32 /// site. 32 /// site.
33 Future<List<Version>> getVersions(String name, description) { 33 Future<List<Version>> getVersions(String name, description) {
34 var url = _makeUrl(description, 34 var url = _makeUrl(description,
35 (server, package) => "$server/packages/$package.json"); 35 (server, package) => "$server/packages/$package.json");
36 36
37 log.io("Get versions from $url."); 37 log.io("Get versions from $url.");
38 return httpClient.read(url).then((body) { 38 return httpClient.read(url).then((body) {
39 log.io("Versions JSON from $url: $body.");
40 var doc = json.parse(body); 39 var doc = json.parse(body);
41 var versions = doc['versions'] 40 return doc['versions']
42 .map((version) => new Version.parse(version)) 41 .map((version) => new Version.parse(version))
43 .toList(); 42 .toList();
44 log.io("Versions from $url: $versions.");
45 return versions;
46 }).catchError((ex) { 43 }).catchError((ex) {
47 var parsed = _parseDescription(description); 44 var parsed = _parseDescription(description);
48 _throwFriendlyError(ex, parsed.first, parsed.last); 45 _throwFriendlyError(ex, parsed.first, parsed.last);
49 }); 46 });
50 } 47 }
51 48
52 /// Downloads and parses the pubspec for a specific version of a package that 49 /// Downloads and parses the pubspec for a specific version of a package that
53 /// is available from the site. 50 /// is available from the site.
54 Future<Pubspec> describe(PackageId id) { 51 Future<Pubspec> describe(PackageId id) {
55 // Request it from the server. 52 // Request it from the server.
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 } 250 }
254 251
255 var name = description["name"]; 252 var name = description["name"];
256 if (name is! String) { 253 if (name is! String) {
257 throw new FormatException("The 'name' key must have a string value."); 254 throw new FormatException("The 'name' key must have a string value.");
258 } 255 }
259 256
260 var url = description.containsKey("url") ? description["url"] : _defaultUrl; 257 var url = description.containsKey("url") ? description["url"] : _defaultUrl;
261 return new Pair<String, String>(name, url); 258 return new Pair<String, String>(name, url);
262 } 259 }
OLDNEW
« no previous file with comments | « pkg/scheduled_test/lib/scheduled_process.dart ('k') | sdk/lib/_internal/pub/lib/src/http.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698