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

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

Issue 448933002: Support Git in pub global activate. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise! Created 6 years, 4 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
index 98ba40e52d2c9fd87929e3c59cda7827ba8a57c0..8448af58e84ce72f61a0b730b6d3784ae7f1e9c1 100644
--- a/sdk/lib/_internal/pub/lib/src/command/global_activate.dart
+++ b/sdk/lib/_internal/pub/lib/src/command/global_activate.dart
@@ -20,7 +20,7 @@ class GlobalActivateCommand extends PubCommand {
commandParser.addOption("source",
abbr: "s",
help: "The source used to find the package.",
- allowed: ["hosted", "path"],
+ allowed: ["git", "hosted", "path"],
defaultsTo: "hosted");
}
@@ -41,10 +41,16 @@ class GlobalActivateCommand extends PubCommand {
usageError("Unexpected $arguments ${toSentence(unexpected)}.");
}
- var package = readArg("No package to activate given.");
-
switch (commandOptions["source"]) {
+ case "git":
+ var repo = readArg("No Git repository given.");
+ // TODO(rnystrom): Allow passing in a Git ref too.
+ validateNoExtraArgs();
+ return globals.activateGit(repo);
+
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) {
@@ -59,8 +65,9 @@ class GlobalActivateCommand extends PubCommand {
return globals.activateHosted(package, constraint);
case "path":
+ var path = readArg("No package to activate given.");
validateNoExtraArgs();
- return globals.activatePath(package);
+ return globals.activatePath(path);
}
throw "unreachable";
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/lib/src/global_packages.dart » ('j') | sdk/lib/_internal/pub/lib/src/source/git.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698