OLD | NEW |
---|---|
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 pub.pubspec; | 5 library pub.pubspec; |
6 | 6 |
7 import 'package:yaml/yaml.dart'; | 7 import 'package:yaml/yaml.dart'; |
8 import 'package:path/path.dart' as path; | 8 import 'package:path/path.dart' as path; |
9 | 9 |
10 import 'barback.dart'; | 10 import 'barback.dart'; |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
350 | 350 |
351 var versionConstraint = new VersionRange(); | 351 var versionConstraint = new VersionRange(); |
352 if (spec == null) { | 352 if (spec == null) { |
353 description = name; | 353 description = name; |
354 sourceName = _sources.defaultSource.name; | 354 sourceName = _sources.defaultSource.name; |
355 } else if (spec is String) { | 355 } else if (spec is String) { |
356 description = name; | 356 description = name; |
357 sourceName = _sources.defaultSource.name; | 357 sourceName = _sources.defaultSource.name; |
358 versionConstraint = _parseVersionConstraint(spec, "$field.$name"); | 358 versionConstraint = _parseVersionConstraint(spec, "$field.$name"); |
359 } else if (spec is Map) { | 359 } else if (spec is Map) { |
360 spec = new Map.from(spec); | |
Bob Nystrom
2014/06/03 00:33:14
Document this.
nweiz
2014/06/03 02:03:21
Done.
| |
360 if (spec.containsKey('version')) { | 361 if (spec.containsKey('version')) { |
361 versionConstraint = _parseVersionConstraint(spec.remove('version'), | 362 versionConstraint = _parseVersionConstraint(spec.remove('version'), |
362 "$field.$name.version"); | 363 "$field.$name.version"); |
363 } | 364 } |
364 | 365 |
365 var sourceNames = spec.keys.toList(); | 366 var sourceNames = spec.keys.toList(); |
366 if (sourceNames.length > 1) { | 367 if (sourceNames.length > 1) { |
367 _error('"$field.$name" field may only have one source, but it had ' | 368 _error('"$field.$name" field may only have one source, but it had ' |
368 '${toSentence(sourceNames)}.'); | 369 '${toSentence(sourceNames)}.'); |
369 } | 370 } |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
507 | 508 |
508 return "$str:\n$subMessage"; | 509 return "$str:\n$subMessage"; |
509 } | 510 } |
510 } | 511 } |
511 | 512 |
512 /// Returns whether [uri] is a file URI. | 513 /// Returns whether [uri] is a file URI. |
513 /// | 514 /// |
514 /// This is slightly more complicated than just checking if the scheme is | 515 /// This is slightly more complicated than just checking if the scheme is |
515 /// 'file', since relative URIs also refer to the filesystem on the VM. | 516 /// 'file', since relative URIs also refer to the filesystem on the VM. |
516 bool _isFileUri(Uri uri) => uri.scheme == 'file' || uri.scheme == ''; | 517 bool _isFileUri(Uri uri) => uri.scheme == 'file' || uri.scheme == ''; |
OLD | NEW |