OLD | NEW |
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('dartlang_source'); | 5 #library('dartlang_source'); |
6 | 6 |
7 #import('dart:io'); | 7 #import('dart:io'); |
8 #import('dart:json'); | 8 #import('dart:json'); |
9 #import('dart:uri'); | 9 #import('dart:uri'); |
10 #import('io.dart'); | 10 #import('io.dart'); |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 final bool shouldCache = true; | 25 final bool shouldCache = true; |
26 | 26 |
27 // TODO(nweiz): update this comment once pub.dartlang.org is online | 27 // TODO(nweiz): update this comment once pub.dartlang.org is online |
28 /** | 28 /** |
29 * The URL of the default package repository. | 29 * The URL of the default package repository. |
30 * | 30 * |
31 * At time of writing, pub.dartlang.org is not yet online, but it should be | 31 * At time of writing, pub.dartlang.org is not yet online, but it should be |
32 * soon. | 32 * soon. |
33 */ | 33 */ |
34 static final String defaultUrl = "http://pub.dartlang.org"; | 34 static const String defaultUrl = "http://pub.dartlang.org"; |
35 | 35 |
36 RepoSource(); | 36 RepoSource(); |
37 | 37 |
38 /** | 38 /** |
39 * Downloads a list of all versions of a package that have been uploaded to | 39 * Downloads a list of all versions of a package that have been uploaded to |
40 * pub.dartlang.org. | 40 * pub.dartlang.org. |
41 */ | 41 */ |
42 Future<List<Version>> getVersions(description) { | 42 Future<List<Version>> getVersions(description) { |
43 var parsed = _parseDescription(description); | 43 var parsed = _parseDescription(description); |
44 var fullUrl = "${parsed.last}/packages/${parsed.first}.json"; | 44 var fullUrl = "${parsed.last}/packages/${parsed.first}.json"; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 131 |
132 var name = description["name"]; | 132 var name = description["name"]; |
133 if (name is! String) { | 133 if (name is! String) { |
134 throw new FormatException("The 'name' key must have a string value."); | 134 throw new FormatException("The 'name' key must have a string value."); |
135 } | 135 } |
136 | 136 |
137 var url = description.containsKey("url") ? description["url"] : defaultUrl; | 137 var url = description.containsKey("url") ? description["url"] : defaultUrl; |
138 return new Pair<String, String>(name, url); | 138 return new Pair<String, String>(name, url); |
139 } | 139 } |
140 } | 140 } |
OLD | NEW |