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

Side by Side Diff: sdk/lib/_internal/pub/lib/src/source/path.dart

Issue 20204003: First stab at a dev server in pub using barback. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 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 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 pub.source.path; 5 library pub.source.path;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 9
10 import 'package:path/path.dart' as path; 10 import 'package:path/path.dart' as path;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 } on FormatException catch(err) { 45 } on FormatException catch(err) {
46 return false; 46 return false;
47 } 47 }
48 48
49 createPackageSymlink(id.name, id.description["path"], destination, 49 createPackageSymlink(id.name, id.description["path"], destination,
50 relative: id.description["relative"]); 50 relative: id.description["relative"]);
51 return true; 51 return true;
52 }); 52 });
53 } 53 }
54 54
55 Future<String> getDirectory(PackageId id) {
56 return new Future(() {
nweiz 2013/07/25 22:58:58 newFuture
Bob Nystrom 2013/07/26 20:20:11 Done.
57 _validatePath(id.name, id.description);
58 return id.description["path"];
59 });
60 }
61
55 /// Parses a path dependency. This takes in a path string and returns a map. 62 /// Parses a path dependency. This takes in a path string and returns a map.
56 /// The "path" key will be the original path but resolved relative to the 63 /// The "path" key will be the original path but resolved relative to the
57 /// containing path. The "relative" key will be `true` if the original path 64 /// containing path. The "relative" key will be `true` if the original path
58 /// was relative. 65 /// was relative.
59 /// 66 ///
60 /// A path coming from a pubspec is a simple string. From a lock file, it's 67 /// A path coming from a pubspec is a simple string. From a lock file, it's
61 /// an expanded {"path": ..., "relative": ...} map. 68 /// an expanded {"path": ..., "relative": ...} map.
62 dynamic parseDescription(String containingPath, description, 69 dynamic parseDescription(String containingPath, description,
63 {bool fromLockFile: false}) { 70 {bool fromLockFile: false}) {
64 if (fromLockFile) { 71 if (fromLockFile) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 if (dirExists(dir)) return; 116 if (dirExists(dir)) return;
110 117
111 if (fileExists(dir)) { 118 if (fileExists(dir)) {
112 fail("Path dependency for package '$name' must refer to a " 119 fail("Path dependency for package '$name' must refer to a "
113 "directory, not a file. Was '$dir'."); 120 "directory, not a file. Was '$dir'.");
114 } 121 }
115 122
116 fail("Could not find package '$name' at '$dir'."); 123 fail("Could not find package '$name' at '$dir'.");
117 } 124 }
118 } 125 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698