summary refs log tree commit diff stats
path: root/ganarchy/templating/templates.py
diff options
context:
space:
mode:
authorSoniEx2 <endermoneymod@gmail.com>2020-07-19 22:06:00 -0300
committerSoniEx2 <endermoneymod@gmail.com>2020-07-19 22:06:00 -0300
commit6e3ac343e67adea503afef98651ea134526e0453 (patch)
tree9fd18256eb2cfbd00e5657a8296077236f3821b7 /ganarchy/templating/templates.py
parentaf3fb6c6eb233af00229a908bab92afbf38bad0b (diff)
Partially restore cron-target functionality
Restored functionality:

- Can use `config`, `project-list` and `index` targets

Still broken:

- `cron-target` with a project doesn't work yet
Diffstat (limited to 'ganarchy/templating/templates.py')
-rw-r--r--ganarchy/templating/templates.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/ganarchy/templating/templates.py b/ganarchy/templating/templates.py
index 0f691e0..213a7fa 100644
--- a/ganarchy/templating/templates.py
+++ b/ganarchy/templating/templates.py
@@ -53,9 +53,9 @@ def get_template_loader():
         <h1>{{ ganarchy.title|e }}</h1>
         <p>This is {{ ganarchy.title|e }}. Currently tracking the following projects:</p>
         <ul>
-        {% for project in ganarchy.projects -%}
+        {% for project in ganarchy.projects -%}{% if project.exists -%}
             <li><a href="/project/{{ project.commit|e }}">{{ project.title|e }}</a>: {{ project.description|e }}</li>
-        {% endfor -%}
+        {% endif -%}{% endfor -%}
         </ul>
         <p>Powered by <a href="https://ganarchy.autistic.space/">GAnarchy</a>. AGPLv3-licensed. <a href="https://cybre.tech/SoniEx2/ganarchy">Source Code</a>.</p>
         <p>
@@ -67,11 +67,10 @@ def get_template_loader():
             ## index.toml
             'index.toml': """# Generated by GAnarchy
 
-{%- for project, repos in config.projects.items() %}
+{%- for project in database.list_projects() %}
 [projects.{{project}}]
-{%- for repo_url, branches in repos.items() %}{% for branch, options in branches.items() %}{% if options.active %}
-"{{repo_url|tomle}}".{% if branch %}"{{branch|tomle}}"{% else %}HEAD{% endif %} = { active=true }
-{%- endif %}{% endfor %}
+{%- for repo_url, branch, _head_commit in database.list_repobranches(project) %}
+"{{repo_url|tomle}}".{% if branch == "HEAD" %}HEAD{% else %}"{{branch|tomle}}"{% endif %} = { active=true }
 {%- endfor %}
 {% endfor -%}
 """,