| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library pub.validator.compiled_dartdoc; | 5 library pub.validator.compiled_dartdoc; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:path/path.dart' as path; | 9 import 'package:path/path.dart' as path; |
| 10 | 10 |
| 11 import '../entrypoint.dart'; | 11 import '../entrypoint.dart'; |
| 12 import '../io.dart'; | 12 import '../io.dart'; |
| 13 import '../validator.dart'; | 13 import '../validator.dart'; |
| 14 | 14 |
| 15 /// Validates that a package doesn't contain compiled Dartdoc | 15 /// Validates that a package doesn't contain compiled Dartdoc |
| 16 /// output. | 16 /// output. |
| 17 class CompiledDartdocValidator extends Validator { | 17 class CompiledDartdocValidator extends Validator { |
| 18 CompiledDartdocValidator(Entrypoint entrypoint) | 18 CompiledDartdocValidator(Entrypoint entrypoint) |
| 19 : super(entrypoint); | 19 : super(entrypoint); |
| 20 | 20 |
| 21 Future validate() { | 21 Future validate() { |
| 22 return new Future.sync(() { | 22 return new Future.sync(() { |
| 23 for (var entry in entrypoint.root.listFiles()) { | 23 for (var entry in entrypoint.root.listFiles(useGitIgnore: true)) { |
| 24 if (path.basename(entry) != "nav.json") continue; | 24 if (path.basename(entry) != "nav.json") continue; |
| 25 var dir = path.dirname(entry); | 25 var dir = path.dirname(entry); |
| 26 | 26 |
| 27 // Look for tell-tale Dartdoc output files all in the same directory. | 27 // Look for tell-tale Dartdoc output files all in the same directory. |
| 28 var files = [ | 28 var files = [ |
| 29 entry, | 29 entry, |
| 30 path.join(dir, "index.html"), | 30 path.join(dir, "index.html"), |
| 31 path.join(dir, "styles.css"), | 31 path.join(dir, "styles.css"), |
| 32 path.join(dir, "dart-logo-small.png"), | 32 path.join(dir, "dart-logo-small.png"), |
| 33 path.join(dir, "client-live-nav.js") | 33 path.join(dir, "client-live-nav.js") |
| 34 ]; | 34 ]; |
| 35 | 35 |
| 36 if (files.every((val) => fileExists(val))) { | 36 if (files.every((val) => fileExists(val))) { |
| 37 warnings.add("Avoid putting generated documentation in " | 37 warnings.add("Avoid putting generated documentation in " |
| 38 "${path.relative(dir)}.\n" | 38 "${path.relative(dir)}.\n" |
| 39 "Generated documentation bloats the package with redundant " | 39 "Generated documentation bloats the package with redundant " |
| 40 "data."); | 40 "data."); |
| 41 } | 41 } |
| 42 } | 42 } |
| 43 }); | 43 }); |
| 44 } | 44 } |
| 45 } | 45 } |
| OLD | NEW |