| 
									
										
										
										
											2013-10-05 10:50:04 +03:00
										 |  |  | #!/usr/bin/env bash | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | tournament=autumn2013 | 
					
						
							|  |  |  | results=$tournament/results.yml | 
					
						
							|  |  |  | table=_includes/$tournament/tournament_table.html | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Update game results | 
					
						
							|  |  |  | git checkout master | 
					
						
							|  |  |  | ./tour-parse > $results | 
					
						
							|  |  |  | git add $results | 
					
						
							|  |  |  | git commit -m "Update game results." | 
					
						
							| 
									
										
										
										
											2013-10-09 11:22:53 +03:00
										 |  |  | # Successful `git commit' returns exit code `0' | 
					
						
							|  |  |  | ret_code=$? | 
					
						
							| 
									
										
										
										
											2013-10-05 10:50:04 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-10-09 11:22:53 +03:00
										 |  |  | if [[ $ret_code == 0 ]]; then | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-10-09 12:44:33 +03:00
										 |  |  |     # Check the difference between game results | 
					
						
							|  |  |  |     git diff HEAD^ HEAD -- $results | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-10-09 11:22:53 +03:00
										 |  |  |     # Update the tournament table | 
					
						
							|  |  |  |     bin/lorchess > temp_table.html | 
					
						
							|  |  |  |     git checkout gh-pages | 
					
						
							|  |  |  |     mv temp_table.html $table | 
					
						
							|  |  |  |     git add $table | 
					
						
							|  |  |  |     git commit -m "Update the tournament table." | 
					
						
							|  |  |  |     git checkout master | 
					
						
							|  |  |  | fi |