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

Unified Diff: utils/pub/source.dart

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 | « utils/pub/sdk_source.dart ('k') | utils/pub/system_cache.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/source.dart
diff --git a/utils/pub/source.dart b/utils/pub/source.dart
index 637cdd6950d26ae49f1015a583c2aba1484300a0..211f0dbad4dc342350d9714ee83e5d18d38858f0 100644
--- a/utils/pub/source.dart
+++ b/utils/pub/source.dart
@@ -4,6 +4,7 @@
library source;
+import 'dart:async';
import 'io.dart';
import 'package.dart';
import 'pubspec.dart';
@@ -64,7 +65,7 @@ abstract class Source {
/// uses [describe] to get that version.
Future<List<Version>> getVersions(String name, description) {
return describe(new PackageId(name, this, Version.none, description))
- .transform((pubspec) => [pubspec.version]);
+ .then((pubspec) => [pubspec.version]);
}
/// Loads the (possibly remote) pubspec for the package version identified by
@@ -76,7 +77,7 @@ abstract class Source {
/// must implement it manually.
Future<Pubspec> describe(PackageId id) {
if (!shouldCache) throw "Source $name must implement describe(id).";
- return installToSystemCache(id).transform((package) => package.pubspec);
+ return installToSystemCache(id).then((package) => package.pubspec);
}
/// Installs the package identified by [id] to [path]. Returns a [Future] that
@@ -104,10 +105,10 @@ abstract class Source {
/// By default, this uses [systemCacheDirectory] and [install].
Future<Package> installToSystemCache(PackageId id) {
var path = systemCacheDirectory(id);
- return exists(path).chain((exists) {
+ return exists(path).then((exists) {
if (exists) return new Future<bool>.immediate(true);
- return ensureDir(dirname(path)).chain((_) => install(id, path));
- }).chain((found) {
+ return ensureDir(dirname(path)).then((_) => install(id, path));
+ }).then((found) {
if (!found) throw 'Package $id not found.';
return Package.load(id.name, path, systemCache.sources);
});
« no previous file with comments | « utils/pub/sdk_source.dart ('k') | utils/pub/system_cache.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698