Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 /// **docgen** is a tool for creating machine readable representations of Dart | 5 /// **docgen** is a tool for creating machine readable representations of Dart |
| 6 /// code metadata, including: classes, members, comments and annotations. | 6 /// code metadata, including: classes, members, comments and annotations. |
| 7 /// | 7 /// |
| 8 /// docgen is run on a `.dart` file or a directory containing `.dart` files. | 8 /// docgen is run on a `.dart` file or a directory containing `.dart` files. |
| 9 /// | 9 /// |
| 10 /// $ dart docgen.dart [OPTIONS] [FILE/DIR] | 10 /// $ dart docgen.dart [OPTIONS] [FILE/DIR] |
| (...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 758 print('process stderr: ${processResult.stderr}'); | 758 print('process stderr: ${processResult.stderr}'); |
| 759 var outputDir = path.join(viewerCodePath, 'out', 'web'); | 759 var outputDir = path.join(viewerCodePath, 'out', 'web'); |
| 760 print('Docs are available at $outputDir'); | 760 print('Docs are available at $outputDir'); |
| 761 } | 761 } |
| 762 } | 762 } |
| 763 | 763 |
| 764 /// A simple HTTP server. Implemented here because this is part of the SDK, | 764 /// A simple HTTP server. Implemented here because this is part of the SDK, |
| 765 /// so it shouldn't have any external dependencies. | 765 /// so it shouldn't have any external dependencies. |
| 766 static void _runServer() { | 766 static void _runServer() { |
| 767 // Launch a server to serve out of the directory dartdoc-viewer/client/web. | 767 // Launch a server to serve out of the directory dartdoc-viewer/client/web. |
| 768 HttpServer.bind('localhost', 8080).then((HttpServer httpServer) { | 768 HttpServer.bind(InternetAddress.ANY_IP_V6, 8080).then((HttpServer httpServer ) { |
| 769 print('Server launched. Navigate your browser to: ' | 769 print('Server launched. Navigate your browser to: ' |
| 770 'http://localhost:${httpServer.port}'); | 770 'http://localhost:${httpServer.port}'); |
|
Emily Fortuna
2014/02/25 18:24:51
Update the printed address here?
| |
| 771 httpServer.listen((HttpRequest request) { | 771 httpServer.listen((HttpRequest request) { |
| 772 var response = request.response; | 772 var response = request.response; |
| 773 var basePath = path.join(viewerCodePath, 'out', 'web'); | 773 var basePath = path.join(viewerCodePath, 'out', 'web'); |
| 774 var requestPath = path.join(basePath, request.uri.path.substring(1)); | 774 var requestPath = path.join(basePath, request.uri.path.substring(1)); |
| 775 bool found = true; | 775 bool found = true; |
| 776 var file = new File(requestPath); | 776 var file = new File(requestPath); |
| 777 if (file.existsSync()) { | 777 if (file.existsSync()) { |
| 778 // Set the correct header type. | 778 // Set the correct header type. |
| 779 if (requestPath.endsWith('.html')) { | 779 if (requestPath.endsWith('.html')) { |
| 780 response.headers.set('Content-Type', 'text/html'); | 780 response.headers.set('Content-Type', 'text/html'); |
| (...skipping 1480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2261 .map((e) => originalMirror.getField(e.simpleName).reflectee) | 2261 .map((e) => originalMirror.getField(e.simpleName).reflectee) |
| 2262 .where((e) => e != null) | 2262 .where((e) => e != null) |
| 2263 .toList(); | 2263 .toList(); |
| 2264 } | 2264 } |
| 2265 | 2265 |
| 2266 Map toMap() => { | 2266 Map toMap() => { |
| 2267 'name': Indexable.getDocgenObject(mirror, owningLibrary).docName, | 2267 'name': Indexable.getDocgenObject(mirror, owningLibrary).docName, |
| 2268 'parameters': parameters | 2268 'parameters': parameters |
| 2269 }; | 2269 }; |
| 2270 } | 2270 } |
| OLD | NEW |