about summary refs log tree commit homepage
path: root/Rakefile
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-01-18 07:18:07 +0000
committerEric Wong <e@80x24.org>2016-01-18 07:18:07 +0000
commitefb0302b9a55838552b17eef2387ac53d24269d1 (patch)
tree08da480aac8d0a199e728e9f53984c42f941087f /Rakefile
parent3083b7fbe2bc6e8dcd935b10bb7a165257c5252b (diff)
downloaddtas-efb0302b9a55838552b17eef2387ac53d24269d1.tar.gz
We should not be busting caches and wasting visitor's bandwidth
for unmodified files.
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile15
1 files changed, 11 insertions, 4 deletions
diff --git a/Rakefile b/Rakefile
index 075260b..c710c7a 100644
--- a/Rakefile
+++ b/Rakefile
@@ -101,19 +101,26 @@ task rsync_docs: %w(NEWS NEWS.atom) do
   # Also available at: http://yhbt.net/git-set-file-times
   # on Debian systems: /usr/share/doc/rsync/scripts/git-set-file-times.gz
   sh("git", "set-file-times", "Documentation", "examples", *top)
+  make = ENV['MAKE'] || 'make'
+  sh(%Q(#{make} -C Documentation))
+  examples = `git ls-files examples`.split("\n")
 
-  `git ls-files Documentation/*.txt`.split(/\n/).concat(top).each do |txt|
+  gzip_touch = lambda do |txt|
     gz = "#{txt}.gz"
     tmp = "#{gz}.#$$"
-    sh("gzip -9 < #{txt} > #{tmp}")
+    sh("gzip -9 <#{txt} >#{tmp}")
     st = File.stat(txt)
     File.utime(st.atime, st.mtime, tmp) # make nginx gzip_static happy
     File.rename(tmp, gz)
+    gz
+  end
+
+  Dir['Documentation/*.txt'].to_a.concat(top).each do |txt|
     files << txt
-    files << gz
+    files << gzip_touch[txt]
   end
   sh("rsync --chmod=Fugo=r -av #{files.join(' ')} #{dest}")
 
-  examples = `git ls-files examples`.split("\n")
+  examples = examples.map { |txt| [ txt, gzip_touch[txt] ] }
   sh("rsync --chmod=Fugo=r -av #{examples.join(' ')} #{dest}/examples/")
 end