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

Unified Diff: pkg/pubserver/lib/repository.dart

Issue 917793002: Use pub_server package (Closed) Base URL: git@github.com:dart-lang/pub-dartlang-dart.git@master
Patch Set: Created 5 years, 10 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 | « pkg/pub_server/test/shelf_pubserver_test.dart ('k') | pkg/pubserver/lib/shelf_pubserver.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/pubserver/lib/repository.dart
diff --git a/pkg/pubserver/lib/repository.dart b/pkg/pubserver/lib/repository.dart
deleted file mode 100644
index 26fa1a6de04c03207db8f551e9d98d45b57e1beb..0000000000000000000000000000000000000000
--- a/pkg/pubserver/lib/repository.dart
+++ /dev/null
@@ -1,119 +0,0 @@
-// Copyright (c) 2014, 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 pubserver.repository;
-
-import 'dart:async';
-
-import 'package:pub_semver/pub_semver.dart';
-
-/// Represents information about a specific version of a pub package.
-class PackageVersion {
- /// The name of the package.
- final String packageName;
-
- /// The version string of the package.
- final String versionString;
-
- /// The pubspec yaml file of the package
- final String pubspecYaml;
-
- Version _cached;
-
- /// The version of the package as a [Version] object.
- Version get version {
- if (_cached != null) return _cached;
- _cached = new Version.parse(versionString);
- return _cached;
- }
-
- PackageVersion(this.packageName, this.versionString, this.pubspecYaml);
-
- int get hashCode =>
- packageName.hashCode ^ versionString.hashCode ^ pubspecYaml.hashCode;
-
- bool operator==(other) {
- return other is PackageVersion &&
- other.packageName == packageName &&
- other.versionString == versionString &&
- other.pubspecYaml == pubspecYaml;
- }
-
- String toString() => 'PackageVersion: $packageName/$versionString';
-}
-
-
-/// Information obtained when starting an asynchronous upload.
-class AsyncUploadInfo {
- /// The endpoint where the uploaded data should be posted.
- ///
- /// The upload is a POST to [uri] with the headers [fields] in the HTTP
- /// request. The body of the POST request must be a valid tar.gz file.
- final Uri uri;
-
- /// The fields the uploader should add to the multipart upload.
- final Map<String, String> fields;
-
- AsyncUploadInfo(this.uri, this.fields);
-}
-
-/// Exception for unauthorized access attempts.
-///
-/// Uploading a new package from an unauthorized user will result in an
-/// [UnauthorizedAccess] exception.
-class UnauthorizedAccess implements Exception {
- final String message;
-
- UnauthorizedAccess(this.message);
-
- String toString() => 'UnauthorizedAccess: $message';
-}
-
-/// Represents a pub repository.
-abstract class PackageRepository {
- /// Returns the known versions of [package].
- Stream<PackageVersion> versions(String package);
-
- /// Whether the [version] of [package] exists.
- Future<PackageVersion> lookupVersion(String package, String version);
-
-
- /// Whether this package repository supports uploading packages.
- bool get supportsUpload => false;
-
- /// Uploads a new pub package.
- ///
- /// [data] must be a stream of a valid .tar.gz file.
- Future upload(Stream<List<int>> data)
- => new Future.error(new UnsupportedError('No upload support.'));
-
- /// Whether this package repository supports asynchronous uploads.
- bool get supportsAsyncUpload => false;
-
- /// Starts a new upload.
- ///
- /// The given [baseRedirectUrl] instructs the uploading client to make a GET
- /// request to this location once the upload is complete. It might contain
- /// additional query parameters and must be supplied to `finishAsyncUpload`.
- ///
- /// The returned [AsyncUploadInfo] specifies where the tar.gz file should be
- /// posted to and what headers should be supplied.
- Future<AsyncUploadInfo> startAsyncUpload(Uri redirectUrl)
- => new Future.error(new UnsupportedError('No async upload support.'));
-
- /// Finishes the upload of a package.
- Future finishAsyncUpload(Uri uri)
- => new Future.error(new UnsupportedError('No async upload support.'));
-
-
- /// Downloads a pub package.
- Future<Stream> download(String package, String version);
-
- /// Whether this package repository supports download URLs.
- bool get supportsDownloadUrl => false;
-
- /// A permanent download URL to a package (if supported).
- Future<Uri> downloadUrl(String package, String version)
- => new Future.error(new UnsupportedError('No download link support.'));
-}
« no previous file with comments | « pkg/pub_server/test/shelf_pubserver_test.dart ('k') | pkg/pubserver/lib/shelf_pubserver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698