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

Side by Side Diff: sdk/lib/_internal/pub/lib/src/source.dart

Issue 20204003: First stab at a dev server in pub using barback. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise. Created 7 years, 4 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) 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 pub.source; 5 library pub.source;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:path/path.dart' as path; 9 import 'package:path/path.dart' as path;
10 10
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 bool _isCachedPackageCorrupted(String packageDir) { 177 bool _isCachedPackageCorrupted(String packageDir) {
178 if (!fileExists(path.join(packageDir, "pubspec.yaml"))) return true; 178 if (!fileExists(path.join(packageDir, "pubspec.yaml"))) return true;
179 179
180 var libDir = path.join(packageDir, "lib"); 180 var libDir = path.join(packageDir, "lib");
181 if (dirExists(libDir)) return listDir(libDir).length == 0; 181 if (dirExists(libDir)) return listDir(libDir).length == 0;
182 182
183 // If we got here, it's OK. 183 // If we got here, it's OK.
184 return false; 184 return false;
185 } 185 }
186 186
187 /// Returns the directory where this package has been installed. If this is
188 /// a cached source, it will be in the system cache. Otherwise, it will
189 /// depend on the source.
190 Future<String> getDirectory(PackageId id) {
191 if (shouldCache) return systemCacheDirectory(id);
192 throw new UnimplementedError("Source $name must implement this.");
193 }
194
187 /// Returns the directory in the system cache that the package identified by 195 /// Returns the directory in the system cache that the package identified by
188 /// [id] should be installed to. This should return a path to a subdirectory 196 /// [id] should be installed to. This should return a path to a subdirectory
189 /// of [systemCacheRoot]. 197 /// of [systemCacheRoot].
190 /// 198 ///
191 /// This doesn't need to be implemented if [shouldCache] is false. 199 /// This doesn't need to be implemented if [shouldCache] is false.
192 Future<String> systemCacheDirectory(PackageId id) { 200 Future<String> systemCacheDirectory(PackageId id) {
193 return new Future.error( 201 return new Future.error(
194 "systemCacheDirectory() must be implemented if shouldCache is true."); 202 "systemCacheDirectory() must be implemented if shouldCache is true.");
195 } 203 }
196 204
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 /// Returns the [Package]s that have been installed in the system cache. 255 /// Returns the [Package]s that have been installed in the system cache.
248 List<Package> getCachedPackages() { 256 List<Package> getCachedPackages() {
249 if (shouldCache) { 257 if (shouldCache) {
250 throw new UnimplementedError("Source $name must implement this."); 258 throw new UnimplementedError("Source $name must implement this.");
251 } 259 }
252 } 260 }
253 261
254 /// Returns the source's name. 262 /// Returns the source's name.
255 String toString() => name; 263 String toString() => name;
256 } 264 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698