| 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 * |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 // the feature is supported. | 68 // the feature is supported. |
| 69 Path get scriptDir => | 69 Path get scriptDir => |
| 70 new Path.fromNative(new Options().script).directoryPath; | 70 new Path.fromNative(new Options().script).directoryPath; |
| 71 | 71 |
| 72 /** | 72 /** |
| 73 * Deletes and recreates the output directory at [path] if it exists. | 73 * Deletes and recreates the output directory at [path] if it exists. |
| 74 */ | 74 */ |
| 75 void cleanOutputDirectory(Path path) { | 75 void cleanOutputDirectory(Path path) { |
| 76 final outputDir = new Directory.fromPath(path); | 76 final outputDir = new Directory.fromPath(path); |
| 77 if (outputDir.existsSync()) { | 77 if (outputDir.existsSync()) { |
| 78 outputDir.deleteRecursivelySync(); | 78 outputDir.deleteSync(recursive: true); |
| 79 } | 79 } |
| 80 | 80 |
| 81 try { | 81 try { |
| 82 // TODO(3914): Hack to avoid 'file already exists' exception thrown | 82 // TODO(3914): Hack to avoid 'file already exists' exception thrown |
| 83 // due to invalid result from dir.existsSync() (probably due to race | 83 // due to invalid result from dir.existsSync() (probably due to race |
| 84 // conditions). | 84 // conditions). |
| 85 outputDir.createSync(); | 85 outputDir.createSync(); |
| 86 } on DirectoryIOException catch (e) { | 86 } on DirectoryIOException catch (e) { |
| 87 // Ignore. | 87 // Ignore. |
| 88 } | 88 } |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 final filePath = tmpPath.append('nav.dart'); | 557 final filePath = tmpPath.append('nav.dart'); |
| 558 writeString(new File.fromPath(filePath), | 558 writeString(new File.fromPath(filePath), |
| 559 'get json => $dartString;'); | 559 'get json => $dartString;'); |
| 560 } | 560 } |
| 561 | 561 |
| 562 Path get tmpPath => dartdocPath.append('tmp'); | 562 Path get tmpPath => dartdocPath.append('tmp'); |
| 563 | 563 |
| 564 void cleanup() { | 564 void cleanup() { |
| 565 final dir = new Directory.fromPath(tmpPath); | 565 final dir = new Directory.fromPath(tmpPath); |
| 566 if (dir.existsSync()) { | 566 if (dir.existsSync()) { |
| 567 dir.deleteRecursivelySync(); | 567 dir.deleteSync(recursive: true); |
| 568 } | 568 } |
| 569 } | 569 } |
| 570 | 570 |
| 571 List createNavigationInfo() { | 571 List createNavigationInfo() { |
| 572 final libraryList = []; | 572 final libraryList = []; |
| 573 for (final library in _sortedLibraries) { | 573 for (final library in _sortedLibraries) { |
| 574 docLibraryNavigationJson(library, libraryList); | 574 docLibraryNavigationJson(library, libraryList); |
| 575 } | 575 } |
| 576 return libraryList; | 576 return libraryList; |
| 577 } | 577 } |
| (...skipping 1289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1867 final ClassMirror inheritedFrom; | 1867 final ClassMirror inheritedFrom; |
| 1868 | 1868 |
| 1869 DocComment(this.text, [this.inheritedFrom = null]) { | 1869 DocComment(this.text, [this.inheritedFrom = null]) { |
| 1870 assert(text != null && !text.trim().isEmpty); | 1870 assert(text != null && !text.trim().isEmpty); |
| 1871 } | 1871 } |
| 1872 | 1872 |
| 1873 String get html => md.markdownToHtml(text); | 1873 String get html => md.markdownToHtml(text); |
| 1874 | 1874 |
| 1875 String toString() => text; | 1875 String toString() => text; |
| 1876 } | 1876 } |
| OLD | NEW |