| 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 /** | 5 /** |
| 6 * To generate docs for a library, run this script with the path to an | 6 * To generate docs for a library, run this script with the path to an |
| 7 * entrypoint .dart file, like: | 7 * entrypoint .dart file, like: |
| 8 * | 8 * |
| 9 * $ dart dartdoc.dart foo.dart | 9 * $ dart dartdoc.dart foo.dart |
| 10 * | 10 * |
| 11 * This will create a "docs" directory with the docs for your libraries. To | 11 * This will create a "docs" directory with the docs for your libraries. To |
| 12 * create these beautiful docs, dartdoc parses your library and every library | 12 * create these beautiful docs, dartdoc parses your library and every library |
| 13 * it imports (recursively). From each library, it parses all classes and | 13 * it imports (recursively). From each library, it parses all classes and |
| 14 * members, finds the associated doc comments and builds crosslinked docs from | 14 * members, finds the associated doc comments and builds crosslinked docs from |
| 15 * them. | 15 * them. |
| 16 */ | 16 */ |
| 17 library dartdoc; | 17 library dartdoc; |
| 18 | 18 |
| 19 import 'dart:async'; | 19 import 'dart:async'; |
| 20 import 'dart:io'; | 20 import 'dart:io'; |
| 21 | 21 |
| 22 // TODO(rnystrom): Use "package:" URL (#4968). | |
| 23 import '../lib/dartdoc.dart'; | 22 import '../lib/dartdoc.dart'; |
| 24 import '../lib/src/dartdoc/utils.dart'; | 23 import '../lib/src/dartdoc/utils.dart'; |
| 25 import 'package:args/args.dart'; | 24 import 'package:args/args.dart'; |
| 26 import 'package:pathos/path.dart' as path; | 25 import 'package:path/path.dart' as path; |
| 27 | 26 |
| 28 /** | 27 /** |
| 29 * Run this from the `lib/_internal/dartdoc` directory. | 28 * Run this from the `lib/_internal/dartdoc` directory. |
| 30 */ | 29 */ |
| 31 main() { | 30 main() { |
| 32 mainWithOptions(new Options()); | 31 mainWithOptions(new Options()); |
| 33 } | 32 } |
| 34 | 33 |
| 35 /** | 34 /** |
| 36 * We use this to include dartdoc in a single snapshot with dart2js. | 35 * We use this to include dartdoc in a single snapshot with dart2js. |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 // If there is not, then check if the entrypoint is somewhere in a `lib` | 280 // If there is not, then check if the entrypoint is somewhere in a `lib` |
| 282 // directory. | 281 // directory. |
| 283 var parts = path.split(path.dirname(script)); | 282 var parts = path.split(path.dirname(script)); |
| 284 var libDir = parts.lastIndexOf('lib'); | 283 var libDir = parts.lastIndexOf('lib'); |
| 285 if (libDir > 0) { | 284 if (libDir > 0) { |
| 286 return path.join(path.joinAll(parts.take(libDir)), 'packages'); | 285 return path.join(path.joinAll(parts.take(libDir)), 'packages'); |
| 287 } else { | 286 } else { |
| 288 return null; | 287 return null; |
| 289 } | 288 } |
| 290 } | 289 } |
| OLD | NEW |