Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- import json
- import subprocess
- import os.path
- from glob import glob
- import difflib
- for dash in glob('*.dashboard.py'):
- base = dash.split('.', 1)[0]
- json_filename = '{}-dashboard.json'.format(base)
- subprocess.check_call([
- 'generate-dashboard', dash, '-o', json_filename,
- ])
- with open(json_filename, 'rt') as f:
- got_dashboard = json.load(f)
- got_dashboard_json = json.dumps(got_dashboard, sort_keys=True, indent=2)
- with open(os.path.join('jsons', json_filename)) as f:
- ref_dashboard = json.load(f)
- ref_dashboard_json = json.dumps(ref_dashboard, indent=2, sort_keys=True)
- differ = difflib.HtmlDiff(tabsize=2, wrapcolumn=80)
- html = differ.make_file(
- ref_dashboard_json.splitlines(), got_dashboard_json.splitlines()
- )
- with open('{}.diff.html'.format(base), 'wt') as f:
- f.write(html)
Add Comment
Please, Sign In to add comment