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

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

Issue 19647002: Use PUB_HOSTED_SERVER to set server URL for pub tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 | sdk/lib/_internal/pub/test/install/switch_source_test.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 pub.source.hosted; 5 library pub.source.hosted;
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 10
(...skipping 13 matching lines...) Expand all
24 /// A package source that installs packages from a package hosting site that 24 /// A package source that installs packages from a package hosting site that
25 /// uses the same API as pub.dartlang.org. 25 /// uses the same API as pub.dartlang.org.
26 class HostedSource extends Source { 26 class HostedSource extends Source {
27 27
28 final name = "hosted"; 28 final name = "hosted";
29 final shouldCache = true; 29 final shouldCache = true;
30 30
31 /// Gets the default URL for the package server for hosted dependencies. 31 /// Gets the default URL for the package server for hosted dependencies.
32 static String get defaultUrl { 32 static String get defaultUrl {
33 var url = io.Platform.environment["PUB_HOSTED_URL"]; 33 var url = io.Platform.environment["PUB_HOSTED_URL"];
34 if (url != null) return url; 34 if (url != null) {
35 log.fine("Got server $url from PUB_HOSTED_URL.");
36 return url;
37 }
38
35 return "https://pub.dartlang.org"; 39 return "https://pub.dartlang.org";
36 } 40 }
37 41
38 /// Downloads a list of all versions of a package that are available from the 42 /// Downloads a list of all versions of a package that are available from the
39 /// site. 43 /// site.
40 Future<List<Version>> getVersions(String name, description) { 44 Future<List<Version>> getVersions(String name, description) {
41 var url = _makeUrl(description, 45 var url = _makeUrl(description,
42 (server, package) => "$server/api/packages/$package"); 46 (server, package) => "$server/api/packages/$package");
43 47
44 log.io("Get versions from $url."); 48 log.io("Get versions from $url.");
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 var name = description["name"]; 262 var name = description["name"];
259 if (name is! String) { 263 if (name is! String) {
260 throw new FormatException("The 'name' key must have a string value."); 264 throw new FormatException("The 'name' key must have a string value.");
261 } 265 }
262 266
263 var url = description["url"]; 267 var url = description["url"];
264 if (url == null) url = HostedSource.defaultUrl; 268 if (url == null) url = HostedSource.defaultUrl;
265 269
266 return new Pair<String, String>(name, url); 270 return new Pair<String, String>(name, url);
267 } 271 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/test/install/switch_source_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698