From 69bf2705c4fe5da49216078b1dfd969863ba0210 Mon Sep 17 00:00:00 2001 From: callum-zero1 Date: Tue, 18 Jul 2023 11:08:42 +0000 Subject: [PATCH] - feat: Add generator version number to Satis HTML --- .dockerignore | 4 +- Dockerfile | 1 + bin/docker-entrypoint.sh | 10 ++ mageos.html.twig | 201 +++++++++++++++++++++++++++++++++++++++ satis.json | 3 +- 5 files changed, 217 insertions(+), 2 deletions(-) create mode 100644 mageos.html.twig diff --git a/.dockerignore b/.dockerignore index 786bb90..95a94fd 100644 --- a/.dockerignore +++ b/.dockerignore @@ -9,4 +9,6 @@ # unignored files !/satis.json -!/LICENSE \ No newline at end of file +!/LICENSE +!/mageos.html.twig +!/package.json \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 8808885..ea769e1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,6 +19,7 @@ RUN chmod +x /usr/local/bin/install-php-extensions && \ WORKDIR /generate-repo COPY . /generate-repo +RUN chmod -R 0777 /satis/views RUN mkdir /generate-repo/repositories && chmod 0777 /generate-repo/repositories && chmod -R 0777 /satis/vendor/composer diff --git a/bin/docker-entrypoint.sh b/bin/docker-entrypoint.sh index d20be63..013c1eb 100755 --- a/bin/docker-entrypoint.sh +++ b/bin/docker-entrypoint.sh @@ -85,6 +85,16 @@ cd /satis cp /generate-repo/satis.json /tmp/satis.json } +# Add generator version number to Satis HTML +cp /generate-repo/mageos.html.twig ./views/mageos.html.twig + +GENERATOR_VERSION=$(cat /generate-repo/package.json \ + | grep version \ + | head -1 \ + | awk -F: '{ print $2 }' \ + | sed 's/[",]//g') + +printf "%s" "$GENERATOR_VERSION" > ./views/version # Build satis into /build /satis/bin/satis build /tmp/satis.json /build diff --git a/mageos.html.twig b/mageos.html.twig new file mode 100644 index 0000000..52caf2c --- /dev/null +++ b/mageos.html.twig @@ -0,0 +1,201 @@ + + + + + + + + + + + {{ name|default('Composer repository') }} + + + + + + +
+
+
+ +

{{ name|default('Composer repository') }}

+
+ + Last updated:
+
+ + MageOS generator version:
{{ source('version') }} +
+
+ + {% if description %} +

{{ description|raw }}

+ {% endif %} +
+ +
+
+ + + +
+ +
+
+
+ + +
+

+ This is a private Composer repository. + To use it, you have to add this repository to your composer.json file. +

+ + +
+ +
+ {% for name, package in packages %} + {% include 'package.html.twig' %} + {% endfor %} +
+ +
+

This Composer repository is powered by Satis

+
+
+ +
+ + + +
+ +
+
+ + + + + + + + + \ No newline at end of file diff --git a/satis.json b/satis.json index 76059ec..1b7c816 100644 --- a/satis.json +++ b/satis.json @@ -8,5 +8,6 @@ "url": "/build/packages" } ], - "require-all": true + "require-all": true, + "twig-template": "views/mageos.html.twig" }