From 787440f7049fdc95894612c3e25ee953c4a2c594 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Sun, 22 Mar 2026 10:20:51 +0100 Subject: add check (rspec & coverage) --- check | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100755 check diff --git a/check b/check new file mode 100755 index 0000000..f61c47c --- /dev/null +++ b/check @@ -0,0 +1,51 @@ +#! /bin/bash + +clear +FILES=" + deck \ + board \ + actions \ + turn +" +echo "--" +echo "check dependencies" +for file in $FILES +do + echo "* check ${file}" + grep require_relative "./lib/colonial_twilight/$file.rb" | grep -v '#' | sed "s@.*require_relative '\(.*\)'@ \1@" + ruby -Ilib "./lib/colonial_twilight/$file.rb" +done + +FILES=" + forces \ + spaces \ + board \ + turn \ + fln_actions +" +echo "--" +echo "check coverage" +rm -fr coverage +files="" +for file in $FILES +do + files="$files ./spec/${file}_spec.rb" +done +rspec $files +echo "--" +awk ' + /

/ { + match($0, /

(.*)<\/h3>/, arr); file = arr[1] + } + /[0-9.]*%/ { + match($0, /([0-9.]+)%/, arr); last_pct = arr[1] + } + /lines covered/ { + if (file != "") { + print file ": " last_pct "%" + file = "" + } + } +' coverage/index.html +echo "--" +echo -- cgit v1.1-2-g2b99