OLD | NEW |
---|---|
1 #!/usr/bin/env python2 | 1 #!/usr/bin/env python2 |
2 # -*- coding: utf-8 -*- | 2 # -*- coding: utf-8 -*- |
3 | 3 |
4 # Copyright 2016 Google Inc. All Rights Reserved. | 4 # Copyright 2016 Google Inc. All Rights Reserved. |
5 # | 5 # |
6 # Licensed under the Apache License, Version 2.0 (the "License"); | 6 # Licensed under the Apache License, Version 2.0 (the "License"); |
7 # you may not use this file except in compliance with the License. | 7 # you may not use this file except in compliance with the License. |
8 # You may obtain a copy of the License at | 8 # You may obtain a copy of the License at |
9 # | 9 # |
10 # http://www.apache.org/licenses/LICENSE-2.0 | 10 # http://www.apache.org/licenses/LICENSE-2.0 |
(...skipping 12 matching lines...) Expand all Loading... | |
23 from __future__ import print_function, division, unicode_literals | 23 from __future__ import print_function, division, unicode_literals |
24 | 24 |
25 import json | 25 import json |
26 import logging | 26 import logging |
27 | 27 |
28 import surrogateescape | 28 import surrogateescape |
29 | 29 |
30 # Names of the configuration options mapped to a brief description and a default | 30 # Names of the configuration options mapped to a brief description and a default |
31 # value. | 31 # value. |
32 OPTIONS = { | 32 OPTIONS = { |
33 'id': ('Chrome App ID', '-1'), | |
34 'start_url': ('Path to main HTML file', 'index.html'), | 33 'start_url': ('Path to main HTML file', 'index.html'), |
35 'root': ('Where the root of the web app will be', '.'), | 34 'root': ('Where the root of the web app will be', '.'), |
36 'boilerplate_dir': | 35 'boilerplate_dir': |
37 ('Subdirectory of root where Caterpillar will put scripts', 'caterpillar'), | 36 ('Subdirectory of root where Caterpillar will put scripts', 'caterpillar'), |
37 'id': ('Chrome App ID', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'), | |
Matt Giuca
2016/01/28 07:33:22
Does it have to be aaaaaaaaaaaaa or can it just be
Matthew Alger
2016/01/28 23:24:45
This is the sample App ID used in the manifest doc
| |
38 'update_uris': | 38 'update_uris': |
39 ('Whether to normalise all URIs in the web app to the root', True), | 39 ('Whether to normalise all URIs in the web app to the root', True), |
40 'report_dir': ('Directory of generated output report', 'caterpillar-report'), | 40 'report_dir': ('Directory of generated output report', 'caterpillar-report'), |
41 } | 41 } |
42 | 42 |
43 | 43 |
44 def generate(interactive=False): | 44 def generate(interactive=False): |
45 """Generate a configuration file. | 45 """Generate a configuration file. |
46 | 46 |
47 Args: | 47 Args: |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
122 def generate_and_save(output_path, interactive=False): | 122 def generate_and_save(output_path, interactive=False): |
123 """Generates and outputs a configuration file. | 123 """Generates and outputs a configuration file. |
124 | 124 |
125 Args: | 125 Args: |
126 output_path: Path to save config file to. | 126 output_path: Path to save config file to. |
127 interactive: True iff generating the config should use user input. | 127 interactive: True iff generating the config should use user input. |
128 """ | 128 """ |
129 config = generate(interactive) | 129 config = generate(interactive) |
130 with open(output_path, 'w') as output_file: | 130 with open(output_path, 'w') as output_file: |
131 json.dump(config, output_file, sort_keys=True, indent=2) | 131 json.dump(config, output_file, sort_keys=True, indent=2) |
OLD | NEW |