| Index: lib/src/source/unknown.dart
|
| diff --git a/lib/src/source/unknown.dart b/lib/src/source/unknown.dart
|
| index 7f015af00f8847417150238b48e2b3f7d894bf00..f4107e6e21c2b163a238801de90dcc66423df561 100644
|
| --- a/lib/src/source/unknown.dart
|
| +++ b/lib/src/source/unknown.dart
|
| @@ -9,6 +9,7 @@ import 'package:pub_semver/pub_semver.dart';
|
| import '../package.dart';
|
| import '../pubspec.dart';
|
| import '../source.dart';
|
| +import '../system_cache.dart';
|
|
|
| /// A [Null Object] that represents a source not recognized by pub.
|
| ///
|
| @@ -21,6 +22,9 @@ class UnknownSource extends Source {
|
|
|
| UnknownSource(this.name);
|
|
|
| + LiveSource bind(SystemCache systemCache) =>
|
| + new _LiveUnknownSource(this, systemCache);
|
| +
|
| /// Two unknown sources are the same if their names are the same.
|
| bool operator==(other) =>
|
| other is UnknownSource &&
|
| @@ -28,26 +32,34 @@ class UnknownSource extends Source {
|
|
|
| int get hashCode => name.hashCode;
|
|
|
| + bool descriptionsEqual(description1, description2) =>
|
| + description1 == description2;
|
| +
|
| + PackageRef parseRef(String name, description, {String containingPath}) =>
|
| + new PackageRef(name, this.name, description);
|
| +
|
| + PackageId parseId(String name, Version version, description) =>
|
| + new PackageId(name, this.name, version, description);
|
| +}
|
| +
|
| +class _LiveUnknownSource extends LiveSource {
|
| + final UnknownSource source;
|
| +
|
| + final SystemCache systemCache;
|
| +
|
| + _LiveUnknownSource(this.source, this.systemCache);
|
| +
|
| Future<List<PackageId>> doGetVersions(PackageRef ref) =>
|
| throw new UnsupportedError(
|
| - "Cannot get package versions from unknown source '$name'.");
|
| + "Cannot get package versions from unknown source '${source.name}'.");
|
|
|
| Future<Pubspec> doDescribe(PackageId id) => throw new UnsupportedError(
|
| - "Cannot describe a package from unknown source '$name'.");
|
| + "Cannot describe a package from unknown source '${source.name}'.");
|
|
|
| Future get(PackageId id, String symlink) => throw new UnsupportedError(
|
| - "Cannot get an unknown source '$name'.");
|
| + "Cannot get an unknown source '${source.name}'.");
|
|
|
| /// Returns the directory where this package can be found locally.
|
| String getDirectory(PackageId id) => throw new UnsupportedError(
|
| - "Cannot find a package from an unknown source '$name'.");
|
| -
|
| - bool descriptionsEqual(description1, description2) =>
|
| - description1 == description2;
|
| -
|
| - PackageRef parseRef(String name, description, {String containingPath}) =>
|
| - new PackageRef(name, this.name, description);
|
| -
|
| - PackageId parseId(String name, Version version, description) =>
|
| - new PackageId(name, this.name, version, description);
|
| + "Cannot find a package from an unknown source '${source.name}'.");
|
| }
|
|
|