Skip to content

Commit 4cd6442

Browse files
committed
Use template from devstats.scientific-python.org
1 parent e1d5a3e commit 4cd6442

File tree

4 files changed

+626
-3
lines changed

4 files changed

+626
-3
lines changed

devstats/__main__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import requests
99

1010
from .query import GithubGrabber
11+
from .publish import publisher
1112

1213

1314
@click.group()
@@ -62,6 +63,7 @@ def query(repo_owner, repo_name):
6263

6364

6465
@cli.command("publish")
65-
def publish():
66+
@click.argument("project")
67+
def publish(project):
6668
"""Generate myst report for `repo_owner`/`repo_name`."""
67-
click.echo("publish called")
69+
publisher(project)

devstats/publish.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from glob import glob
2+
import sys
3+
import os
4+
5+
6+
def publisher(project):
7+
os.makedirs("_generated", exist_ok=True)
8+
report_files = glob(os.path.join(os.path.dirname(__file__), "reports/*.md"))
9+
10+
for report in report_files:
11+
print(f"Generating {project} report...", end="")
12+
with open(report, "r") as fh:
13+
template = fh.read()
14+
with open(f"_generated/{project}.md", "w") as fh:
15+
fh.write(template.replace("{{ project }}", project))
16+
print("OK")

0 commit comments

Comments
 (0)