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

Unified Diff: utils/pub/path_source.dart

Issue 11931040: adds file path source to pub (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase to newest as of 5 min ago Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « utils/pub/io.dart ('k') | utils/pub/system_cache.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..ff34dd0e6ddcadbbf77633f62f9eeae8d7e30a13
--- /dev/null
+++ b/utils/pub/path_source.dart
@@ -0,0 +1,33 @@
+// 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 a given file path
+/// for development use.
+class PathSource extends Source {
+ final name = 'path';
+ final shouldCache = false;
+
+ 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)
+ throw new FormatException("The description must be a path string.");
+ }
+}
« no previous file with comments | « utils/pub/io.dart ('k') | utils/pub/system_cache.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698