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

Unified Diff: utils/pub/system_cache.dart

Issue 14241005: Use the cached pubspec if possible for describing hosted packages. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Redo after realizing SystemCache already has this logic. Created 7 years, 8 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/package.dart ('k') | utils/tests/pub/command_line_config.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/system_cache.dart
diff --git a/utils/pub/system_cache.dart b/utils/pub/system_cache.dart
index 4c0e1760212e1c40e40eeff1b17c0a54bf883388..8a51912a6eb40de1247d4f5d47a647ee98579144 100644
--- a/utils/pub/system_cache.dart
+++ b/utils/pub/system_cache.dart
@@ -70,13 +70,16 @@ class SystemCache {
// Try to get it from the system cache first.
if (id.source.shouldCache) {
return id.systemCacheDirectory.then((packageDir) {
- if (!dirExists(packageDir)) return id.describe();
+ if (!fileExists(path.join(packageDir, "pubspec.yaml"))) {
+ return id.source.describe(id);
+ }
+
return new Pubspec.load(id.name, packageDir, sources);
});
}
// Not cached, so get it from the source.
- return id.describe();
+ return id.source.describe(id);
}
/// Ensures that the package identified by [id] is installed to the cache,
« no previous file with comments | « utils/pub/package.dart ('k') | utils/tests/pub/command_line_config.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698