| 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..fb0a8423390ce0c8568814eb6e3ee2368fed516c 100644
|
| --- a/sdk/lib/_internal/pub/lib/src/command.dart
|
| +++ b/sdk/lib/_internal/pub/lib/src/command.dart
|
| @@ -69,9 +69,13 @@ 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.
|
| + /// This will only be called before the [SystemCache] is created. After that,
|
| + /// it has no effect.
|
| + bool get isOffline => false;
|
| +
|
| + void run(String cacheDir, ArgResults globalOptions_,
|
| List<String> commandArgs) {
|
| - cache = cache_;
|
| globalOptions = globalOptions_;
|
|
|
| try {
|
| @@ -82,6 +86,8 @@ abstract class PubCommand {
|
| exit(exit_codes.USAGE);
|
| }
|
|
|
| + cache = new SystemCache.withSources(cacheDir, isOffline: isOffline);
|
| +
|
| handleError(error) {
|
| var trace = getAttachedStackTrace(error);
|
|
|
| @@ -139,7 +145,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}.';
|
|
|