Index: sdk/lib/_internal/pub/lib/src/command/lish.dart |
diff --git a/sdk/lib/_internal/pub/lib/src/command/lish.dart b/sdk/lib/_internal/pub/lib/src/command/lish.dart |
index a58ae3c6ad73ddf9ae8947da0f1f670857c032a6..207552ad7bb96abe73a095876e2592c553719839 100644 |
--- a/sdk/lib/_internal/pub/lib/src/command/lish.dart |
+++ b/sdk/lib/_internal/pub/lib/src/command/lish.dart |
@@ -26,7 +26,20 @@ class LishCommand extends PubCommand { |
List<String> get aliases => const ["lish", "lush"]; |
/// The URL of the server to which to upload the package. |
- Uri get server => Uri.parse(commandOptions['server']); |
+ Uri get server { |
+ // An explicit argument takes precedence. |
+ if (commandOptions.wasParsed('server')) { |
+ return Uri.parse(commandOptions['server']); |
+ } |
+ |
+ // Otherwise, use the one specified in the pubspec. |
+ if (entrypoint.root.pubspec.publishTo != null) { |
+ return Uri.parse(entrypoint.root.pubspec.publishTo); |
+ } |
+ |
+ // Otherwise, use the default. |
+ return Uri.parse(HostedSource.defaultUrl); |
+ } |
/// Whether the publish is just a preview. |
bool get dryRun => commandOptions['dry-run']; |
@@ -98,6 +111,10 @@ class LishCommand extends PubCommand { |
usageError('Cannot use both --force and --dry-run.'); |
} |
+ if (entrypoint.root.pubspec.isPrivate) { |
+ dataError("A private package cannot be published."); |
nweiz
2014/08/01 01:12:13
Consider associating this with the "publishTo" spa
Bob Nystrom
2014/08/04 21:16:43
Didn't add the span, but did mention "publishTo" i
|
+ } |
+ |
var files = entrypoint.root.listFiles(); |
log.fine('Archiving and publishing ${entrypoint.root}.'); |