Add Beeminder support
This commit is contained in:
parent
f58bff3ff4
commit
350daf1615
@ -15,5 +15,6 @@
|
|||||||
"discipline": "none",
|
"discipline": "none",
|
||||||
"specialization": "none",
|
"specialization": "none",
|
||||||
"supervisor": "none",
|
"supervisor": "none",
|
||||||
"album_no": "none"
|
"album_no": "none",
|
||||||
|
"beeminder_support": "no"
|
||||||
}
|
}
|
||||||
|
@ -135,6 +135,10 @@ if [ "{{ cookiecutter.extra_locale }}" = "pl_PL" -o "{{ cookiecutter.locale }}"
|
|||||||
cp -r _optional_files/_pl_files/* .
|
cp -r _optional_files/_pl_files/* .
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "{{ cookiecutter.beeminder_support }}" = "yes" ]; then
|
||||||
|
cp -r _optional_files/_beeminder_support/* .
|
||||||
|
fi
|
||||||
|
|
||||||
rm -rf _latex-templates _optional_files
|
rm -rf _latex-templates _optional_files
|
||||||
|
|
||||||
if [ -e .git ]; then
|
if [ -e .git ]; then
|
||||||
|
@ -16,3 +16,4 @@ default_context:
|
|||||||
specialization: '{{ cookiecutter.specialization }}'
|
specialization: '{{ cookiecutter.specialization }}'
|
||||||
supervisor: '{{ cookiecutter.supervisor }}'
|
supervisor: '{{ cookiecutter.supervisor }}'
|
||||||
album_no: '{{ cookiecutter.album_no }}'
|
album_no: '{{ cookiecutter.album_no }}'
|
||||||
|
beeminder: '{{ cookiecuter.beeminder_support }}'
|
||||||
|
@ -49,6 +49,11 @@ stats.txt: $(PAPER_ID).pdf helpers/stats.sh
|
|||||||
bash helpers/stats.sh $< > $@
|
bash helpers/stats.sh $< > $@
|
||||||
cat $@
|
cat $@
|
||||||
|
|
||||||
|
{% if cookiecutter.beeminder_support == 'yes' %}
|
||||||
|
logbeeminder: helpers/logbeeminder.py stats.txt
|
||||||
|
python3 $<
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
$(PAPER_ID).pdf: $(PAPER_ID).tex preamble.tex metadata.tex $(CONTENT_TEX_SOURCES) bibliography.bib $(SCOREFILES) $(EXTRA_PDFS)
|
$(PAPER_ID).pdf: $(PAPER_ID).tex preamble.tex metadata.tex $(CONTENT_TEX_SOURCES) bibliography.bib $(SCOREFILES) $(EXTRA_PDFS)
|
||||||
pdflatex $<
|
pdflatex $<
|
||||||
bibtex $(PAPER_ID)
|
bibtex $(PAPER_ID)
|
||||||
|
@ -0,0 +1,37 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import time
|
||||||
|
from pyminder.pyminder import Pyminder
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
if 'BEEMINDER_USER' not in os.environ:
|
||||||
|
print('BEEMINDER_USER not set', file=sys.stderr)
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
if 'BEEMINDER_TOKEN' not in os.environ:
|
||||||
|
print('BEEMINDER_TOKEN not set', file=sys.stderr)
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
beeminder_user = os.environ['BEEMINDER_USER']
|
||||||
|
beeminder_token = os.environ['BEEMINDER_TOKEN']
|
||||||
|
|
||||||
|
|
||||||
|
pyminder = Pyminder(user=beeminder_user, token=beeminder_token)
|
||||||
|
|
||||||
|
goal = pyminder.get_goal('{{cookiecutter.paper_id}}')
|
||||||
|
|
||||||
|
with open('stats.txt', 'r') as stats_fh:
|
||||||
|
next(stats_fh)
|
||||||
|
stats = next(stats_fh)
|
||||||
|
page_count, _, _ = stats.split('\t')
|
||||||
|
|
||||||
|
print(f'reporting {page_count} pages', file=sys.stderr)
|
||||||
|
|
||||||
|
now = time.time()
|
||||||
|
|
||||||
|
goal.stage_datapoint(value=page_count,
|
||||||
|
time=now)
|
||||||
|
|
||||||
|
goal.commit_datapoints()
|
Loading…
Reference in New Issue
Block a user