Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Side by Side Diff: pkg/docgen/lib/src/viewer.dart

Issue 270993002: Added error handling and a better error message if we fail to write output in docgen. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/docgen/lib/src/generator.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 /// Convenience methods wrapped up in a class to pull down the docgen viewer for 5 /// Convenience methods wrapped up in a class to pull down the docgen viewer for
6 /// a viewable website, and start up a server for viewing. 6 /// a viewable website, and start up a server for viewing.
7 library docgen.viewer; 7 library docgen.viewer;
8 8
9 import 'dart:io'; 9 import 'dart:io';
10 10
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 gen.outputDirectory); 121 gen.outputDirectory);
122 var webDocsDir = new Directory(path.join(_dartdocViewerDir.path, 'client', 122 var webDocsDir = new Directory(path.join(_dartdocViewerDir.path, 'client',
123 'web', 'docs')); 123 'web', 'docs'));
124 if (dir.existsSync()) { 124 if (dir.existsSync()) {
125 // Move the docs folder to dartdoc-viewer/client/web/docs 125 // Move the docs folder to dartdoc-viewer/client/web/docs
126 dir.renameSync(webDocsDir.path); 126 dir.renameSync(webDocsDir.path);
127 } 127 }
128 128
129 if (webDocsDir.existsSync()) { 129 if (webDocsDir.existsSync()) {
130 // Compile the code to JavaScript so we can run on any browser. 130 // Compile the code to JavaScript so we can run on any browser.
131 print('Compile app to JavaScript for viewing.'); 131 print('Compiling the app to JavaScript.');
132 var processResult = Process.runSync(gen.dartBinary, ['deploy.dart'], 132 var processResult = Process.runSync(gen.dartBinary, ['deploy.dart'],
133 workingDirectory: path.join(_dartdocViewerDir.path, 'client'), 133 workingDirectory: path.join(_dartdocViewerDir.path, 'client'),
134 runInShell: true); 134 runInShell: true);
135 print('process output: ${processResult.stdout}'); 135 print('process output: ${processResult.stdout}');
136 print('process stderr: ${processResult.stderr}'); 136 print('process stderr: ${processResult.stderr}');
137 _runServer(); 137 _runServer();
138 } 138 }
139 } 139 }
140 140
141 void _compile() { 141 void _compile() {
142 if (_webDocsDir.existsSync()) { 142 if (_webDocsDir.existsSync()) {
143 // Compile the code to JavaScript so we can run on any browser. 143 // Compile the code to JavaScript so we can run on any browser.
144 print('Compile app to JavaScript for viewing.'); 144 print('Compiling the app to JavaScript.');
145 var processResult = Process.runSync(gen.dartBinary, ['deploy.dart'], 145 var processResult = Process.runSync(gen.dartBinary, ['deploy.dart'],
146 workingDirectory: _viewerCodePath, runInShell: true); 146 workingDirectory: _viewerCodePath, runInShell: true);
147 print('process output: ${processResult.stdout}'); 147 print('process output: ${processResult.stdout}');
148 print('process stderr: ${processResult.stderr}'); 148 print('process stderr: ${processResult.stderr}');
149 var outputDir = path.join(_viewerCodePath, 'out', 'web'); 149 var outputDir = path.join(_viewerCodePath, 'out', 'web');
150 print('Docs are available at $outputDir'); 150 print('Docs are available at $outputDir');
151 } 151 }
152 } 152 }
153 153
154 /// A simple HTTP server. Implemented here because this is part of the SDK, 154 /// A simple HTTP server. Implemented here because this is part of the SDK,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 // Serve up file contents. 192 // Serve up file contents.
193 file.openRead().pipe(response).catchError((e) { 193 file.openRead().pipe(response).catchError((e) {
194 print('HttpServer: error while closing the response stream $e'); 194 print('HttpServer: error while closing the response stream $e');
195 }); 195 });
196 } 196 }
197 }, onError: (e) { 197 }, onError: (e) {
198 print('HttpServer: an error occured $e'); 198 print('HttpServer: an error occured $e');
199 }); 199 });
200 }); 200 });
201 } 201 }
OLDNEW
« no previous file with comments | « pkg/docgen/lib/src/generator.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698