| Conditions | 5 |
| Total Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | """Utilities for dealing with static assets -- downloading, etc...""" |
||
| 11 | @click.command() |
||
| 12 | @click.option('--js', |
||
| 13 | default=True, |
||
| 14 | help='Download JS assets?') |
||
| 15 | @click.option('--css', |
||
| 16 | default=True, |
||
| 17 | help='Download CSS assets?') |
||
| 18 | def get_remote_assets(css, js): |
||
| 19 | """Download all static assets for the library to local source.""" |
||
| 20 | print('Downloading remote assets: JS? {} / CSS? {}'.format(css, js)) |
||
| 21 | for family, config in CHARTS_CONFIG.items(): |
||
| 22 | if js and config['js_url'] is not None: |
||
| 23 | for url in config['js_url']: |
||
| 24 | file = url.split('/')[-1] |
||
| 25 | print(file) |
||
| 26 | host = url.replace(file, '') |
||
| 27 | print('Downloading: {file} from {host}'.format( |
||
| 28 | file=file, host=host)) |
||
| 29 | path = 'flask_jsondash/static/js/vendor/{file}'.format( |
||
| 30 | file=file) |
||
| 31 | os.system('curl -XGET {url} > {path}'.format( |
||
| 32 | url=url, path=path)) |
||
| 33 | # if js: |
||
| 38 |