Chromium Code Reviews| Index: utils/pub/system_cache.dart |
| diff --git a/utils/pub/system_cache.dart b/utils/pub/system_cache.dart |
| index 634dc173257b0e9742a549f86e6903fae9b855be..cd151f4f7518f0791f70659e5d98678ea763dd65 100644 |
| --- a/utils/pub/system_cache.dart |
| +++ b/utils/pub/system_cache.dart |
| @@ -62,17 +62,21 @@ class SystemCache { |
| /// Gets the package identified by [id]. If the package is already cached, |
| /// reads it from the cache. Otherwise, requests it from the source. |
| - Future<Package> describe(PackageId id) { |
| - Future<Package> getUncached() { |
| + Future<Pubspec> describe(PackageId id) { |
| + Future<Pubspec> getUncached() { |
|
nweiz
2013/02/02 00:15:29
This probably doesn't need to be a separate functi
Bob Nystrom
2013/02/02 00:47:10
Done.
|
| // Not cached, so get it from the source. |
| - return id.describe().then((pubspec) => new Package.inMemory(pubspec)); |
| + return id.describe(); |
| } |
| // Try to get it from the system cache first. |
| if (id.source.shouldCache) { |
| return id.systemCacheDirectory.then((packageDir) { |
| if (!dirExistsSync(packageDir)) return getUncached(); |
| - return Package.load(id.name, packageDir, sources); |
| + // TODO(rnystrom): Going through Package for this is a bit weird. |
| + // Once Package loading is synchronous, should give Pubspec itself a |
| + // constructor that loads the file. |
| + return Package.load(id.name, packageDir, sources) |
| + .then((package) => package.pubspec);; |
|
nweiz
2013/02/02 00:15:29
Style nit: extra semicolon
Bob Nystrom
2013/02/02 00:47:10
Done.
|
| }); |
| } |