Chromium Code Reviews| Index: utils/pub/path_source.dart |
| diff --git a/utils/pub/path_source.dart b/utils/pub/path_source.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7e0de711f37f3263a207c854396330d5ffa64ae8 |
| --- /dev/null |
| +++ b/utils/pub/path_source.dart |
| @@ -0,0 +1,34 @@ |
| +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| +// for details. All rights reserved. Use of this source code is governed by a |
| +// BSD-style license that can be found in the LICENSE file. |
| + |
| +library path_source; |
| + |
| +import 'dart:async'; |
| +import 'io.dart'; |
| +import 'package.dart'; |
| +import 'pubspec.dart'; |
| +import 'version.dart'; |
| +import 'source.dart'; |
| +import 'dart:io'; |
| + |
| + |
| +/// A package source that installs packages from disk for development use |
|
Bob Nystrom
2013/01/17 19:15:10
Add a "." to make this a full sentence. Also inste
Sam E
2013/01/20 04:16:57
Done.
Sam E
2013/01/20 04:16:57
Done.
|
| +class PathSource extends Source { |
| + final String name = 'path'; |
| + final bool shouldCache = false; |
|
Bob Nystrom
2013/01/17 19:15:10
Type annotations aren't needed for final fields, s
Sam E
2013/01/20 04:16:57
Done.
|
| + |
| + PathSource(); |
|
Bob Nystrom
2013/01/17 19:15:10
I think you can remove this if it doesn't do anyth
Sam E
2013/01/20 04:16:57
Done.
|
| + |
| + Future<Pubspec> describe(PackageId id) => |
| + Package.load(id.name, id.description, systemCache.sources).then( |
| + (pkg) => pkg.pubspec); |
| + |
| + Future<bool> install(PackageId id, String path) => |
| + createPackageSymlink(id.name, id.description, path).then((_) => true); |
| + |
| + void validateDescription(description, {bool fromLockFile: false}) { |
| + if (description is String) return; |
| + throw new FormatException("The description must be a path string"); |
|
Bob Nystrom
2013/01/17 19:15:10
How about flipping this logic around and using if
Sam E
2013/01/20 04:16:57
Done.
|
| + } |
| +} |