X-Git-Url: https://git.draconx.ca/gitweb/homepage.git/blobdiff_plain/ec1703ff7346b6d3edeee73f1c6dfa750b7aeed4..5aa756ee68dc2134b6acac8a66af2f1c14521721:/Rules diff --git a/Rules b/Rules index a881607..2460c14 100644 --- a/Rules +++ b/Rules @@ -16,10 +16,12 @@ # along with this program. If not, see . preprocess do + system("git", "submodule", "update", "--init") + # Remove dead annex keys from processing @items.delete_if do |item| - l = File.readlink(item.raw_filename) - true if !File.exists?(item.raw_filename) and l =~ %r{/annex/objects/} + l = File.readlink(item.raw_filename) + true if !File.exists?(item.raw_filename) and l =~ %r{/annex/objects/} rescue Errno::EINVAL end @@ -47,6 +49,25 @@ preprocess do item[:updated_at] ||= item[:updated] || File.stat(item.raw_filename).mtime end + + archivedirs = {} + @items.find_all('/archive/**/*').each do |item| + dir = File.dirname(item.identifier) + while dir != "/" + archivedirs[dir] = true + dir = File.dirname(dir) + end + end + + archivedirs.keys.sort_by{ |s| -s.length }.each do |dir| + attrs = { + pattern: "#{dir}/*{,/index.lst}", + title: "Index of #{dir}", + gitrev: commit, + } + + @items.create("", attrs, "#{dir}/index.lst") + end end postprocess do @@ -67,8 +88,11 @@ postprocess do # Register URLs for git-annex keys unless (uribase = ENV['ANNEX_URI_BASE'].to_s.chomp("/")).empty? - Open3.popen2("git", "annex", "registerurl") do |stdin, stdout, result| + Open3.popen2("git", "-c", "core.bare=false", "annex", "registerurl") do + |stdin, stdout, result| @items.each do |item| + next if item.raw_filename.nil? + l = File.readlink(item.raw_filename) next unless l =~ %r{/annex/objects/} @@ -104,6 +128,17 @@ postprocess do end end +compile '/**/index.lst' do + layout '/listing.xhtml' + filter :erb + layout '/default.xml' + layout '/default.xsl' + filter :relativize_paths, type: :xml + filter :xhtml_compat + filter :remove_wj + write item.identifier.without_ext + ".xhtml" +end + compile '/license/gpl*.md' do filter :kramdown, auto_ids: false, header_offset: -1 layout '/default.xml' @@ -149,8 +184,9 @@ compile '/license/cc*.xhtml' do end compile '/images/*.jpg', rep: :large do - filter :imgresize, width: 1200, height: 1200 - write item.identifier.without_ext + '-t1200.' + item.identifier.ext + filename = item.identifier.without_ext + '-t1200.' + item.identifier.ext + filter :imgresize, width: 1200, height: 1200, cache: filename + write filename end compile '/images/*.jpg', rep: :info do