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 * Library for taking a JSON file and putting the comments located within into | 6 * Library for taking a JSON file and putting the comments located within into |
7 * the HTML files the comments are associated with. | 7 * the HTML files the comments are associated with. |
8 * | 8 * |
9 * The format of the JSON file is: | 9 * The format of the JSON file is: |
10 * | 10 * |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 completer.complete(false); | 60 completer.complete(false); |
61 } else { | 61 } else { |
62 fileJson = JSON.parse(jsonRead); | 62 fileJson = JSON.parse(jsonRead); |
63 } | 63 } |
64 | 64 |
65 // TODO(amouravski): Refactor to not duplicate code here and in html-to-json. | 65 // TODO(amouravski): Refactor to not duplicate code here and in html-to-json. |
66 // Find html files. (lister) | 66 // Find html files. (lister) |
67 final lister = htmlDir.list(recursive: false); | 67 final lister = htmlDir.list(recursive: false); |
68 | 68 |
69 lister.onFile = (String path) { | 69 lister.onFile = (String path) { |
70 final name = new Path.fromNative(path).filename; | 70 final name = new Path(path).filename; |
71 | 71 |
72 // Ignore private classes. | 72 // Ignore private classes. |
73 if (name.startsWith('_')) return; | 73 if (name.startsWith('_')) return; |
74 | 74 |
75 // Ignore non-dart files. | 75 // Ignore non-dart files. |
76 if (!name.endsWith('.dart')) return; | 76 if (!name.endsWith('.dart')) return; |
77 | 77 |
78 File file = new File(path); | 78 File file = new File(path); |
79 | 79 |
80 // TODO(amouravski): Handle missing file. | 80 // TODO(amouravski): Handle missing file. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 146 |
147 // TODO(amouravski): file.writeAsStringSync('${Strings.join(fileLines, '\n')}\
n'); | 147 // TODO(amouravski): file.writeAsStringSync('${Strings.join(fileLines, '\n')}\
n'); |
148 var outputStream = file.openOutputStream(); | 148 var outputStream = file.openOutputStream(); |
149 outputStream.writeString(Strings.join(fileLines, '\n')); | 149 outputStream.writeString(Strings.join(fileLines, '\n')); |
150 outputStream.writeString('\n'); | 150 outputStream.writeString('\n'); |
151 | 151 |
152 outputStream.onNoPendingWrites = () { | 152 outputStream.onNoPendingWrites = () { |
153 outputStream.close(); | 153 outputStream.close(); |
154 }; | 154 }; |
155 } | 155 } |
OLD | NEW |