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

Side by Side Diff: lib/src/validator/pubspec.dart

Issue 1310253007: Make pub lish validation gitignore-aware. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: analysis hints Created 5 years, 3 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 unified diff | Download patch
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698