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

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

Issue 11931040: adds file path source to pub (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 'dart:io'; 7 import 'dart:io';
8 import 'dart:async'; 8 import 'dart:async';
9 9
10 import 'git_source.dart'; 10 import 'git_source.dart';
11 import 'hosted_source.dart'; 11 import 'hosted_source.dart';
12 import 'path_source.dart';
12 import 'io.dart'; 13 import 'io.dart';
13 import 'io.dart' as io show createTempDir; 14 import 'io.dart' as io show createTempDir;
14 import 'log.dart' as log; 15 import 'log.dart' as log;
15 import 'package.dart'; 16 import 'package.dart';
16 import 'sdk_source.dart'; 17 import 'sdk_source.dart';
17 import 'source.dart'; 18 import 'source.dart';
18 import 'source_registry.dart'; 19 import 'source_registry.dart';
19 import 'utils.dart'; 20 import 'utils.dart';
20 import 'version.dart'; 21 import 'version.dart';
21 22
(...skipping 19 matching lines...) Expand all
41 SystemCache(this.rootDir) 42 SystemCache(this.rootDir)
42 : _pendingInstalls = new Map<PackageId, Future<Package>>(), 43 : _pendingInstalls = new Map<PackageId, Future<Package>>(),
43 sources = new SourceRegistry(); 44 sources = new SourceRegistry();
44 45
45 /// Creates a system cache and registers the standard set of sources. 46 /// Creates a system cache and registers the standard set of sources.
46 factory SystemCache.withSources(String rootDir, String sdkDir) { 47 factory SystemCache.withSources(String rootDir, String sdkDir) {
47 var cache = new SystemCache(rootDir); 48 var cache = new SystemCache(rootDir);
48 cache.register(new SdkSource(sdkDir)); 49 cache.register(new SdkSource(sdkDir));
49 cache.register(new GitSource()); 50 cache.register(new GitSource());
50 cache.register(new HostedSource()); 51 cache.register(new HostedSource());
52 cache.register(new PathSource());
51 cache.sources.setDefault('hosted'); 53 cache.sources.setDefault('hosted');
52 return cache; 54 return cache;
53 } 55 }
54 56
55 /// Registers a new source. This source must not have the same name as a 57 /// Registers a new source. This source must not have the same name as a
56 /// source that's already been registered. 58 /// source that's already been registered.
57 void register(Source source) { 59 void register(Source source) {
58 source.bind(this); 60 source.bind(this);
59 sources.register(source); 61 sources.register(source);
60 } 62 }
(...skipping 30 matching lines...) Expand all
91 93
92 /// Delete's the system cache's internal temp directory. 94 /// Delete's the system cache's internal temp directory.
93 Future deleteTempDir() { 95 Future deleteTempDir() {
94 log.fine('Clean up system cache temp directory $tempDir.'); 96 log.fine('Clean up system cache temp directory $tempDir.');
95 return dirExists(tempDir).then((exists) { 97 return dirExists(tempDir).then((exists) {
96 if (!exists) return new Future.immediate(null); 98 if (!exists) return new Future.immediate(null);
97 return deleteDir(tempDir); 99 return deleteDir(tempDir);
98 }); 100 });
99 } 101 }
100 } 102 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698