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

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

Issue 10896051: Improve the error message for pub install without a name key in the pubspec. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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/tests/pub/pub_install_test.dart » ('j') | no next file with comments »
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 #library('entrypoint'); 5 #library('entrypoint');
6 6
7 #import('io.dart'); 7 #import('io.dart');
8 #import('lock_file.dart'); 8 #import('lock_file.dart');
9 #import('package.dart'); 9 #import('package.dart');
10 #import('root_source.dart'); 10 #import('root_source.dart');
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 }); 226 });
227 } 227 }
228 228
229 /** 229 /**
230 * Validate that the pubspec for the entrypoint exists and specifies the name 230 * Validate that the pubspec for the entrypoint exists and specifies the name
231 * of the root package. 231 * of the root package.
232 */ 232 */
233 Future _validatePubspec() { 233 Future _validatePubspec() {
234 var future = new Future.immediate(null);; 234 var future = new Future.immediate(null);;
235 if (root.pubspec.isEmpty) { 235 if (root.pubspec.isEmpty) {
236 future = exists(join(path, "pubspec.yaml")).transform((exists) { 236 future = exists(join(root.dir, "pubspec.yaml")).transform((exists) {
237 if (exists) return; 237 if (exists) return;
238 throw 'Could not find a file named "pubspec.yaml" in the directory' 238 throw 'Could not find a file named "pubspec.yaml" in the directory '
239 '$path.'; 239 '$path.';
240 }); 240 });
241 } 241 }
242 242
243 return future.transform((_) { 243 return future.transform((_) {
244 if (root.pubspec.name != null) return; 244 if (root.pubspec.name != null) return;
245 throw '"pubspec.yaml" must contain a "name" key.'; 245 throw '"pubspec.yaml" is missing the required "name" field (e.g. "name: '
246 '${root.name}").';
246 }); 247 });
247 } 248 }
248 } 249 }
OLDNEW
« no previous file with comments | « no previous file | utils/tests/pub/pub_install_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698