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

Unified Diff: sdk/lib/_internal/pub/lib/src/system_cache.dart

Issue 14680005: Add offline support to pub install and update. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/hosted_source.dart ('k') | sdk/lib/_internal/pub/test/descriptor.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub/lib/src/system_cache.dart
diff --git a/sdk/lib/_internal/pub/lib/src/system_cache.dart b/sdk/lib/_internal/pub/lib/src/system_cache.dart
index 8a51912a6eb40de1247d4f5d47a647ee98579144..567803bbe46e95f3c544d8b4ca0dde4eed4d0268 100644
--- a/sdk/lib/_internal/pub/lib/src/system_cache.dart
+++ b/sdk/lib/_internal/pub/lib/src/system_cache.dart
@@ -45,11 +45,19 @@ class SystemCache {
: _pendingInstalls = new Map<PackageId, Future<Package>>(),
sources = new SourceRegistry();
- /// Creates a system cache and registers the standard set of sources.
- factory SystemCache.withSources(String rootDir) {
+ /// Creates a system cache and registers the standard set of sources. If
+ /// [isOffline] is `true`, then the offline hosted source will be used.
+ /// Defaults to `false`.
+ factory SystemCache.withSources(String rootDir, {bool isOffline: false}) {
var cache = new SystemCache(rootDir);
cache.register(new GitSource());
- cache.register(new HostedSource());
+
+ if (isOffline) {
+ cache.register(new OfflineHostedSource());
+ } else {
+ cache.register(new HostedSource());
+ }
+
cache.register(new PathSource());
cache.sources.setDefault('hosted');
return cache;
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/hosted_source.dart ('k') | sdk/lib/_internal/pub/test/descriptor.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698