Chromium Code Reviews| Index: sdk/lib/_internal/pub/lib/src/command.dart |
| diff --git a/sdk/lib/_internal/pub/lib/src/command.dart b/sdk/lib/_internal/pub/lib/src/command.dart |
| index 21ad9b6cb23e5c2605e52b369e4e78dca2a72eb3..d12e7e2a0a423498266d4d315ff43f701500eae2 100644 |
| --- a/sdk/lib/_internal/pub/lib/src/command.dart |
| +++ b/sdk/lib/_internal/pub/lib/src/command.dart |
| @@ -69,9 +69,11 @@ abstract class PubCommand { |
| /// available in [commandOptions]. |
| ArgParser get commandParser => new ArgParser(); |
| - void run(SystemCache cache_, ArgResults globalOptions_, |
| + /// Override this to use offline-only sources instead of hitting the network. |
|
nweiz
2013/05/06 23:02:25
It's a little confusing that this only has an effe
Bob Nystrom
2013/05/07 21:03:09
Done.
|
| + bool get isOffline => false; |
| + |
| + void run(String cacheDir, ArgResults globalOptions_, |
| List<String> commandArgs) { |
| - cache = cache_; |
| globalOptions = globalOptions_; |
| try { |
| @@ -82,6 +84,8 @@ abstract class PubCommand { |
| exit(exit_codes.USAGE); |
| } |
| + cache = new SystemCache.withSources(cacheDir, isOffline: isOffline); |
| + |
| handleError(error) { |
| var trace = getAttachedStackTrace(error); |
| @@ -139,7 +143,7 @@ and include the results in a bug report on http://dartbug.com/new. |
| if (commandFuture == null) return true; |
| return commandFuture; |
| - }).whenComplete(() => cache_.deleteTempDir()).catchError((e) { |
| + }).whenComplete(() => cache.deleteTempDir()).catchError((e) { |
| if (e is PubspecNotFoundException && e.name == null) { |
| e = 'Could not find a file named "pubspec.yaml" in the directory ' |
| '${path.current}.'; |