summaryrefslogtreecommitdiffstats
path: root/check
blob: f61c47c56e19c621b41583b25b8732548f3c1796 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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