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

Side by Side Diff: pkg/docgen/bin/dartdoc.py

Issue 22488017: Added script to run local files on App Engine (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed README and added more informative help information. Created 7 years, 4 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/README.md ('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
(Empty)
1 #!/usr/bin/env python
2 #
3 # Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
4 # for details. All rights reserved. Use of this source code is governed by a
5 # BSD-style license that can be found in the LICENSE file.
6
7 """ Run this script to generate documentation for a directory and serve
8 the results to localhost for viewing in the browser.
9 """
10
11 import argparse
12 import os
13 from os.path import join, dirname, abspath, exists
14 import platform
15 import subprocess
16 import sys
17 sys.path.append(abspath(join(dirname(__file__), '../../../tools')))
18 import utils
19 from upload_sdk import ExecuteCommand
20
21 DIRECTORY = abspath(dirname(__file__))
22 DART = join(DIRECTORY, '../../../%s/%s/dart-sdk/bin/dart'
23 % (utils.BUILD_ROOT[utils.GuessOS()], utils.GetBuildConf('release',
24 utils.GuessArchitecture())))
25 PUB = join(DIRECTORY, '../../../sdk/bin/pub')
26 DART2JS = join(DIRECTORY, '../../../sdk/bin/dart2js')
27 PACKAGE_ROOT = join(DART[:-(len('dart'))], '../../packages/')
28
29 def SetPackageRoot(path):
30 global PACKAGE_ROOT
31 if exists(path):
32 PACKAGE_ROOT = abspath(path)
33
34 def GetOptions():
35 summary = 'Runs docgen on the specified library and displays the \
Emily Fortuna 2013/08/12 21:05:05 how about isntead of the backslash write: summar
36 resulting documentation in the browser'
37 parser = argparse.ArgumentParser(description=summary)
38 parser.add_argument('--package-root', dest='pkg_root',
39 help='The package root for dart (default is in the build directory).',
40 action='store', default=PACKAGE_ROOT)
41 docgen = [DART, '--checked', '--package-root=' + PACKAGE_ROOT,
42 join(DIRECTORY, 'docgen.dart'), '-h']
Emily Fortuna 2013/08/12 21:05:05 if this is messy, I'd say take it out. Use your be
43 process = subprocess.Popen(docgen, stdout=subprocess.PIPE)
44 out, error = process.communicate()
Emily Fortuna 2013/08/12 21:05:05 indentation
45 parser.add_argument('--options',
46 help=out)
47 parser.add_argument('--gae-sdk',
48 help='The path to the Google App Engine SDK.')
49 options = parser.parse_args()
50 SetPackageRoot(options.pkg_root)
51 return options
52
53 def main():
54 options = GetOptions()
55 docgen = [DART, '--checked', '--package-root=' + PACKAGE_ROOT,
56 join(DIRECTORY, 'docgen.dart')]
57 docgen.extend(options.options.split())
58 ExecuteCommand(docgen)
59 ExecuteCommand(['git', 'clone', '-b', 'dev',
60 'git://github.com/dart-lang/dartdoc-viewer.git'])
61 ExecuteCommand(['mv', 'docs', 'dartdoc-viewer/client/local'])
62 os.chdir('dartdoc-viewer/client/')
63 subprocess.call([PUB, 'install'])
64 subprocess.call([DART, 'build.dart'])
65 subprocess.call([DART2JS, '-o', 'web/out/index.html_bootstrap.dart.js',
66 './web/out/index.html_bootstrap.dart'])
67 server = subprocess.Popen(['python',
68 join(abspath(join(dirname(__file__), options.gae_sdk)), 'dev_appserver.py'),
69 '..'])
70 print("\nPoint your browser to the address of the 'default' server below.")
71 raw_input("Press <RETURN> to terminate the server.\n\n")
72 server.terminate()
73 os.chdir('../..')
74 subprocess.call(['rm', '-rf', 'dartdoc-viewer'])
75
76 if __name__ == '__main__':
77 main()
OLDNEW
« no previous file with comments | « pkg/docgen/README.md ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698