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

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

Issue 11638010: Convert /** comments to /// in pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix 80 column limit. Created 8 years 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
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 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';
11 import 'version.dart'; 11 import 'version.dart';
12 import 'yaml/yaml.dart'; 12 import 'yaml/yaml.dart';
13 13
14 /** 14 /// The parsed and validated contents of a pubspec file.
15 * The parsed and validated contents of a pubspec file.
16 */
17 class Pubspec { 15 class Pubspec {
18 /** 16 /// This package's name.
19 * This package's name.
20 */
21 final String name; 17 final String name;
22 18
23 /** 19 /// This package's version.
24 * This package's version.
25 */
26 final Version version; 20 final Version version;
27 21
28 /** 22 /// The packages this package depends on.
29 * The packages this package depends on.
30 */
31 final List<PackageRef> dependencies; 23 final List<PackageRef> dependencies;
32 24
33 /// All pubspec fields. This includes the fields from which other properties 25 /// All pubspec fields. This includes the fields from which other properties
34 /// are derived. 26 /// are derived.
35 final Map<String, Object> fields; 27 final Map<String, Object> fields;
36 28
37 Pubspec(this.name, this.version, this.dependencies, 29 Pubspec(this.name, this.version, this.dependencies,
38 [Map<String, Object> fields]) 30 [Map<String, Object> fields])
39 : this.fields = fields == null ? {} : fields; 31 : this.fields = fields == null ? {} : fields;
40 32
41 Pubspec.empty() 33 Pubspec.empty()
42 : name = null, 34 : name = null,
43 version = Version.none, 35 version = Version.none,
44 dependencies = <PackageRef>[], 36 dependencies = <PackageRef>[],
45 fields = {}; 37 fields = {};
46 38
47 /** Whether or not the pubspec has no contents. */ 39 /// Whether or not the pubspec has no contents.
48 bool get isEmpty => 40 bool get isEmpty =>
49 name == null && version == Version.none && dependencies.isEmpty; 41 name == null && version == Version.none && dependencies.isEmpty;
50 42
51 /** 43 /// Parses the pubspec whose text is [contents]. If the pubspec doesn't define
52 * Parses the pubspec whose text is [contents]. If the pubspec doesn't define 44 /// version for itself, it defaults to [Version.none].
53 * version for itself, it defaults to [Version.none].
54 */
55 factory Pubspec.parse(String contents, SourceRegistry sources) { 45 factory Pubspec.parse(String contents, SourceRegistry sources) {
56 var name = null; 46 var name = null;
57 var version = Version.none; 47 var version = Version.none;
58 48
59 if (contents.trim() == '') return new Pubspec.empty(); 49 if (contents.trim() == '') return new Pubspec.empty();
60 50
61 var parsedPubspec = loadYaml(contents); 51 var parsedPubspec = loadYaml(contents);
62 if (parsedPubspec == null) return new Pubspec.empty(); 52 if (parsedPubspec == null) return new Pubspec.empty();
63 53
64 if (parsedPubspec is! Map) { 54 if (parsedPubspec is! Map) {
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 'Dependency specification $spec should be a string or a mapping.'); 173 'Dependency specification $spec should be a string or a mapping.');
184 } 174 }
185 175
186 source.validateDescription(description, fromLockFile: false); 176 source.validateDescription(description, fromLockFile: false);
187 177
188 dependencies.add(new PackageRef( 178 dependencies.add(new PackageRef(
189 name, source, versionConstraint, description)); 179 name, source, versionConstraint, description));
190 }); 180 });
191 181
192 return dependencies; 182 return dependencies;
193 } 183 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698