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

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

Issue 18878005: add option to pick up hosted url from an anvironment variable (Closed) Base URL: http://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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/command/uploader.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub/lib/src/source/hosted.dart
===================================================================
--- sdk/lib/_internal/pub/lib/src/source/hosted.dart (revision 25008)
+++ sdk/lib/_internal/pub/lib/src/source/hosted.dart (working copy)
@@ -24,12 +24,17 @@
/// A package source that installs packages from a package hosting site that
/// uses the same API as pub.dartlang.org.
class HostedSource extends Source {
- /// The URL of the default package repository.
- static const DEFAULT_URL = "https://pub.dartlang.org";
final name = "hosted";
final shouldCache = true;
+ /// Gets the default URL for the package server for hosted dependencies.
+ static String get defaultUrl {
+ var url = io.Platform.environment["PUB_HOSTED_URL"];
+ if (url != null) return url;
+ return "https://pub.dartlang.org";
+ }
+
/// Downloads a list of all versions of a package that are available from the
/// site.
Future<List<Version>> getVersions(String name, description) {
@@ -125,7 +130,7 @@
}
List<Package> getCachedPackages([String url]) {
- if (url == null) url = DEFAULT_URL;
+ if (url == null) url = defaultUrl;
var cacheDir = path.join(systemCacheRoot,
_getSourceDirectory(url));
@@ -237,7 +242,7 @@
/// this throws a descriptive FormatException.
Pair<String, String> _parseDescription(description) {
if (description is String) {
- return new Pair<String, String>(description, HostedSource.DEFAULT_URL);
+ return new Pair<String, String>(description, HostedSource.defaultUrl);
}
if (description is! Map) {
@@ -256,7 +261,7 @@
}
var url = description["url"];
- if (url == null) url = HostedSource.DEFAULT_URL;
+ if (url == null) url = HostedSource.defaultUrl;
return new Pair<String, String>(name, url);
}
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/command/uploader.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698