Tournament table: change in accordance with the current directory structure.

This commit is contained in:
vonavi 2013-11-21 19:39:38 +02:00
parent 130b6b555e
commit 939af1f8c5
2 changed files with 13 additions and 10 deletions

View File

@ -5,10 +5,12 @@ module LORChess
require 'yaml'
DATADIR='2013/3-autumn'
dir = File.dirname(__FILE__)
players_yaml = File.expand_path('../../autumn2013/players.yml', dir)
players_yaml = File.expand_path("../../#{DATADIR}/players.yml", dir)
@@db_players = YAML.load_file players_yaml
results_yaml = File.expand_path('../../autumn2013/results.yml', dir)
results_yaml = File.expand_path("../../#{DATADIR}/results.yml", dir)
@@db_results = YAML.load_file results_yaml
@@dim = @@db_players.length

17
mktable
View File

@ -1,13 +1,14 @@
#!/usr/bin/env bash
tournament=autumn2013
results=$tournament/results.yml
table=_includes/$tournament/tournament_table.html
YEAR=2013
TOURNAMENT=3-autumn
RESULTS=$YEAR/$TOURNAMENT/results.yml
TABLE=_includes/$TOURNAMENT/table.html
# Update game results
git checkout master
./tour-parse > $results
git add $results
./tour-parse > $RESULTS
git add $RESULTS
git commit -m "Update game results."
# Successful `git commit' returns exit code `0'
ret_code=$?
@ -15,13 +16,13 @@ ret_code=$?
if [[ $ret_code == 0 ]]; then
# Check the difference between game results
git diff HEAD^ HEAD -- $results
git diff HEAD^ HEAD -- $RESULTS
# Update the tournament table
bin/lorchess > temp_table.html
git checkout gh-pages
mv temp_table.html $table
git add $table
mv temp_table.html $TABLE
git add $TABLE
git commit -m "Update the tournament table."
git checkout master
fi