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' require 'yaml'
DATADIR='2013/3-autumn'
dir = File.dirname(__FILE__) 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 @@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 @@db_results = YAML.load_file results_yaml
@@dim = @@db_players.length @@dim = @@db_players.length

17
mktable
View File

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