From: Nick Bowler Date: Sun, 14 Feb 2021 19:26:35 +0000 (-0500) Subject: Release slotifier-1. X-Git-Url: https://git.draconx.ca/gitweb/homepage.git/commitdiff_plain/79dfd09162d1c4e201eccec188057c0e9ded2260 Release slotifier-1. Mostly a trial to see if we can get all the infrastructure in place to release tarballs tarballs on the website. Newly introduced is an "archive" directory, which provides for browseable file listings, as well as the ability to link to the most recent tar file in the generated project descriptions. --- diff --git a/Rules b/Rules index d48f287..2460c14 100644 --- a/Rules +++ b/Rules @@ -49,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 @@ -72,6 +91,8 @@ postprocess do 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/} @@ -107,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' diff --git a/content/archive/slotifier/slotifier-1.tar.gz b/content/archive/slotifier/slotifier-1.tar.gz new file mode 120000 index 0000000..b0fdf2a --- /dev/null +++ b/content/archive/slotifier/slotifier-1.tar.gz @@ -0,0 +1 @@ +../../../.git/annex/objects/M6/75/SHA512-s650123--072fbd99ff994c48b835032105f93010f5860246c8e1576929ff9fa904319dbb627e4d09224dd91924c83b71d2ce75fcf1206f84d73d352fa4b7376238a867c6/SHA512-s650123--072fbd99ff994c48b835032105f93010f5860246c8e1576929ff9fa904319dbb627e4d09224dd91924c83b71d2ce75fcf1206f84d73d352fa4b7376238a867c6 \ No newline at end of file diff --git a/content/archive/slotifier/slotifier-1.tar.gz.sig b/content/archive/slotifier/slotifier-1.tar.gz.sig new file mode 120000 index 0000000..2a96fa5 --- /dev/null +++ b/content/archive/slotifier/slotifier-1.tar.gz.sig @@ -0,0 +1 @@ +../../../.git/annex/objects/5q/G1/SHA512-s310--910f2cb0a1e665756be0e19cac03288ef2c0bf53c8b3b4e78c76bbf5a8e1a240b0f90d5e397dc1335623b4782beb56a5ab2fb7cbc86aca639e65a81ea1a0a91e/SHA512-s310--910f2cb0a1e665756be0e19cac03288ef2c0bf53c8b3b4e78c76bbf5a8e1a240b0f90d5e397dc1335623b4782beb56a5ab2fb7cbc86aca639e65a81ea1a0a91e \ No newline at end of file diff --git a/content/images/folder.svg b/content/images/folder.svg new file mode 100644 index 0000000..79b25c3 --- /dev/null +++ b/content/images/folder.svg @@ -0,0 +1,424 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Folder Icon + + + + Jakub Steiner + + + + http://jimmac.musichall.cz + + + folder + directory + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/content/images/return.svg b/content/images/return.svg new file mode 100644 index 0000000..d3cce96 --- /dev/null +++ b/content/images/return.svg @@ -0,0 +1,230 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + Jakub Steiner + + + http://jimmac.musichall.cz + + Edit Undo + + + edit + undo + revert + + + + + + + + + + + + + + + + + diff --git a/content/projects/slotifier.md b/content/projects/slotifier.md index 9e846b4..2a00479 100644 --- a/content/projects/slotifier.md +++ b/content/projects/slotifier.md @@ -3,6 +3,7 @@ title: Slotifier copyright: 2021 Nick Bowler license: gpl-3 or (at your option) any later version module: slotifier +release: v1 --- <%= project_readme %> diff --git a/content/style.scss b/content/style.scss index 82b8720..0c56cc4 100644 --- a/content/style.scss +++ b/content/style.scss @@ -137,6 +137,19 @@ table.cc { } } +table.filelist { + &>tr>*:first-child, &>*>tr>*:first-child { + &+td { min-width: 50%; } + width: 0; + } + + img { + display: block; + height: 1.5em; + width: auto; + } +} + // Site header rules #breadcrumbs>*, #sitetitle>* { font-size: 0.8em; } #breadcrumbs { diff --git a/gitmodules/slotifier b/gitmodules/slotifier index dd3142f..d30a4f5 160000 --- a/gitmodules/slotifier +++ b/gitmodules/slotifier @@ -1 +1 @@ -Subproject commit dd3142f8ab42703ccb91cd9a3e21ded0801bd228 +Subproject commit d30a4f5730dc9358523db5129a85b1f62c82981a diff --git a/layouts/default.xml b/layouts/default.xml index 6ae8b30..949290a 100644 --- a/layouts/default.xml +++ b/layouts/default.xml @@ -44,8 +44,12 @@ <% end %> +<% if @item.raw_filename %> <%= item_source(@item) %> - <%= item.fetch(:gitrev) %> +<% elsif File.basename(@item.identifier) == "index.lst" %> + <%= "content" + File.dirname(@item.identifier) %> +<% end %> + <%= @item.fetch(:gitrev) %> <%= Time.now.gmtime.strftime "%Y-%m-%d %H:%M UTC" %> diff --git a/layouts/default.xsl b/layouts/default.xsl index f41467b..075ad18 100644 --- a/layouts/default.xsl +++ b/layouts/default.xsl @@ -34,7 +34,7 @@ cdata-section-elements='style' /> + select='"//git.draconx.ca/gitweb/homepage.git/"' /> @@ -219,12 +219,119 @@

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + , + + + + + + , except + and + , + + + © + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ Images © + + + + + + + + . +

+
+

- This document was compiled from - - - + This document was compiled + + + from + + + + + + from + + + + + on . diff --git a/layouts/listing.xhtml b/layouts/listing.xhtml new file mode 100644 index 0000000..2e053d5 --- /dev/null +++ b/layouts/listing.xhtml @@ -0,0 +1,79 @@ +<% +# Nick's web site: Generate directory listing. +# +# Copyright © 2021 Nick Bowler +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see + +mydir = rep_uri + +files = {} +@items.find_all(@item[:pattern]).each do |item| + t = item[:updated_at] + + item.reps.each do |rep| + next if rep == @rep + + p = rep_uri(rep) + d, f = File.split(p) + next unless "#{d}/" == mydir + + if p =~ %r{/$} + sz = Dir.children(File.dirname(rep.raw_path)).length - 1 + type = "DIR" + else + sz = human_filesize(File.size(rep.raw_path)) + type = nil + end + + files[f] = { + mtime: if t then t.getutc.strftime "%Y-%m-%d %H:%M UTC" end, + size: sz, + type: type, + } + end +end + +if @items["#{File.dirname(mydir)}/index.lst"] + files[".."] = { type: "UP" } +end +%> + + + + + +<% files.keys.sort.each do |key| %> + + + + + + +<% end %> + +
NameLast ModifiedSize
+<% if files[key][:type] %> +
+ <%= files[key][:type] %> +
+<% end %> +
<%= + if key == ".." then "[Parent Directory]" else key end + %><%= files[key][:mtime] %><%= files[key][:size] %>
diff --git a/lib/helpers.rb b/lib/helpers.rb index df48f4c..c9a1cc3 100644 --- a/lib/helpers.rb +++ b/lib/helpers.rb @@ -1,6 +1,6 @@ # Nick's web site: Ruby helpers for processing # -# Copyright © 2018-2019 Nick Bowler +# Copyright © 2018-2021 Nick Bowler # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -44,7 +44,11 @@ def item_source(item = @item) end def item_uri(item = @item, rep: :default) - return item.path(rep: rep).gsub(/\/index.[^.]*$/, "/") + return item.path(rep: rep).sub(%r{/index[.][^.]*$}, "/") +end + +def rep_uri(rep = @rep) + return rep.path.sub(%r{/index[.][^.]*$}, "/") end def find_license(license) @@ -73,6 +77,7 @@ end def human_filesize(size) units = ["B", "KiB", "MiB", "GiB"] + prec = 0 for unit in units if (size < 1024) @@ -80,7 +85,8 @@ def human_filesize(size) end size /= 1024.0 + prec = 1 end - sprintf("%.1f %s", size + 0.05, unit) + sprintf("%.*f %s", prec, size + 0.05, unit) end diff --git a/lib/project-readme.rb b/lib/project-readme.rb index 1e1fa87..7469171 100644 --- a/lib/project-readme.rb +++ b/lib/project-readme.rb @@ -17,31 +17,46 @@ def project_readme(item = @item) tag = item.fetch(:release, "HEAD") - shortname = item.fetch(:shortname, item[:title].downcase) + shortname = item.fetch(:shortname, item[:module]) data, status = Open3.capture2("git", "submodule", "foreach", "--quiet", "case $sm_path in */" + item[:module] + ")" + - "git remote get-url origin || echo;" + - "git show " + tag + ":README.md ;;" + + "git fetch --quiet --tags;" + + "git log --max-count=1 --format=%cI #{tag}; printf '\\35';" + + "git show #{tag}:NEWS 2>/dev/null; printf '\\35';" + + "git remote get-url origin; printf '\\35';" + + "git show #{tag}:README.md ;;" + "esac") raise "git submodule foreach failed" if status != 0 - gituri, contents = data.split("\n", 2) + date, news, gituri, contents = data.split("\35", 4) intro, contents = contents.split("#", 2) contents = if contents.nil? then "" else "\n#" + contents end + gituri.strip! gitweb = gituri.sub(%r{^[^/]*(.*)(/.*)}, '\1/gitweb\2') + date = Date.iso8601(date).to_time obtaining = <<~EOF # Obtaining #{item[:title]} EOF if item[:release].nil? - obtaining += <<~EOF + obtaining += "\n" + <<~EOF There are presently no released versions of #{shortname}. EOF else - # TODO + newsver, news = news.split("\n", 2) + newsver.sub!(/^.*([[:digit:]][^:]*).*$/, '\1') + + targz = "#{shortname}-#{newsver}.tar.gz" + distbase = "/archive/#{shortname}" + obtaining += <<~EOF + [archive]: #{distbase} + + All released files are available from the [#{shortname} archive + directory][archive]. + EOF end obtaining += <<~EOF @@ -51,5 +66,39 @@ def project_readme(item = @item) git clone #{gituri} EOF - return intro + obtaining + contents + unless item[:release].nil? + obtaining += "\n" + <<~EOF + [targz]: #{distbase}/#{targz} + [targzsig]: #{distbase}/#{targz}.sig + + The most recent release is version #{newsver}, released on + #{date.getutc.strftime("%Y-%m-%d")}. Source code for this version + is available in [#{targz}][targz] ([signature][targzsig]). + Noteworthy changes in this release: + EOF + obtaining += "\n" + news.each_line do |line| + break if line =~ /^[^[:space:]]/ + obtaining += line.lstrip + end + + obtaining += "\n\n" + <<~EOF + [gpg]: https://gnupg.org/ + + Use the signature file to verify that the corresponding source + bundle is intact. After downloading both files, if [GnuPG][gpg] + is installed, the signature can be verified with a command like: + + gpg --verify #{targz}.sig + + If the verification fails because you don't have the required + public key, that key can be imported with a command such as: + + gpg --keyserver keys.gnupg.net --recv-keys 5B45D3D185B8E1F6 + + Then run the verify command again. + EOF + end + + return "#{intro}\n\n#{obtaining}\n\n#{contents}" end