OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 |
| 5 library pub.validator.pubspec; |
| 6 |
| 7 import 'dart:async'; |
| 8 |
| 9 import 'package:path/path.dart' as p; |
| 10 |
| 11 import '../entrypoint.dart'; |
| 12 import '../validator.dart'; |
| 13 |
| 14 /// Validates that a package's pubspec exists. |
| 15 /// |
| 16 /// In most cases this is clearly true, since pub can't run without a pubspec, |
| 17 /// but it's possible that the pubspec is gitignored. |
| 18 class PubspecValidator extends Validator { |
| 19 PubspecValidator(Entrypoint entrypoint) |
| 20 : super(entrypoint); |
| 21 |
| 22 Future validate() async { |
| 23 var files = entrypoint.root.listFiles(recursive: false, useGitIgnore: true); |
| 24 if (!files.any((file) => p.basename(file) == "pubspec.yaml")) { |
| 25 errors.add("The pubspec is hidden, probably by .gitignore."); |
| 26 } |
| 27 } |
| 28 } |
| 29 |
OLD | NEW |