b12e27a4d2
Review URL: https://codereview.chromium.org//12253054 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18551 260f80e4-7a28-3924-810f-c04153c831b5
47 lines
1.4 KiB
Dart
47 lines
1.4 KiB
Dart
// 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 compiled_dartdoc_validator;
|
|
|
|
import 'dart:async';
|
|
|
|
import '../../../pkg/path/lib/path.dart' as path;
|
|
|
|
import '../entrypoint.dart';
|
|
import '../io.dart';
|
|
import '../utils.dart';
|
|
import '../validator.dart';
|
|
|
|
/// Validates that a package doesn't contain compiled Dartdoc
|
|
/// output.
|
|
class CompiledDartdocValidator extends Validator {
|
|
CompiledDartdocValidator(Entrypoint entrypoint)
|
|
: super(entrypoint);
|
|
|
|
Future validate() {
|
|
return listDir(entrypoint.root.dir, recursive: true).then((entries) {
|
|
for (var entry in entries) {
|
|
if (path.basename(entry) != "nav.json") return false;
|
|
var dir = path.dirname(entry);
|
|
|
|
// Look for tell-tale Dartdoc output files all in the same directory.
|
|
var files = [
|
|
entry,
|
|
path.join(dir, "index.html"),
|
|
path.join(dir, "styles.css"),
|
|
path.join(dir, "dart-logo-small.png"),
|
|
path.join(dir, "client-live-nav.js")
|
|
];
|
|
|
|
if (files.every((val) => fileExists(val))) {
|
|
warnings.add("Avoid putting generated documentation in "
|
|
"${path.relative(dir)}.\n"
|
|
"Generated documentation bloats the package with redundant "
|
|
"data.");
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|