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

Side by Side Diff: utils/pub/package.dart

Issue 10174029: Use YAML as the format for the pubspec file. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 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
« no previous file with comments | « no previous file | utils/pub/pub.dart » ('j') | utils/tests/pub/pub_tests.dart » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /** 5 /**
6 * A named, versioned, unit of code and resource reuse. 6 * A named, versioned, unit of code and resource reuse.
7 */ 7 */
8 class Package implements Hashable { 8 class Package implements Hashable {
9 /** 9 /**
10 * Loads the package whose root directory is [packageDir]. 10 * Loads the package whose root directory is [packageDir].
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 final readFuture = readTextFile(path); 106 final readFuture = readTextFile(path);
107 readFuture.handleException((error) { 107 readFuture.handleException((error) {
108 // If there is no pubspec, we implicitly treat that as a package with no 108 // If there is no pubspec, we implicitly treat that as a package with no
109 // dependencies. 109 // dependencies.
110 // TODO(rnystrom): Distinguish file not found from other real errors. 110 // TODO(rnystrom): Distinguish file not found from other real errors.
111 completer.complete(<String>[]); 111 completer.complete(<String>[]);
112 return true; 112 return true;
113 }); 113 });
114 114
115 readFuture.then((pubspec) { 115 readFuture.then((pubspec) {
116 // TODO(rnystrom): Use YAML parser when ready. For now, it's just a flat 116 var parsedPubspec = loadYaml(pubspec);
117 // list of newline-separated strings. 117 if (parsedPubspec is! List || parsedPubspec.some((e) => e is! String)) {
118 final dependencyNames = pubspec.split('\n'). 118 completer.completeException(
119 map((name) => name.trim()). 119 'pubspec must be a YAML list of package names.');
Bob Nystrom 2012/04/25 22:59:01 'The pubspec... just so it can be sentence cased.
nweiz 2012/04/25 23:05:14 Done.
120 filter((name) => (name != null) && (name != '')); 120 }
121 121
122 completer.complete(dependencyNames); 122 completer.complete(parsedPubspec);
123 }); 123 });
124 124
125 return completer.future; 125 return completer.future;
126 } 126 }
127 } 127 }
OLDNEW
« no previous file with comments | « no previous file | utils/pub/pub.dart » ('j') | utils/tests/pub/pub_tests.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698