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

Unified Diff: sdk/lib/_internal/pub/lib/src/command/cache_repair.dart

Issue 1165473002: Start pulling pub from its own repo. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Code review changes Created 5 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
Index: sdk/lib/_internal/pub/lib/src/command/cache_repair.dart
diff --git a/sdk/lib/_internal/pub/lib/src/command/cache_repair.dart b/sdk/lib/_internal/pub/lib/src/command/cache_repair.dart
deleted file mode 100644
index 3e130e96904d6fa468a57b15a94a7f4011335d51..0000000000000000000000000000000000000000
--- a/sdk/lib/_internal/pub/lib/src/command/cache_repair.dart
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.command.cache_repair;
-
-import 'dart:async';
-
-import '../command.dart';
-import '../exit_codes.dart' as exit_codes;
-import '../io.dart';
-import '../log.dart' as log;
-import '../source/cached.dart';
-import '../utils.dart';
-
-/// Handles the `cache repair` pub command.
-class CacheRepairCommand extends PubCommand {
- String get name => "repair";
- String get description => "Reinstall cached packages.";
- String get invocation => "pub cache repair";
- String get docUrl => "http://dartlang.org/tools/pub/cmd/pub-cache.html";
- bool get takesArguments => false;
-
- Future run() async {
- var successes = 0;
- var failures = 0;
-
- // Repair every cached source.
- for (var source in cache.sources) {
- if (source is! CachedSource) continue;
-
- var results = await source.repairCachedPackages();
- successes += results.first;
- failures += results.last;
- }
-
- if (successes > 0) {
- var packages = pluralize("package", successes);
- log.message("Reinstalled ${log.green(successes)} $packages.");
- }
-
- if (failures > 0) {
- var packages = pluralize("package", failures);
- log.message("Failed to reinstall ${log.red(failures)} $packages.");
- }
-
- var results = await globals.repairActivatedPackages();
- if (results.first > 0) {
- var packages = pluralize("package", results.first);
- log.message("Reactivated ${log.green(results.first)} $packages.");
- }
-
- if (results.last > 0) {
- var packages = pluralize("package", results.last);
- log.message("Failed to reactivate ${log.red(results.last)} $packages.");
- }
-
- if (successes == 0 && failures == 0) {
- log.message("No packages in cache, so nothing to repair.");
- }
-
- if (failures > 0) await flushThenExit(exit_codes.UNAVAILABLE);
- }
-}
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/command/cache_list.dart ('k') | sdk/lib/_internal/pub/lib/src/command/deps.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698