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

Unified Diff: sdk/lib/_internal/pub/lib/src/command/global_activate.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/global_activate.dart
diff --git a/sdk/lib/_internal/pub/lib/src/command/global_activate.dart b/sdk/lib/_internal/pub/lib/src/command/global_activate.dart
deleted file mode 100644
index d4335c23c9105bd8c4a9ca0173b0c4b6c8817158..0000000000000000000000000000000000000000
--- a/sdk/lib/_internal/pub/lib/src/command/global_activate.dart
+++ /dev/null
@@ -1,103 +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.global_activate;
-
-import 'dart:async';
-
-import 'package:pub_semver/pub_semver.dart';
-
-import '../command.dart';
-import '../utils.dart';
-
-/// Handles the `global activate` pub command.
-class GlobalActivateCommand extends PubCommand {
- String get name => "activate";
- String get description => "Make a package's executables globally available.";
- String get invocation => "pub global activate <package...>";
-
- GlobalActivateCommand() {
- argParser.addOption("source",
- abbr: "s",
- help: "The source used to find the package.",
- allowed: ["git", "hosted", "path"],
- defaultsTo: "hosted");
-
- argParser.addFlag("no-executables", negatable: false,
- help: "Do not put executables on PATH.");
-
- argParser.addOption("executable", abbr: "x",
- help: "Executable(s) to place on PATH.",
- allowMultiple: true);
-
- argParser.addFlag("overwrite", negatable: false,
- help: "Overwrite executables from other packages with the same name.");
- }
-
- Future run() {
- // Default to `null`, which means all executables.
- var executables;
- if (argResults.wasParsed("executable")) {
- if (argResults.wasParsed("no-executables")) {
- usageException("Cannot pass both --no-executables and --executable.");
- }
-
- executables = argResults["executable"];
- } else if (argResults["no-executables"]) {
- // An empty list means no executables.
- executables = [];
- }
-
- var overwrite = argResults["overwrite"];
- var args = argResults.rest;
-
- readArg([String error]) {
- if (args.isEmpty) usageException(error);
- var arg = args.first;
- args = args.skip(1);
- return arg;
- }
-
- validateNoExtraArgs() {
- if (args.isEmpty) return;
- var unexpected = args.map((arg) => '"$arg"');
- var arguments = pluralize("argument", unexpected.length);
- usageException("Unexpected $arguments ${toSentence(unexpected)}.");
- }
-
- switch (argResults["source"]) {
- case "git":
- var repo = readArg("No Git repository given.");
- // TODO(rnystrom): Allow passing in a Git ref too.
- validateNoExtraArgs();
- return globals.activateGit(repo, executables,
- overwriteBinStubs: overwrite);
-
- case "hosted":
- var package = readArg("No package to activate given.");
-
- // Parse the version constraint, if there is one.
- var constraint = VersionConstraint.any;
- if (args.isNotEmpty) {
- try {
- constraint = new VersionConstraint.parse(readArg());
- } on FormatException catch (error) {
- usageException(error.message);
- }
- }
-
- validateNoExtraArgs();
- return globals.activateHosted(package, constraint, executables,
- overwriteBinStubs: overwrite);
-
- case "path":
- var path = readArg("No package to activate given.");
- validateNoExtraArgs();
- return globals.activatePath(path, executables,
- overwriteBinStubs: overwrite);
- }
-
- throw "unreachable";
- }
-}
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/command/global.dart ('k') | sdk/lib/_internal/pub/lib/src/command/global_deactivate.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698