diff options
author | Eric Wong <normalperson@yhbt.net> | 2013-08-25 07:38:45 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2013-08-25 07:40:27 +0000 |
commit | 36c5405d5e3020b1eaacda41ba1f48160a03681b (patch) | |
tree | e33b9cd07bab3850982fb75d6d97864b2021e552 | |
parent | 8a1c627c0a4e7b324f22c15132ba68848a401019 (diff) | |
download | dtas-36c5405d5e3020b1eaacda41ba1f48160a03681b.tar.gz |
This allows gzip_static in nginx to serve files more efficiently. While we're at it, replace some system() calls with sh() which fails appropriately.
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | .rsync_doc | 3 | ||||
-rw-r--r-- | Rakefile | 23 |
3 files changed, 17 insertions, 10 deletions
@@ -7,3 +7,4 @@ *.log /man *.gem +*.gz diff --git a/.rsync_doc b/.rsync_doc deleted file mode 100644 index 9bdd99c..0000000 --- a/.rsync_doc +++ /dev/null @@ -1,3 +0,0 @@ -INSTALL -NEWS -README @@ -59,9 +59,20 @@ h = Hoe.spec('dtas') do |p| end task :rsync_docs do - dest = "80x24.org:/srv/dtas/" - system("rsync --chmod=Fugo=r --files-from=.rsync_doc -av ./ #{dest}") - system("rsync --chmod=Fugo=r -av ./Documentation/*.txt #{dest}") + dest = ENV["RSYNC_DEST"] || "80x24.org:/srv/dtas/" + top = %w(INSTALL NEWS README COPYING) + files = [] + Dir['Documentation/*.txt'].to_a.concat(top).each do |txt| + gz = "#{txt}.gz" + tmp = "#{gz}.#$$" + 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) + files << txt + files << gz + end + sh("rsync --chmod=Fugo=r -av #{files.join(' ')} #{dest}") end task :coverage do @@ -81,8 +92,7 @@ task tarball: "pkg/#{base}" do Dir.chdir("pkg") do tgz = "#{base}.tar.gz" tmp = "#{tmp}.#$$" - cmd = "tar cf - #{base} | gzip -9 > #{tmp}" - system(cmd) or abort "#{cmd}: #$?" + sh "tar cf - #{base} | gzip -9 > #{tmp}" File.rename(tmp, tgz) end end @@ -90,8 +100,7 @@ end task dist: [ :tarball, :package ] do Dir.chdir("pkg") do %w(dtas-linux dtas-mpris).each do |gem| - cmd = "gem build ../#{gem}.gemspec" - system(cmd) or abort "#{cmd}: #$?" + sh "gem build ../#{gem}.gemspec" end end end |