| 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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 | 363 |
| 364 Args: | 364 Args: |
| 365 dependencies: List of dependency names. | 365 dependencies: List of dependency names. |
| 366 directory: Directory to install dependencies into. | 366 directory: Directory to install dependencies into. |
| 367 """ | 367 """ |
| 368 for dependency in dependencies: | 368 for dependency in dependencies: |
| 369 caterpillar.install_dependency(['bower', 'install', dependency], directory) | 369 caterpillar.install_dependency(['bower', 'install', dependency], directory) |
| 370 | 370 |
| 371 | 371 |
| 372 def generate_and_write(report_dir, chrome_app_manifest, apis, status, warnings, | 372 def generate_and_write(report_dir, chrome_app_manifest, apis, status, warnings, |
| 373 pwa_path): | 373 web_path, boilerplate_dir): |
| 374 """Generates a conversion report and writes it to a directory. | 374 """Generates a conversion report and writes it to a directory. |
| 375 | 375 |
| 376 Args: | 376 Args: |
| 377 report_dir: Directory to write report to. | 377 report_dir: Directory to write report to. |
| 378 chrome_app_manifest: Manifest dictionary of input Chrome App. | 378 chrome_app_manifest: Manifest dictionary of input Chrome App. |
| 379 apis: Dictionary mapping Chrome Apps API name to polyfill manifest | 379 apis: Dictionary mapping Chrome Apps API name to polyfill manifest |
| 380 dictionaries. | 380 dictionaries. |
| 381 status: Status representing conversion status of the entire app. | 381 status: Status representing conversion status of the entire app. |
| 382 warnings: List of general warnings logged during conversion. | 382 warnings: List of general warnings logged during conversion. |
| 383 pwa_path: Path to output progressive web app. | 383 web_path: Path to output progressive web app. |
| 384 boilerplate_dir: Boilerplate directory relative to the output directory. |
| 384 """ | 385 """ |
| 385 report = generate(chrome_app_manifest, apis, status, warnings, pwa_path) | 386 report = generate(chrome_app_manifest, apis, status, warnings, web_path, |
| 387 boilerplate_dir) |
| 386 report_path = os.path.join(report_dir, 'report.html') | 388 report_path = os.path.join(report_dir, 'report.html') |
| 387 with open(report_path, 'w') as report_file: | 389 with open(report_path, 'w') as report_file: |
| 388 logging.info('Writing conversion report to `%s`.', report_path) | 390 logging.info('Writing conversion report to `%s`.', report_path) |
| 389 report_file.write(surrogateescape.encode(report)) | 391 report_file.write(surrogateescape.encode(report)) |
| 390 copy_css(report_dir) | 392 copy_css(report_dir) |
| 391 install_bower_dependencies(['lato', 'inconsolata', 'code-prettify'], | 393 install_bower_dependencies(['lato', 'inconsolata', 'code-prettify'], |
| 392 report_dir) | 394 report_dir) |
| OLD | NEW |