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

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

Issue 10658025: Add a Pub source for pub.dartlang.org. (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « utils/pub/repo_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 #library('system_cache'); 5 #library('system_cache');
6 6
7 #import('io.dart');
7 #import('package.dart'); 8 #import('package.dart');
8 #import('source_registry.dart'); 9 #import('source_registry.dart');
10 #import('utils.dart');
9 11
10 /** 12 /**
11 * The system-wide cache of installed packages. 13 * The system-wide cache of installed packages.
12 * 14 *
13 * This cache contains all packages that are downloaded from the internet. 15 * This cache contains all packages that are downloaded from the internet.
14 * Packages that are available locally (e.g. from the SDK) don't use this cache. 16 * Packages that are available locally (e.g. from the SDK) don't use this cache.
15 */ 17 */
16 class SystemCache { 18 class SystemCache {
17 /** 19 /**
18 * The root directory where this package cache is located. 20 * The root directory where this package cache is located.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 74
73 var sourceDir = join(rootDir, id.source.name); 75 var sourceDir = join(rootDir, id.source.name);
74 var path = id.source.systemCacheDirectory(id, sourceDir); 76 var path = id.source.systemCacheDirectory(id, sourceDir);
75 var future = exists(path).chain((exists) { 77 var future = exists(path).chain((exists) {
76 // TODO(nweiz): better error handling 78 // TODO(nweiz): better error handling
77 if (exists) throw 'Package $id is already installed.'; 79 if (exists) throw 'Package $id is already installed.';
78 return ensureDir(dirname(path)); 80 return ensureDir(dirname(path));
79 }).chain((_) { 81 }).chain((_) {
80 return id.source.install(id, path); 82 return id.source.install(id, path);
81 }).chain((found) { 83 }).chain((found) {
82 if (!found) { 84 if (!found) throw 'Package $id not found.';
83 throw 'Package ${id.fullName} not found in source "${id.source.name}".';
84 }
85 return Package.load(path, sources); 85 return Package.load(path, sources);
86 }); 86 });
87 87
88 always(future, () => _pendingInstalls.remove(id)); 88 always(future, () => _pendingInstalls.remove(id));
89 _pendingInstalls[id] = future; 89 _pendingInstalls[id] = future;
90 return future; 90 return future;
91 } 91 }
92 } 92 }
OLDNEW
« no previous file with comments | « utils/pub/repo_source.dart ('k') | utils/pub/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698