OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 library path_source; |
| 6 |
| 7 import 'dart:async'; |
| 8 import 'io.dart'; |
| 9 import 'package.dart'; |
| 10 import 'pubspec.dart'; |
| 11 import 'version.dart'; |
| 12 import 'source.dart'; |
| 13 import 'dart:io'; |
| 14 |
| 15 |
| 16 /// A package [Source] that installs packages from a given file path |
| 17 /// for development use. |
| 18 class PathSource extends Source { |
| 19 final name = 'path'; |
| 20 final shouldCache = false; |
| 21 |
| 22 Future<Pubspec> describe(PackageId id) => |
| 23 Package.load(id.name, id.description, systemCache.sources).then( |
| 24 (pkg) => pkg.pubspec); |
| 25 |
| 26 Future<bool> install(PackageId id, String path) => |
| 27 createPackageSymlink(id.name, id.description, path).then((_) => true); |
| 28 |
| 29 void validateDescription(description, {bool fromLockFile: false}) { |
| 30 if (description is! String) |
| 31 throw new FormatException("The description must be a path string."); |
| 32 } |
| 33 } |
OLD | NEW |