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

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

Issue 557563002: Store the async-await compiled pub code directly in the repo. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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/lib/src/command/uploader.dart b/sdk/lib/_internal/pub_generated/lib/src/command/uploader.dart
similarity index 63%
copy from sdk/lib/_internal/pub/lib/src/command/uploader.dart
copy to sdk/lib/_internal/pub_generated/lib/src/command/uploader.dart
index 0324dcbb92127171674a1299eca65c58cc995772..64f8d0146aa122d516fd1b98690c9f478ae150d6 100644
--- a/sdk/lib/_internal/pub/lib/src/command/uploader.dart
+++ b/sdk/lib/_internal/pub_generated/lib/src/command/uploader.dart
@@ -1,13 +1,6 @@
-// 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;
@@ -17,36 +10,30 @@ import '../log.dart' as log;
import '../oauth2.dart' as oauth2;
import '../source/hosted.dart';
import '../utils.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', defaultsTo: HostedSource.defaultUrl,
+ commandParser.addOption(
+ 'server',
+ defaultsTo: HostedSource.defaultUrl,
help: 'The package server on which the package is hosted.');
- commandParser.addOption('package',
+ commandParser.addOption(
+ 'package',
help: 'The package whose uploaders will be modified.\n'
- '(defaults to the current package)');
+ '(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".');
@@ -57,7 +44,6 @@ class UploaderCommand extends PubCommand {
this.printUsage();
return flushThenExit(exit_codes.USAGE);
}
-
return syncFuture(() {
var package = commandOptions['package'];
if (package != null) return package;
@@ -66,20 +52,21 @@ class UploaderCommand extends PubCommand {
var uploader = rest[0];
return oauth2.withClient(cache, (client) {
if (command == 'add') {
- var url = server.resolve("/api/packages/"
- "${Uri.encodeComponent(package)}/uploaders");
- return client.post(url,
- headers: PUB_API_HEADERS,
- body: {"email": uploader});
- } else { // command == 'remove'
- var url = server.resolve("/api/packages/"
- "${Uri.encodeComponent(package)}/uploaders/"
- "${Uri.encodeComponent(uploader)}");
+ var url =
+ server.resolve("/api/packages/" "${Uri.encodeComponent(package)}/uploaders");
+ return client.post(url, headers: PUB_API_HEADERS, body: {
+ "email": uploader
+ });
+ } else {
+ var url = server.resolve(
+ "/api/packages/" "${Uri.encodeComponent(package)}/uploaders/"
+ "${Uri.encodeComponent(uploader)}");
return client.delete(url, headers: PUB_API_HEADERS);
}
});
- }).then(handleJsonSuccess)
- .catchError((error) => handleJsonError(error.response),
- test: (e) => e is PubHttpException);
+ }).then(
+ handleJsonSuccess).catchError(
+ (error) => handleJsonError(error.response),
+ test: (e) => e is PubHttpException);
}
}

Powered by Google App Engine
This is Rietveld 408576698