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

Side by Side Diff: utils/pub/system_cache.dart

Issue 10399076: Get codebase ready for actually supporting versioning. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Respond to review. Created 8 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « utils/pub/source.dart ('k') | utils/pub/utils.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * The system-wide cache of installed packages. 6 * The system-wide cache of installed packages.
7 * 7 *
8 * This cache contains all packages that are downloaded from the internet. 8 * This cache contains all packages that are downloaded from the internet.
9 * Packages that are available locally (e.g. from the SDK) don't use this cache. 9 * Packages that are available locally (e.g. from the SDK) don't use this cache.
10 */ 10 */
(...skipping 22 matching lines...) Expand all
33 sources = new SourceRegistry(); 33 sources = new SourceRegistry();
34 34
35 /** 35 /**
36 * Loads all of the package ids in the cache and returns them. 36 * Loads all of the package ids in the cache and returns them.
37 */ 37 */
38 Future<List<PackageId>> listAll() { 38 Future<List<PackageId>> listAll() {
39 return listDir(rootDir).chain((paths) { 39 return listDir(rootDir).chain((paths) {
40 final sources = paths.map((path) { 40 final sources = paths.map((path) {
41 final source = sources[basename(path)]; 41 final source = sources[basename(path)];
42 return listDir(path).transform((subpaths) { 42 return listDir(path).transform((subpaths) {
43 // TODO(rnystrom): Once there are cached packages and this path is
44 // being used, figure out how version numbers should be acquired.
43 return subpaths.map((subpath) => 45 return subpaths.map((subpath) =>
44 new PackageId(basename(subpath), source)); 46 new PackageId(basename(subpath), source, Version.none));
45 }); 47 });
46 }); 48 });
47 return Futures.wait(sources).transform(flatten); 49 return Futures.wait(sources).transform(flatten);
48 }); 50 });
49 } 51 }
50 52
51 /** 53 /**
52 * Ensures that the package identified by [id] is installed to the cache, 54 * Ensures that the package identified by [id] is installed to the cache,
53 * loads it, and returns it. 55 * loads it, and returns it.
54 * 56 *
(...skipping 20 matching lines...) Expand all
75 throw 'Package ${id.fullName} not found in source "${id.source.name}".'; 77 throw 'Package ${id.fullName} not found in source "${id.source.name}".';
76 } 78 }
77 return Package.load(path, sources); 79 return Package.load(path, sources);
78 }); 80 });
79 81
80 always(future, () => _pendingInstalls.remove(id)); 82 always(future, () => _pendingInstalls.remove(id));
81 _pendingInstalls[id] = future; 83 _pendingInstalls[id] = future;
82 return future; 84 return future;
83 } 85 }
84 } 86 }
OLDNEW
« no previous file with comments | « utils/pub/source.dart ('k') | utils/pub/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698