Bereinigt von Pilot-Spezifika (echte Inhalte, Erzbistum-Hamburg-Bezuege, Domain-Werte) - install.env und hugo.toml [params] mit generischen Platzhaltern. docs/ komplett entfernt: Konzept, Manifest, Installations- anleitungen leben jetzt auf der Projekt-Website statt redundant im Repo, README verweist dorthin. Decap-CMS-Version von einer floatenden ^3.0.0 auf ein festes 3.15.1 gepinnt.
29 lines
1.5 KiB
Ruby
Executable File
29 lines
1.5 KiB
Ruby
Executable File
#!/usr/bin/env ruby
|
|
# Generates vorlagen-manifest.json in the given templates folder - lists all
|
|
# .docx/.odt files found there so the methoden-set tool (methoden-set/, see
|
|
# the Methoden-Set chapter on the project website) can offer them automatically as template choices,
|
|
# including files someone copied manually straight onto the server (not
|
|
# just the ones from this repo). Runs in the deploy hook AFTER the rsync of
|
|
# methoden-set/ into the docroot (see the installation guide on the project website) and
|
|
# therefore deliberately scans the docroot itself, not the git worktree -
|
|
# rsync runs there without --delete, so manually added files survive
|
|
# across deploys and show up here too.
|
|
require 'json'
|
|
|
|
verzeichnis = ARGV[0] or abort "Verwendung: #{$0} <vorlagen-verzeichnis>"
|
|
|
|
dateien = Dir.glob(File.join(verzeichnis, '*.{docx,odt}')).map { |pfad| File.basename(pfad) }.sort
|
|
|
|
# Derive the label from the filename (without extension, hyphens/
|
|
# underscores turned into spaces, each word capitalized) - no additional
|
|
# metadata field to maintain, the filename itself is the only source.
|
|
eintraege = dateien.map do |datei|
|
|
format = File.extname(datei).delete_prefix('.')
|
|
name = File.basename(datei, '.*')
|
|
label = name.gsub(/[-_]+/, ' ').strip.split(' ').map { |w| w.empty? ? w : w[0].upcase + w[1..] }.join(' ')
|
|
{ 'datei' => datei, 'format' => format, 'label' => label }
|
|
end
|
|
|
|
File.write(File.join(verzeichnis, 'vorlagen-manifest.json'), JSON.pretty_generate(eintraege))
|
|
puts "vorlagen-manifest.json geschrieben: #{eintraege.length} Vorlage(n)"
|