| 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.dart'); | 7 #import('package.dart'); |
| 8 #import('source.dart'); | 8 #import('source.dart'); |
| 9 #import('source_registry.dart'); | 9 #import('source_registry.dart'); |
| 10 #import('utils.dart'); | 10 #import('utils.dart'); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 List<PackageRef> dependencies; | 31 List<PackageRef> dependencies; |
| 32 | 32 |
| 33 Pubspec(this.name, this.version, this.dependencies); | 33 Pubspec(this.name, this.version, this.dependencies); |
| 34 | 34 |
| 35 Pubspec.empty() | 35 Pubspec.empty() |
| 36 : name = null, | 36 : name = null, |
| 37 version = Version.none, | 37 version = Version.none, |
| 38 dependencies = <PackageRef>[]; | 38 dependencies = <PackageRef>[]; |
| 39 | 39 |
| 40 /** Whether or not the pubspec has no contents. */ | 40 /** Whether or not the pubspec has no contents. */ |
| 41 bool get isEmpty() => | 41 bool get isEmpty => |
| 42 name == null && version == Version.none && dependencies.isEmpty(); | 42 name == null && version == Version.none && dependencies.isEmpty(); |
| 43 | 43 |
| 44 /** | 44 /** |
| 45 * Parses the pubspec whose text is [contents]. If the pubspec doesn't define | 45 * Parses the pubspec whose text is [contents]. If the pubspec doesn't define |
| 46 * version for itself, it defaults to [Version.none]. | 46 * version for itself, it defaults to [Version.none]. |
| 47 */ | 47 */ |
| 48 factory Pubspec.parse(String contents, SourceRegistry sources) { | 48 factory Pubspec.parse(String contents, SourceRegistry sources) { |
| 49 var name = null; | 49 var name = null; |
| 50 var version = Version.none; | 50 var version = Version.none; |
| 51 var dependencies = <PackageRef>[]; | 51 var dependencies = <PackageRef>[]; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 } | 118 } |
| 119 | 119 |
| 120 dependencies.add(new PackageRef( | 120 dependencies.add(new PackageRef( |
| 121 source, versionConstraint, description)); | 121 source, versionConstraint, description)); |
| 122 }); | 122 }); |
| 123 } | 123 } |
| 124 | 124 |
| 125 return new Pubspec(name, version, dependencies); | 125 return new Pubspec(name, version, dependencies); |
| 126 } | 126 } |
| 127 } | 127 } |
| OLD | NEW |