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:path/path.dart' as path; | 7 import 'package:path/path.dart' as path; |
8 import 'package:pub_semver/pub_semver.dart'; | 8 import 'package:pub_semver/pub_semver.dart'; |
9 import 'package:source_span/source_span.dart'; | 9 import 'package:source_span/source_span.dart'; |
10 import 'package:yaml/yaml.dart'; | 10 import 'package:yaml/yaml.dart'; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 Version get version { | 67 Version get version { |
68 if (_version != null) return _version; | 68 if (_version != null) return _version; |
69 | 69 |
70 var version = fields['version']; | 70 var version = fields['version']; |
71 if (version == null) { | 71 if (version == null) { |
72 _version = Version.none; | 72 _version = Version.none; |
73 return _version; | 73 return _version; |
74 } | 74 } |
75 | 75 |
76 var span = fields.nodes['version'].span; | 76 var span = fields.nodes['version'].span; |
77 if (version is num) { | |
78 _error('"version" field must be written in MAJOR.MINOR.PATCH[SUFFIX] forma t', span); | |
Bob Nystrom
2014/10/06 16:19:34
I think the all caps part might confuse users a bi
srawlins
2014/10/06 17:33:08
Love it! Done.
| |
79 } | |
77 if (version is! String) { | 80 if (version is! String) { |
78 _error('"version" field must be a string.', span); | 81 _error('"version" field must be a string.', span); |
79 } | 82 } |
80 | 83 |
81 _version = _wrapFormatException('version number', span, | 84 _version = _wrapFormatException('version number', span, |
82 () => new Version.parse(version)); | 85 () => new Version.parse(version)); |
83 return _version; | 86 return _version; |
84 } | 87 } |
85 Version _version; | 88 Version _version; |
86 | 89 |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
579 implements ApplicationException { | 582 implements ApplicationException { |
580 PubspecException(String message, SourceSpan span) | 583 PubspecException(String message, SourceSpan span) |
581 : super(message, span); | 584 : super(message, span); |
582 } | 585 } |
583 | 586 |
584 /// Returns whether [uri] is a file URI. | 587 /// Returns whether [uri] is a file URI. |
585 /// | 588 /// |
586 /// This is slightly more complicated than just checking if the scheme is | 589 /// This is slightly more complicated than just checking if the scheme is |
587 /// 'file', since relative URIs also refer to the filesystem on the VM. | 590 /// 'file', since relative URIs also refer to the filesystem on the VM. |
588 bool _isFileUri(Uri uri) => uri.scheme == 'file' || uri.scheme == ''; | 591 bool _isFileUri(Uri uri) => uri.scheme == 'file' || uri.scheme == ''; |
OLD | NEW |