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

Unified Diff: sdk/lib/_internal/pub_generated/lib/src/command/uploader.dart

Issue 657673002: Regenerate pub sources. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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_generated/lib/src/command/uploader.dart
diff --git a/sdk/lib/_internal/pub_generated/lib/src/command/uploader.dart b/sdk/lib/_internal/pub_generated/lib/src/command/uploader.dart
index 5e6e76aff1e882c8584a9df57947d1a01ac65e83..20c8c98a804e5da97421e03594528dc5b1bb90be 100644
--- a/sdk/lib/_internal/pub_generated/lib/src/command/uploader.dart
+++ b/sdk/lib/_internal/pub_generated/lib/src/command/uploader.dart
@@ -1,6 +1,13 @@
+// Copyright (c) 2012, 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.uploader;
+
import 'dart:async';
+
import 'package:path/path.dart' as path;
+
import '../command.dart';
import '../entrypoint.dart';
import '../exit_codes.dart' as exit_codes;
@@ -9,13 +16,18 @@ import '../io.dart';
import '../log.dart' as log;
import '../oauth2.dart' as oauth2;
import '../source/hosted.dart';
+
+/// Handles the `uploader` pub command.
class UploaderCommand extends PubCommand {
String get description =>
"Manage uploaders for a package on pub.dartlang.org.";
String get usage => "pub uploader [options] {add/remove} <email>";
String get docUrl => "http://dartlang.org/tools/pub/cmd/pub-uploader.html";
bool get takesArguments => true;
+
+ /// The URL of the package hosting server.
Uri get server => Uri.parse(commandOptions['server']);
+
UploaderCommand() {
commandParser.addOption(
'server',
@@ -26,13 +38,17 @@ class UploaderCommand extends PubCommand {
help: 'The package whose uploaders will be modified.\n'
'(defaults to the current package)');
}
+
Future onRun() {
if (commandOptions.rest.isEmpty) {
log.error('No uploader command given.');
this.printUsage();
return flushThenExit(exit_codes.USAGE);
}
+
var rest = commandOptions.rest.toList();
+
+ // TODO(rnystrom): Use subcommands for these.
var command = rest.removeAt(0);
if (!['add', 'remove'].contains(command)) {
log.error('Unknown uploader command "$command".');
@@ -43,6 +59,7 @@ class UploaderCommand extends PubCommand {
this.printUsage();
return flushThenExit(exit_codes.USAGE);
}
+
return new Future.sync(() {
var package = commandOptions['package'];
if (package != null) return package;
@@ -56,7 +73,7 @@ class UploaderCommand extends PubCommand {
return client.post(url, headers: PUB_API_HEADERS, body: {
"email": uploader
});
- } else {
+ } else { // command == 'remove'
var url = server.resolve(
"/api/packages/" "${Uri.encodeComponent(package)}/uploaders/"
"${Uri.encodeComponent(uploader)}");

Powered by Google App Engine
This is Rietveld 408576698