From 939af1f8c5b9b190c6c1d7e9456fbf643434d09e Mon Sep 17 00:00:00 2001 From: vonavi Date: Thu, 21 Nov 2013 19:39:38 +0200 Subject: [PATCH] Tournament table: change in accordance with the current directory structure. --- lib/lorchess/tournament_table.rb | 6 ++++-- mktable | 17 +++++++++-------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/lib/lorchess/tournament_table.rb b/lib/lorchess/tournament_table.rb index 529492b..790559f 100644 --- a/lib/lorchess/tournament_table.rb +++ b/lib/lorchess/tournament_table.rb @@ -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 diff --git a/mktable b/mktable index 73ecff8..55fcedb 100755 --- a/mktable +++ b/mktable @@ -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