This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new 9685d63 Always update the index page run stamp
9685d63 is described below
commit 9685d6376791c462a7118ca102bd3f6fe51fed6e
Author: Sebb <[email protected]>
AuthorDate: Sun Sep 9 14:15:54 2018 +0100
Always update the index page run stamp
---
tools/collate_minutes.rb | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/tools/collate_minutes.rb b/tools/collate_minutes.rb
index 5f2899a..57dcf79 100755
--- a/tools/collate_minutes.rb
+++ b/tools/collate_minutes.rb
@@ -60,6 +60,8 @@ force = ARGV.delete '--force' # rerun regardless
NOSTAMP = ARGV.delete '--nostamp' # don't add dynamic timestamp to pages (for
debug compares)
+stamp = (NOSTAMP ? DateTime.new(1970) : DateTime.now).strftime '%Y-%m-%d
%H:%M'
+
YYYYMMDD = ARGV.first || '20*' # Allow override of minutes to process
MINUTES_NAME = "board_minutes_#{YYYYMMDD}.txt"
@@ -67,17 +69,26 @@ MINUTES_PATH =
"#{SVN_SITE_RECORDS_MINUTES}/*/#{MINUTES_NAME}"
Wunderbar.info "Processing minutes matching #{MINUTES_NAME}"
+INDEX_FILE = "#{SITE_MINUTES}/index.html"
+
# quick exit if everything is up to date
-if File.exist? "#{SITE_MINUTES}/index.html"
+if File.exist? INDEX_FILE
input = Dir[MINUTES_PATH,
"#{BOARD}/board_minutes_20*.txt"].
map {|name| File.stat(name).mtime}.
push(File.stat(__FILE__).mtime, ASF.library_mtime).
max
- if File.stat("#{SITE_MINUTES}/index.html").mtime >= input
+ if File.stat(INDEX_FILE).mtime >= input
Wunderbar.info "All up to date!"
- exit unless force
+ unless force
+ # Add stamp to index page
+ page = File.read(INDEX_FILE)
+ open(INDEX_FILE, 'w') {|file| file.write
+ page.sub(/(Last run: )\d{4}-\d\d-\d\d \d\d:\d\d(\. The data is
extracted from a list of)/,"\\1#{stamp}\\2")
+ }
+ exit
+ end
end
end
@@ -712,7 +723,6 @@ def layout(title = nil)
$calendar.at('title').content = "Board Meeting Minutes"
# $calendar.at('h2').content = "Board Meeting Minutes"
end
- stamp = (NOSTAMP ? DateTime.new(1970) : DateTime.now).strftime '%Y-%m-%d
%H:%M'
# Adjust the page header
@@ -970,6 +980,6 @@ page = layout do |x|
end
end
-open("#{SITE_MINUTES}/index.html", 'w') {|file| file.write page}
+open(INDEX_FILE, 'w') {|file| file.write page}
Wunderbar.info "Wrote #{SITE_MINUTES}/index.html"