def generate_index(): html = "" # Generate content rels = releases.get_all_releases_dicts() rels.reverse() for release in rels: html += HTML_release(release) base_dir = os.path.dirname(os.path.abspath(__file__)) index_fp = os.path.join(base_dir, "web", "index.html") templ_fp = os.path.join(base_dir, "web", "template.html") # Template tpl = open(templ_fp, "r").read() tpl = tpl.replace("${{MAIN}}", html) tpl = tpl.replace("${{HEADERS}}", "") with open(index_fp, "w+") as f: f.write(tpl)
def generate_release_commits_HTML_report(): # Periods = Releases + Global periods = releases.get_all_releases_dicts() # Generate reports for r in periods: for proj_name in r['projects']: # Generate report report = HTML_Report_Period_Commits (proj_name, date_start = r["period"][0], date_end = r["period"][1]) base_dir = os.path.dirname (os.path.abspath(__file__)) json_dir = os.path.join (base_dir, "web", "json") if not os.path.exists (json_dir): os.makedirs (json_dir) # Write JSON file report_name = '%s-%s.js' %(proj_name, r['name'].lower()) report_path = os.path.join (json_dir, report_name) print ("Writing %s..." %(report_path)) with open(report_path, 'w+') as f: f.write (report.get_JSON())