summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2026-03-22 10:20:51 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2026-03-22 10:20:51 +0100
commit787440f7049fdc95894612c3e25ee953c4a2c594 (patch)
treeb662e37c944459f96a4cd1330c45274a48b23959
parent3ab565ec96b186eb88c3708917c862c4b9f9965b (diff)
downloadcolonial-twilight-787440f7049fdc95894612c3e25ee953c4a2c594.zip
colonial-twilight-787440f7049fdc95894612c3e25ee953c4a2c594.tar.gz
add check (rspec & coverage)HEADmaster
-rwxr-xr-xcheck51
1 files changed, 51 insertions, 0 deletions
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 '
+ /<h3>/ {
+ match($0, /<h3>(.*)<\/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