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

Unified Diff: utils/pub/validator/pubspec_field.dart

Issue 14297021: Move pub into sdk/lib/_internal. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Disallow package: imports of pub. Created 7 years, 8 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « utils/pub/validator/name.dart ('k') | utils/pub/validator/size.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/validator/pubspec_field.dart
diff --git a/utils/pub/validator/pubspec_field.dart b/utils/pub/validator/pubspec_field.dart
deleted file mode 100644
index 03a1b8e0dc31b9f1952fd72e8b4aa55d2aaea5e4..0000000000000000000000000000000000000000
--- a/utils/pub/validator/pubspec_field.dart
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pubspec_field_validator;
-
-import 'dart:async';
-
-import '../entrypoint.dart';
-import '../system_cache.dart';
-import '../validator.dart';
-import '../version.dart';
-
-/// A validator that checks that the pubspec has valid "author" and "homepage"
-/// fields.
-class PubspecFieldValidator extends Validator {
- PubspecFieldValidator(Entrypoint entrypoint)
- : super(entrypoint);
-
- Future validate() {
- // The types of all fields are validated when the pubspec is parsed.
- var pubspec = entrypoint.root.pubspec;
- var author = pubspec.fields['author'];
- var authors = pubspec.fields['authors'];
- if (author == null && authors == null) {
- errors.add('Your pubspec.yaml must have an "author" or "authors" field.');
- } else {
- if (authors == null) authors = [author];
-
- var hasName = new RegExp(r"^ *[^< ]");
- var hasEmail = new RegExp(r"<[^>]+> *$");
- for (var authorName in authors) {
- if (!hasName.hasMatch(authorName)) {
- warnings.add('Author "$authorName" in pubspec.yaml should have a '
- 'name.');
- }
- if (!hasEmail.hasMatch(authorName)) {
- warnings.add('Author "$authorName" in pubspec.yaml should have an '
- 'email address\n(e.g. "name <email>").');
- }
- }
- }
-
- var homepage = pubspec.fields['homepage'];
- if (homepage == null) {
- errors.add('Your pubspec.yaml is missing a "homepage" field.');
- }
-
- var description = pubspec.fields['description'];
- if (description == null) {
- errors.add('Your pubspec.yaml is missing a "description" field.');
- }
-
- var version = pubspec.fields['version'];
- if (version == null) {
- errors.add('Your pubspec.yaml is missing a "version" field.');
- }
-
- return new Future.value();
- }
-}
« no previous file with comments | « utils/pub/validator/name.dart ('k') | utils/pub/validator/size.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698