| OLD | NEW |
| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // If the viewer code is already there, then don't clone again. | 82 // If the viewer code is already there, then don't clone again. |
| 83 if (_dartdocViewerDir.existsSync()) { | 83 if (_dartdocViewerDir.existsSync()) { |
| 84 _moveDirectoryAndServe(); | 84 _moveDirectoryAndServe(); |
| 85 } else { | 85 } else { |
| 86 var processResult = Process.runSync('git', ['clone', '-b', 'master', | 86 var processResult = Process.runSync('git', ['clone', '-b', 'master', |
| 87 'https://github.com/dart-lang/dartdoc-viewer.git'], runInShell: true); | 87 'https://github.com/dart-lang/dartdoc-viewer.git'], runInShell: true); |
| 88 | 88 |
| 89 if (processResult.exitCode == 0) { | 89 if (processResult.exitCode == 0) { |
| 90 /// Move the generated json/yaml docs directory to the dartdoc-viewer | 90 /// Move the generated json/yaml docs directory to the dartdoc-viewer |
| 91 /// directory, to run as a webpage. | 91 /// directory, to run as a webpage. |
| 92 var processResult = Process.runSync(gen.pubScript, ['upgrade'], | 92 var processResult = Process.runSync(gen.pubScript, ['get'], |
| 93 runInShell: true, workingDirectory: _viewerCodePath); | 93 runInShell: true, workingDirectory: _viewerCodePath); |
| 94 print('process output: ${processResult.stdout}'); | 94 print('process output: ${processResult.stdout}'); |
| 95 print('process stderr: ${processResult.stderr}'); | 95 print('process stderr: ${processResult.stderr}'); |
| 96 | 96 |
| 97 var dir = new Directory(gen.outputDirectory == null ? 'docs' : | 97 var dir = new Directory(gen.outputDirectory == null ? 'docs' : |
| 98 gen.outputDirectory); | 98 gen.outputDirectory); |
| 99 _webDocsDir = new Directory(path.join(_viewerCodePath, 'web', 'docs')); | 99 _webDocsDir = new Directory(path.join(_viewerCodePath, 'web', 'docs')); |
| 100 if (dir.existsSync()) { | 100 if (dir.existsSync()) { |
| 101 // Move the docs folder to dartdoc-viewer/client/web/docs | 101 // Move the docs folder to dartdoc-viewer/client/web/docs |
| 102 dir.renameSync(_webDocsDir.path); | 102 dir.renameSync(_webDocsDir.path); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } |
| OLD | NEW |