From 707c6b37e0ce8e930f8510f064b9bcbbfe1894b6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mikl=C3=B3s=20T=C3=B3th?= <tothmiklostibor@gmail.com>
Date: Mon, 10 May 2021 01:56:06 +0200
Subject: [PATCH] meh.

---
 .gitlab-ci.yml         | 15 +++++++++++++--
 docs/linecounter.sh    | 31 +++++++++++++++++++++++++++++++
 docs/weeks/14/14_1.tex |  8 ++++----
 3 files changed, 48 insertions(+), 6 deletions(-)
 create mode 100755 docs/linecounter.sh

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 0ca3d462..0e6f97a0 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -3,11 +3,20 @@ image: projlab/projlab:13.1.1
 stages:
   - build
   - getjar
-  - docs
   - test
+  - docs
   - zip
   - telegram
 
+Line count:
+  stage: test
+  needs: []
+  script:
+    - docs/linecount.sh
+  artifacts:
+    paths:
+      - docs/lines
+
 Docs:
   stage: docs
   script:
@@ -17,6 +26,7 @@ Docs:
   needs:
     - Jar
     - Get tester jar
+    - Line count
   artifacts:
     paths:
       - docs/projlab.pdf
@@ -27,7 +37,8 @@ Merged:
   script:
     - export TZ=Europe/Budapest
     - docs/magic.sh
-  needs: []
+  needs:
+    - Line count
   artifacts:
     paths:
       - docs/merged.pdf
diff --git a/docs/linecounter.sh b/docs/linecounter.sh
new file mode 100755
index 00000000..1a55af78
--- /dev/null
+++ b/docs/linecounter.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+if [ "$0" != "/tmp/lines/linecount.sh" ]; then
+  mkdir -p /tmp/lines
+  cp "$0" /tmp/lines/linecount.sh
+  cd "$(dirname "$0")" || exit 1
+  cd ../src || exit 1
+  exec /tmp/lines/linecount.sh
+fi
+
+total=0
+
+hash="$(git rev-parse HEAD)"
+
+for week in w6 w10 w13; do
+  echo "week $week incoming..."
+  git clean -fd
+  git checkout "w${week}"
+
+  curr=$(wc -l $(find src -name "*.java") | grep total | awk '{print $1}')
+  echo "$curr" > "/tmp/lines/$week"
+  total=$(("$total" + "$curr"))
+
+  git reset --hard "w${week}"
+done
+
+echo "$total" > /tmp/lines/total
+
+git checkout "$hash"
+
+cp -r /tmp/lines docs/
\ No newline at end of file
diff --git a/docs/weeks/14/14_1.tex b/docs/weeks/14/14_1.tex
index 845c3757..97cb01be 100644
--- a/docs/weeks/14/14_1.tex
+++ b/docs/weeks/14/14_1.tex
@@ -10,9 +10,9 @@
     \hline
     \endhead
 
-    Szkeleton& nem is írtunk kódot\\ \hline
-    Prototípus& itt a tervezés tervezésének az ellenőrzésének a tervezésével foglalkoztunk...\\ \hline
-    Grafikus változat& itt már a dokumentációból mágikusan kigenerálódott kódot használtuk, tehát mi nem írtunk egy sort se\\ \hline
-    \textbf{Összesen}& nem\\ \hline
+    Szkeleton & \input{lines/w6} \\ \hline
+    Prototípus & \input{lines/w10} \\ \hline
+    Grafikus változat& \input{lines/w13} \\ \hline
+    \textbf{Összesen}& \input{lines/total} \\ \hline
 
 \end{xltabular}
\ No newline at end of file
-- 
GitLab