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

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

Issue 417043005: Add publishTo to pubspec and use it in pub lish. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 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/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}.');
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/lib/src/pubspec.dart » ('j') | sdk/lib/_internal/pub/lib/src/pubspec.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698