| 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 pubspec; | 5 library pubspec; |
| 6 | 6 |
| 7 import 'package:yaml/yaml.dart'; | 7 import 'package:yaml/yaml.dart'; |
| 8 import 'package:pathos/path.dart' as path; | 8 import 'package:pathos/path.dart' as path; |
| 9 | 9 |
| 10 import 'io.dart'; | 10 import 'io.dart'; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 if (pubspec.name == null) { | 47 if (pubspec.name == null) { |
| 48 throw new PubspecHasNoNameException(name); | 48 throw new PubspecHasNoNameException(name); |
| 49 } | 49 } |
| 50 | 50 |
| 51 if (name != null && pubspec.name != name) { | 51 if (name != null && pubspec.name != name) { |
| 52 throw new PubspecNameMismatchException(name, pubspec.name); | 52 throw new PubspecNameMismatchException(name, pubspec.name); |
| 53 } | 53 } |
| 54 | 54 |
| 55 return pubspec; | 55 return pubspec; |
| 56 } on FormatException catch (ex) { | 56 } on FormatException catch (ex) { |
| 57 throw 'Could not parse $pubspecPath:\n${ex.message}'; | 57 fail('Could not parse $pubspecPath:\n${ex.message}'); |
| 58 } | 58 } |
| 59 } | 59 } |
| 60 | 60 |
| 61 Pubspec(this.name, this.version, this.dependencies, this.devDependencies, | 61 Pubspec(this.name, this.version, this.dependencies, this.devDependencies, |
| 62 this.environment, [Map<String, Object> fields]) | 62 this.environment, [Map<String, Object> fields]) |
| 63 : this.fields = fields == null ? {} : fields; | 63 : this.fields = fields == null ? {} : fields; |
| 64 | 64 |
| 65 Pubspec.empty() | 65 Pubspec.empty() |
| 66 : name = null, | 66 : name = null, |
| 67 version = Version.none, | 67 version = Version.none, |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 /// The environment-related metadata in the pubspec. Corresponds to the data | 293 /// The environment-related metadata in the pubspec. Corresponds to the data |
| 294 /// under the "environment:" key in the pubspec. | 294 /// under the "environment:" key in the pubspec. |
| 295 class PubspecEnvironment { | 295 class PubspecEnvironment { |
| 296 /// The version constraint specifying which SDK versions this package works | 296 /// The version constraint specifying which SDK versions this package works |
| 297 /// with. | 297 /// with. |
| 298 final VersionConstraint sdkVersion; | 298 final VersionConstraint sdkVersion; |
| 299 | 299 |
| 300 PubspecEnvironment([VersionConstraint sdk]) | 300 PubspecEnvironment([VersionConstraint sdk]) |
| 301 : sdkVersion = sdk != null ? sdk : VersionConstraint.any; | 301 : sdkVersion = sdk != null ? sdk : VersionConstraint.any; |
| 302 } | 302 } |
| OLD | NEW |