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

Unified Diff: utils/pub/source.dart

Issue 10695132: Reverting 9527 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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/git_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 236aa9a5eb2897c8637bbfa3ccf42805cb957c61..21144ce3ea8c56405cce0d50bc4db5993d20c866 100644
--- a/utils/pub/source.dart
+++ b/utils/pub/source.dart
@@ -95,42 +95,15 @@ class Source {
*
* [path] is guaranteed not to exist, and its parent directory is guaranteed
* to exist.
- *
- * This doesn't need to be implemented if [installToSystemCache] is
- * implemented.
*/
- Future<bool> install(PackageId id, String path) {
- throw "Either install or installToSystemCache must be implemented for "
- "source $name."
- }
-
- /**
- * Installs the package identified by [id] to the system cache. This is only
- * called for sources with [shouldCache] set to true.
- *
- * By default, this uses [systemCacheDirectory] and [install].
- */
- Future<Package> installToSystemCache(PackageId id) {
- var path = systemCacheDirectory(id);
- return exists(path).chain((exists) {
- // TODO(nweiz): better error handling
- if (exists) throw 'Package $id is already installed.';
- return ensureDir(dirname(path));
- }).chain((_) {
- return install(id, path);
- }).chain((found) {
- if (!found) throw 'Package $id not found.';
- return Package.load(path, systemCache.sources);
- });
- }
+ abstract Future<bool> install(PackageId id, String path);
/**
* Returns the directory in the system cache that the package identified by
* [id] should be installed to. This should return a path to a subdirectory of
* [systemCacheRoot].
*
- * This doesn't need to be implemented if [shouldCache] is false, or if
- * [installToSystemCache] is implemented.
+ * This doesn't need to be implemented if [shouldCache] is false.
*/
String systemCacheDirectory(PackageId id) =>
join(systemCacheRoot, packageName(id.description));
« no previous file with comments | « utils/pub/git_source.dart ('k') | utils/pub/system_cache.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698