| OLD | NEW |
| 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 root_source; | 5 library root_source; |
| 6 | 6 |
| 7 import 'dart:async'; |
| 7 import 'package.dart'; | 8 import 'package.dart'; |
| 8 import 'pubspec.dart'; | 9 import 'pubspec.dart'; |
| 9 import 'source.dart'; | 10 import 'source.dart'; |
| 10 | 11 |
| 11 /// A source used only for the root package when doing version resolution. It | 12 /// A source used only for the root package when doing version resolution. It |
| 12 /// contains only the root package and is unable to install packages. | 13 /// contains only the root package and is unable to install packages. |
| 13 /// | 14 /// |
| 14 /// This source cannot be referenced from a pubspec. | 15 /// This source cannot be referenced from a pubspec. |
| 15 class RootSource extends Source { | 16 class RootSource extends Source { |
| 16 final String name = "root"; | 17 final String name = "root"; |
| 17 final bool shouldCache = false; | 18 final bool shouldCache = false; |
| 18 final Package package; | 19 final Package package; |
| 19 | 20 |
| 20 RootSource(this.package); | 21 RootSource(this.package); |
| 21 | 22 |
| 22 Future<Pubspec> describe(PackageId id) { | 23 Future<Pubspec> describe(PackageId id) { |
| 23 return new Future<Pubspec>.immediate(package.pubspec); | 24 return new Future<Pubspec>.immediate(package.pubspec); |
| 24 } | 25 } |
| 25 | 26 |
| 26 Future<bool> install(PackageId id, String destPath) { | 27 Future<bool> install(PackageId id, String destPath) { |
| 27 throw new UnsupportedError("Can't install from a root source."); | 28 throw new UnsupportedError("Can't install from a root source."); |
| 28 } | 29 } |
| 29 } | 30 } |
| OLD | NEW |