X-Git-Url: http://git.draconx.ca/gitweb/homepage.git/blobdiff_plain/1dc021529f88ca4f1ebfed76ffe6378272a23032..b6d30bd05c54078bbf60e7242aabff21ed4492da:/Rules diff --git a/Rules b/Rules index 477d46d..79dc5f4 100644 --- a/Rules +++ b/Rules @@ -21,13 +21,28 @@ preprocess do stdin.close val = stdout.gets stdout.close - if result.value.success? then commit = val.chomp end + commit = val.chomp if result.value.success? end if commit then @items.each do |item| - if item_source(item) then - item[:gitrev] = commit + item[:gitrev] = commit if item_source(item) + end + end +end + +postprocess do + # Gzip all text items for nginx http_static + if !ENV['GZIP_SITE'].to_s.empty? + reps = @items.flat_map(&:reps).each do |rep| + file = rep.raw_path + next if !file or rep.binary? + + if system("gzip", "-ck9", file, [:out]=>[file + ".gz.tmp", "wb"]) + system("touch", "-r", file, file + ".gz.tmp") + File.rename(file + ".gz.tmp", file + ".gz") + else + File.unlink(file + ".gz.tmp") end end end @@ -38,6 +53,26 @@ compile '/**/*.md' do layout '/default.xml' layout '/default.xsl' filter :relativize_paths, type: :xml + filter :remove_wj + write to_xhtml +end + +compile '/license/cc*.sgml' do + filter :sgml2xml + layout '/creativecommons.xsl' + layout '/default.xml' + layout '/default.xsl' + filter :relativize_paths, type: :xml + filter :remove_wj + write to_xhtml +end + +compile '/license/cc*.xhtml' do + layout '/creativecommons.xsl' + layout '/default.xml' + layout '/default.xsl' + filter :relativize_paths, type: :xml + filter :remove_wj write to_xhtml end