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

Side by Side Diff: utils/pub/validator/compiled_dartdoc.dart

Issue 12089076: Add a pub validator for compiled dartdoc output. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 library compiled_dartdoc_validator;
6
7 import 'dart:async';
8
9 import '../../../pkg/path/lib/path.dart' as path;
10
11 import '../entrypoint.dart';
12 import '../io.dart';
13 import '../utils.dart';
14 import '../validator.dart';
15
16 /// A validator that validates that a package doesn't contain compiled Dartdoc
Bob Nystrom 2013/01/31 18:54:54 "A validator that validates" -> "Validates".
nweiz 2013/01/31 20:31:54 Done.
17 /// output.
18 class CompiledDartdocValidator extends Validator {
19 CompiledDartdocValidator(Entrypoint entrypoint)
20 : super(entrypoint);
21
22 Future validate() {
23 return listDir(entrypoint.root.dir, recursive: true).then((entries) {
24 return futureWhere(entries, (entry) {
25 if (basename(entry) != "nav.json") return false;
26 var dir = dirname(entry);
27
28 // Look for tell-tale Dartdoc output files all in the same directory.
29 return Future.wait([
30 fileExists(entry),
31 fileExists(join(dir, "index.html")),
32 fileExists(join(dir, "styles.css")),
33 fileExists(join(dir, "dart-logo-small.png")),
34 fileExists(join(dir, "client-live-nav.js"))
35 ]).then((results) => results.every((val) => val));
36 }).then((files) {
37 for (var dartdocDir in files.mappedBy(dirname)) {
38 var relativePath = path.relative(dartdocDir);
39 warnings.add("Remove compiled dartdoc documentation from "
40 "$relativePath.\n"
Bob Nystrom 2013/01/31 18:54:54 How about: Avoid putting generated documentation
nweiz 2013/01/31 20:31:54 The "that directory" text only makes sense if they
41 "Publishing compiled documentation causes package bloat without "
42 "providing value for users.");
43 }
44 });
45 });
46 }
47 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698