| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2016 The LUCI Authors. All rights reserved. | 2 # Copyright 2016 The LUCI Authors. All rights reserved. |
| 3 # Use of this source code is governed under the Apache License, Version 2.0 | 3 # Use of this source code is governed under the Apache License, Version 2.0 |
| 4 # that can be found in the LICENSE file. | 4 # that can be found in the LICENSE file. |
| 5 | 5 |
| 6 """Manages web/ resource checkout and building. | 6 """Manages web/ resource checkout and building. |
| 7 | 7 |
| 8 This script can be run in one of three modes: | 8 This script can be run in one of three modes: |
| 9 - As "initialize.py", it will perform resource dependency checkout for | 9 - As "initialize.py", it will perform resource dependency checkout for |
| 10 "luci_deploy" and quit. | 10 "luci_deploy" and quit. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 system. Please install Node.js and NPM. Installation instructions can be found | 54 system. Please install Node.js and NPM. Installation instructions can be found |
| 55 at: | 55 at: |
| 56 https://docs.npmjs.com/getting-started/installing-node | 56 https://docs.npmjs.com/getting-started/installing-node |
| 57 """ | 57 """ |
| 58 raise Exception('Unable to locate Node.js installation.') | 58 raise Exception('Unable to locate Node.js installation.') |
| 59 tc = cls(web_dir, *node_js) | 59 tc = cls(web_dir, *node_js) |
| 60 | 60 |
| 61 # Install NPM deps from "package.json". | 61 # Install NPM deps from "package.json". |
| 62 def install_npm_deps(): | 62 def install_npm_deps(): |
| 63 tc.npm('install', cwd=web_dir) | 63 tc.npm('install', cwd=web_dir) |
| 64 tc.npm('prune', cwd=web_dir) |
| 64 cls._call_if_outdated( | 65 cls._call_if_outdated( |
| 65 install_npm_deps, | 66 install_npm_deps, |
| 66 os.path.join(web_dir, '.npm.installed'), | 67 os.path.join(web_dir, '.npm.installed'), |
| 67 os.path.join(web_dir, 'package.json'), | 68 os.path.join(web_dir, 'package.json'), |
| 68 [os.path.join(web_dir, 'node_modules')], | 69 [os.path.join(web_dir, 'node_modules')], |
| 69 force) | 70 force) |
| 70 | 71 |
| 71 # Install Bower deps from "bower.json". | 72 # Install Bower deps from "bower.json". |
| 72 def install_bower_deps(): | 73 def install_bower_deps(): |
| 73 tc.bower('install', cwd=web_dir) | 74 tc.bower('install', cwd=web_dir) |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 return _main_initialize(args) | 289 return _main_initialize(args) |
| 289 elif script_name == 'build.py': | 290 elif script_name == 'build.py': |
| 290 return _main_deploy(args) | 291 return _main_deploy(args) |
| 291 else: | 292 else: |
| 292 return _main(args) | 293 return _main(args) |
| 293 | 294 |
| 294 | 295 |
| 295 if __name__ == '__main__': | 296 if __name__ == '__main__': |
| 296 logging.basicConfig(level=logging.INFO) | 297 logging.basicConfig(level=logging.INFO) |
| 297 sys.exit(main(sys.argv)) | 298 sys.exit(main(sys.argv)) |
| OLD | NEW |