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

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: 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
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/lib/src/pubspec.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..8263505637c2c02ab753c154a1dfa88871afb276 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,12 @@ class LishCommand extends PubCommand {
usageError('Cannot use both --force and --dry-run.');
}
+ if (entrypoint.root.pubspec.isPrivate) {
+ dataError('A private package cannot be published.\n'
+ 'You can enable this by changing the "publishTo" field in your '
+ 'pubspec.');
+ }
+
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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698